public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bob Breuer <breuerr@mc.net>
To: Kai Tietz <ktietz70@googlemail.com>
Cc: xunxun <xunxun1982@gmail.com>,
	Richard Henderson <rth@twiddle.net>,
	 qemu-devel <qemu-devel@nongnu.org>,
	Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>,
	 "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: [Qemu-devel] gcc auto-omit-frame-pointer vs msvc longjmp
Date: Tue, 25 Oct 2011 17:00:00 -0000	[thread overview]
Message-ID: <4EA6D268.50509@mc.net> (raw)
In-Reply-To: <CAEwic4bUxi6io6wRWvSGwqs98STh0vrMPDWb9Ay97i-ME+XeyA@mail.gmail.com>

Kai Tietz wrote:
> 2011/10/24 Bob Breuer <breuerr@mc.net>:
>> Kai Tietz wrote:
>>> Hi,
>>>
>>> For trunk-version I have a tentative patch for this issue.  On 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
>>>
>>>         * config/i386/i386.c (ix86_frame_pointer_required): Enforce use of
>>>         frame-pointer for 32-bit ms-abi, if setjmp is used.
>>>
>>> Index: i386.c
>>> ===================================================================
>>> --- i386.c      (revision 180099)
>>> +++ i386.c      (working copy)
>>> @@ -8391,6 +8391,10 @@
>>>    if (SUBTARGET_FRAME_POINTER_REQUIRED)
>>>      return true;
>>>
>>> +  /* For older 32-bit runtimes setjmp requires valid frame-pointer.  */
>>> +  if (TARGET_32BIT_MS_ABI && cfun->calls_setjmp)
>>> +    return true;
>>> +
>>>    /* 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.  */
>>>
>> For a gcc 4.7 snapshot, this does fix the longjmp problem that I
>> encountered.  So 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
> ===================================================================
> --- 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
> ===================================================================
> --- 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.  */
> 

That works for me. Thanks.

Bob

  reply	other threads:[~2011-10-25 15:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E9BB180.6080506@mc.net>
     [not found] ` <4E9C0497.2000605@siriusit.co.uk>
     [not found]   ` <4E9C3703.3040109@mc.net>
2011-10-17 21:20     ` Richard Henderson
2011-10-17 21:32       ` [Qemu-devel] " Blue Swirl
2011-10-17 22:23         ` Richard Henderson
2011-10-17 22:56       ` Bob Breuer
2011-10-18  2:06         ` Kai Tietz
2011-10-18  4:20           ` Bob Breuer
2011-10-18  4:22             ` Kai Tietz
2011-10-20  3:26               ` Bob Breuer
2011-10-20  4:18                 ` Richard Henderson
2011-10-20  6:08                 ` xunxun
2011-10-20 15:01                   ` Kai Tietz
2011-10-20 17:12                     ` Kai Tietz
2011-10-21 22:47                       ` jojelino
2011-10-22 12:30                         ` xunxun
2011-10-22 13:18                           ` xunxun
2011-10-22 14:21                             ` Kai Tietz
2011-10-22 22:59                       ` asmwarrior
2011-10-24 20:05                       ` [Qemu-devel] " Bob Breuer
2011-10-24 23:25                         ` Kai Tietz
2011-10-25 17:00                           ` Bob Breuer [this message]
2011-10-20 14:16                 ` jojelino

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=4EA6D268.50509@mc.net \
    --to=breuerr@mc.net \
    --cc=gcc@gcc.gnu.org \
    --cc=ktietz70@googlemail.com \
    --cc=mark.cave-ayland@siriusit.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=xunxun1982@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).