Inline ASM and stack/base pointer

Ian Lance Taylor iant@google.com
Fri Jun 10 01:21:00 GMT 2011


Daniel Mierswa <impulze@impulze.org> writes:

>> What happens if you compile only with -fomit-frame-pointer? I'm not sure
>> if it will be activated without adding an -Ox option. Can you add an
>> example code?
> impulze@istari ~ $ gcc-4.4 -S -fomit-frame-pointer test.c && grep -m1
> lea test.s
> 	lea 12(%esp), %edi
> impulze@istari ~ $ gcc-4.5 -S -fomit-frame-pointer test.c && grep -m1
> lea test.s
> 	lea 12(%esp), %edi
> impulze@istari ~ $ gcc-4.6 -S -fomit-frame-pointer test.c && grep -m1
> lea test.s
> 	lea 12(%esp), %edi
> impulze@istari ~ $ cat test.c
> void f()
> {
>     int i;
>     __asm__ __volatile__("lea %0, %%edi\n"::"m"(i):"%esp");
> }
>
>> What gcc you use?
> 4.4.5, 4.5.2, 4.6.0

Bother, you're right, I was looking at an invalid example.  I don't know
of a way to do this.  Sorry.

Ian



More information about the Gcc-help mailing list