RISC-V: Give stack slots same align as XLEN.
authorJim Wilson <jimw@sifive.com>
Wed, 14 Nov 2018 22:51:40 +0000 (14:51 -0800)
committerJim Wilson <jimw@sifive.com>
Wed, 14 Nov 2018 22:51:40 +0000 (14:51 -0800)
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/ChangeLog
gdb/riscv-tdep.c

index 62d7f54..2406c1a 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-14  Jim Wilson  <jimw@sifive.com>
+
+       * 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.
+
 2018-11-12  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * skip.c (complete_skip_number): New function.
index 7a92fc7..b59cc6e 100644 (file)
@@ -1925,12 +1925,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)
        {