This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
x86 _Decimal128 return value alignment
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 22 Sep 2011 22:48:57 +0000 (UTC)
- Subject: x86 _Decimal128 return value alignment
On 32-bit x86, _Decimal128 function return values are stored in a
location whose address is passed as a hidden parameter. This location
must be 16-byte aligned. Although GDB knows about 16-byte alignment
for parameters, it fails to achieve this for this stack slot,
resulting in problems if, for example, the function called from GDB
with a _Decimal128 return value uses an SSE store instruction to
store the return value.
This patch fixes this with an appropriate frame_align function, since
that's the setting used to control alignment of return value slots.
Tested on i686-pc-linux-gnu. OK to commit?
2011-09-22 Joseph Myers <joseph@codesourcery.com>
* i386-tdep.c (i386_frame_align): New.
(i386_gdbarch_init): Use i386_frame_align.
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.336
diff -u -p -r1.336 i386-tdep.c
--- i386-tdep.c 22 Jul 2011 15:31:51 -0000 1.336
+++ i386-tdep.c 22 Sep 2011 22:31:51 -0000
@@ -2228,6 +2228,15 @@ i386_dummy_id (struct gdbarch *gdbarch,
/* See the end of i386_push_dummy_call. */
return frame_id_build (fp + 8, get_frame_pc (this_frame));
}
+
+/* _Decimal128 function return values need 16-byte alignment on the
+ stack. */
+
+static CORE_ADDR
+i386_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+ return sp & -(CORE_ADDR)16;
+}
/* Figure out where the longjmp will land. Slurp the args out of the
@@ -7316,6 +7325,7 @@ i386_gdbarch_init (struct gdbarch_info i
/* Call dummy code. */
set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
+ set_gdbarch_frame_align (gdbarch, i386_frame_align);
set_gdbarch_convert_register_p (gdbarch, i386_convert_register_p);
set_gdbarch_register_to_value (gdbarch, i386_register_to_value);
--
Joseph S. Myers
joseph@codesourcery.com