This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Qemu-devel] gcc auto-omit-frame-pointer vs msvc longjmp
- From: Blue Swirl <blauwirbel at gmail dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: Bob Breuer <breuerr at mc dot net>, Mark Cave-Ayland <mark dot cave-ayland at siriusit dot co dot uk>, Kai Tietz <ktietz70 at googlemail dot com>, qemu-devel <qemu-devel at nongnu dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 17 Oct 2011 19:14:49 +0000
- Subject: Re: [Qemu-devel] gcc auto-omit-frame-pointer vs msvc longjmp
- References: <4E9BB180.6080506@mc.net> <4E9C0497.2000605@siriusit.co.uk> <4E9C3703.3040109@mc.net> <4E9C645A.5060200@twiddle.net>
On Mon, Oct 17, 2011 at 5:22 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 10/17/2011 07:09 AM, Bob Breuer wrote:
>> I don't think this is a free/g_free issue. ÂIf I use the following
>> patch, then I at least get the openbios messages:
>>
>> diff --git a/cpu-exec.c b/cpu-exec.c
>> index a9fa608..dfbd6ea 100644
>> --- a/cpu-exec.c
>> +++ b/cpu-exec.c
>> @@ -180,6 +180,7 @@ static void cpu_handle_debug_exception(CPUState
>> Â/* main execution loop */
>>
>> Âvolatile sig_atomic_t exit_request;
>> +register void *ebp asm("ebp");
>>
>> Âint cpu_exec(CPUState *env)
>> Â{
>> @@ -233,6 +234,8 @@ int cpu_exec(CPUState *env)
>>
>> Â Â Â/* prepare setjmp context for exception handling */
>> Â Â Âfor(;;) {
>> + Â Â Â Âint dummy = 0;
>> + Â Â Â Âebp = &dummy;
>
> See if
>
> Âasm("" : : : "ebp");
>
> also solves the problem.
>
>> Google finds a mention of longjmp failing with -fomit-frame-pointer:
>> http://lua-users.org/lists/lua-l/2005-02/msg00158.html
>>
>> Looks like gcc 4.6 turns on -fomit-frame-pointer by default.
>
> Hmm. ÂThis is the first I've heard of a longjmp implementation
> failing without a frame pointer. ÂPresumably this is with the
> mingw i.e. msvc libc?
>
> This is something that could be worked around in gcc, I suppose.
> We recognize longjmp for some things, we could force the use of
> a frame pointer for msvc targets too.
>
> For now it might be best to simply force -fno-omit-frame-pointer
> for mingw host in the configure script.
IIRC buggy versions of alloca() could also fail without a frame pointer.