This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/3 v2] RISC-V: Give stack slots same align as XLEN.
- From: Jim Wilson <jimw at sifive dot com>
- To: gdb-patches at sourceware dot org
- Cc: andrew dot burgess at embecosm dot com, Jim Wilson <jimw at sifive dot com>
- Date: Mon, 12 Nov 2018 21:37:50 -0800
- Subject: [PATCH 1/3 v2] RISC-V: Give stack slots same align as XLEN.
- References: <CAFyWVaaJf8+UT27GhCqEBZahr8qSF5Z63krgY-8kLqztmWnRkA@mail.gmail.com>
For riscv64-linux target, fixes
FAIL: gdb.base/gnu_vector.exp: call add_many_charvecs
Ensure that stack slots are always the same alignment as XLEN by rounding
up arg align to xlen.
gdb/
* riscv-tdep.c (riscv_call_arg_scalar_int): Use std::min when
setting len. New local align, set to max of arg align and xlen,
and pass to first riscv_assign_stack_location call.
---
gdb/riscv-tdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index db372e2163..f4650dfbf3 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1923,12 +1923,13 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
}
else
{
- int len = (ainfo->length > cinfo->xlen) ? cinfo->xlen : ainfo->length;
+ int len = std::min (ainfo->length, cinfo->xlen);
+ int align = std::max (ainfo->align, cinfo->xlen);
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->int_regs, len, 0))
riscv_assign_stack_location (&ainfo->argloc[0],
- &cinfo->memory, len, ainfo->align);
+ &cinfo->memory, len, align);
if (len < ainfo->length)
{
--
2.17.1