From: "Joseph S. Myers" <joseph@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: x86 _Decimal128 return value alignment
Date: Thu, 22 Sep 2011 23:32:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1109222246110.1198@digraph.polyomino.org.uk> (raw)
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;
+}
\f
/* 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
next reply other threads:[~2011-09-22 22:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-22 23:32 Joseph S. Myers [this message]
2011-09-23 8:31 ` Mark Kettenis
2011-09-23 9:50 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1109222246110.1198@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox