From: Jim Wilson Date: Wed, 14 Nov 2018 22:51:40 +0000 (-0800) Subject: RISC-V: Give stack slots same align as XLEN. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=174f8ac8d49021137f98884fc22a7d233e2f89b2;p=binutils-gdb.git RISC-V: Give stack slots same align as XLEN. 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 62d7f54cc5f..2406c1a5701 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-11-14 Jim Wilson + + * 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 * skip.c (complete_skip_number): New function. diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 7a92fc7fae5..b59cc6ef322 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -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) {