From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3200 invoked by alias); 22 Sep 2011 22:49:18 -0000 Received: (qmail 3192 invoked by uid 22791); 22 Sep 2011 22:49:16 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,TW_GJ X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 22:49:00 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R6s4h-0001ka-U6 from joseph_myers@mentor.com for gdb-patches@sourceware.org; Thu, 22 Sep 2011 15:49:00 -0700 Received: from digraph.polyomino.org.uk ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Sep 2011 23:48:58 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.74) (envelope-from ) id 1R6s4f-0000sD-3r for gdb-patches@sourceware.org; Thu, 22 Sep 2011 22:48:57 +0000 Date: Thu, 22 Sep 2011 23:32:00 -0000 From: "Joseph S. Myers" To: gdb-patches@sourceware.org Subject: x86 _Decimal128 return value alignment Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00418.txt.bz2 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 * 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