This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 02/11] Little-endian fixes: structure passing
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 31 Jan 2014 17:42:00 +0100 (CET)
- Subject: [PATCH v2 02/11] Little-endian fixes: structure passing
- Authentication-results: sourceware.org; auth=none
Hello,
when passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot). On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.
However, on little-endian systems, the least-significant bytes are
addresses with offset 0. This patch fixes that.
Tested on powerpc64-linux and powerpc64le-linux.
v2 series changes: none.
Bye,
Ulrich
ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.
Index: binutils-gdb/gdb/ppc-sysv-tdep.c
===================================================================
--- binutils-gdb.orig/gdb/ppc-sysv-tdep.c
+++ binutils-gdb/gdb/ppc-sysv-tdep.c
@@ -1150,7 +1150,8 @@ ppc64_sysv_abi_push_val (struct gdbarch
doubleword are right-aligned and those larger are left-aligned.
GCC versions before 3.4 implemented this incorrectly; see
<http://gcc.gnu.org/gcc-3.4/powerpc-abi.html>. */
- if (len < tdep->wordsize)
+ if (len < tdep->wordsize
+ && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = tdep->wordsize - len;
if (argpos->regcache)
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com