diff options
author | Jim Wilson <jimw@sifive.com> | 2018-11-14 14:52:34 -0800 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2018-11-14 14:52:34 -0800 |
commit | ef2de9e7eb19cf6f56c8378df82cab30ff741fe0 (patch) | |
tree | b6d1d7ffdda84af419fca6c83e17199cbbbb99d4 | |
parent | 174f8ac8d49021137f98884fc22a7d233e2f89b2 (diff) | |
download | gdb-ef2de9e7eb19cf6f56c8378df82cab30ff741fe0.zip gdb-ef2de9e7eb19cf6f56c8378df82cab30ff741fe0.tar.gz gdb-ef2de9e7eb19cf6f56c8378df82cab30ff741fe0.tar.bz2 |
RISC-V: Handle vector type alignment.
For riscv64-linux target, first half of fix for
FAIL: gdb.base/gnu_vector.exp: call add_various_floatvecs
GCC gives vectors natural aligment based on total size, not element size,
bounded by the maximum supported type alignment.
gdb/
* riscv-tdep.c (BIGGEST_ALIGNMENT): New.
(riscv_type_alignment) <TYPE_CODE_ARRAY>: If TYPE_VECTOR, return min
of TYPE_LENGTH and BIGGEST_ALIGNMENT.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/riscv-tdep.c | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2406c1a..a918439 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2018-11-14 Jim Wilson <jimw@sifive.com> + * riscv-tdep.c (BIGGEST_ALIGNMENT): New. + (riscv_type_alignment) <TYPE_CODE_ARRAY>: If TYPE_VECTOR, return min + of TYPE_LENGTH and BIGGEST_ALIGNMENT. + * 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/riscv-tdep.c b/gdb/riscv-tdep.c index b59cc6e..92f8c6e 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -59,6 +59,9 @@ /* The stack must be 16-byte aligned. */ #define SP_ALIGNMENT 16 +/* The biggest alignment that the target supports. */ +#define BIGGEST_ALIGNMENT 16 + /* Forward declarations. */ static bool riscv_has_feature (struct gdbarch *gdbarch, char feature); @@ -1642,6 +1645,10 @@ riscv_type_alignment (struct type *t) return TYPE_LENGTH (t); case TYPE_CODE_ARRAY: + if (TYPE_VECTOR (t)) + return std::min (TYPE_LENGTH (t), (unsigned) BIGGEST_ALIGNMENT); + /* FALLTHROUGH */ + case TYPE_CODE_COMPLEX: return riscv_type_alignment (TYPE_TARGET_TYPE (t)); |