From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25187 invoked by alias); 24 Oct 2011 16:19:13 -0000 Received: (qmail 25174 invoked by uid 22791); 24 Oct 2011 16:19:10 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GJ,TW_TJ X-Spam-Check-By: sourceware.org Received: from mail-vx0-f175.google.com (HELO mail-vx0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Oct 2011 16:18:56 +0000 Received: by vcbf1 with SMTP id f1so5795957vcb.20 for ; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.147.200 with SMTP id m8mr1775284vcv.129.1319473135240; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) Received: by 10.220.201.73 with HTTP; Mon, 24 Oct 2011 09:18:55 -0700 (PDT) In-Reply-To: <4EA57A26.1050806@mc.net> References: <4E9BB180.6080506@mc.net> <4E9C0497.2000605@siriusit.co.uk> <4E9C3703.3040109@mc.net> <4E9C645A.5060200@twiddle.net> <4E9C9C08.20001@mc.net> <4E9CAACE.4070804@mc.net> <4E9F3BB4.3050604@mc.net> <4EA57A26.1050806@mc.net> Date: Mon, 24 Oct 2011 23:25:00 -0000 Message-ID: Subject: Re: [Qemu-devel] gcc auto-omit-frame-pointer vs msvc longjmp From: Kai Tietz To: Bob Breuer Cc: xunxun , "gcc@gcc.gnu.org" , qemu-devel , Mark Cave-Ayland , Richard Henderson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00429.txt.bz2 2011/10/24 Bob Breuer : > Kai Tietz wrote: >> Hi, >> >> For trunk-version I have a tentative patch for this issue. =A0On 4.6.x >> and older branches this doesn't work, as here we can't differenciate >> that easy between ms- and sysv-abi. >> >> But could somebody give this patch a try? >> >> Regards, >> Kai >> >> ChangeLog >> >> =A0 =A0 =A0 =A0 * config/i386/i386.c (ix86_frame_pointer_required): Enfo= rce use of >> =A0 =A0 =A0 =A0 frame-pointer for 32-bit ms-abi, if setjmp is used. >> >> Index: i386.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- i386.c =A0 =A0 =A0(revision 180099) >> +++ i386.c =A0 =A0 =A0(working copy) >> @@ -8391,6 +8391,10 @@ >> =A0 =A0if (SUBTARGET_FRAME_POINTER_REQUIRED) >> =A0 =A0 =A0return true; >> >> + =A0/* For older 32-bit runtimes setjmp requires valid frame-pointer. = =A0*/ >> + =A0if (TARGET_32BIT_MS_ABI && cfun->calls_setjmp) >> + =A0 =A0return true; >> + >> =A0 =A0/* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINT= ER >> =A0 =A0 =A0 turns off the frame pointer by default. =A0Turn it back on n= ow if >> =A0 =A0 =A0 we've not got a leaf function. =A0*/ >> > > For a gcc 4.7 snapshot, this does fix the longjmp problem that I > encountered. =A0So aside from specifying -fno-omit-frame-pointer for > affected files, what can be done for 4.6? > > Bob Well, for 4.6.x (or older) we just can use the mingw32.h header in gcc/config/i386/ and define here a subtarget-macro to indicate that. The only incompatible point here might be for Wine using the linux-compiler to build Windows related code. A possible patch for 4.6 gcc versions I attached to this mail. Regards, Kai Index: mingw32.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- mingw32.h (revision 180393) +++ mingw32.h (working copy) @@ -239,3 +239,8 @@ /* We should find a way to not have to update this manually. */ #define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-12.dll" +/* For 32-bit Windows we need valid frame-pointer for function using + setjmp. */ +#define SUBTARGET_SETJMP_NEED_FRAME_POINTER \ + (!TARGET_64BIT && cfun->calls_setjmp) + Index: i386.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- i386.c (revision 180393) +++ i386.c (working copy) @@ -8741,6 +8741,12 @@ if (SUBTARGET_FRAME_POINTER_REQUIRED) return true; +#ifdef SUBTARGET_SETJMP_NEED_FRAME_POINTER + /* For older 32-bit runtimes setjmp requires valid frame-pointer. */ + if (SUBTARGET_SETJMP_NEED_FRAME_POINTER) + return true; +#endif + /* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER turns off the frame pointer by default. Turn it back on now if we've not got a leaf function. */