Using the stack from inline assembly
Florian Weimer
fweimer@redhat.com
Tue Dec 13 15:32:00 GMT 2016
On 12/13/2016 10:48 AM, Andrew Haley wrote:
> On 13/12/16 07:13, Florian Weimer wrote:
>> Is it possible to use the stack from inline assembly? I'm particularly
>> interested in i386 and x86_64, and push/pop instructions and function calls.
>>
>> Will GCC automatically disable use of the red zone on x86_64 if inline
>> assembly is used, or at least assume it's clobbered by inline assembly?
>> If not, how is this supposed to work if it does at all?
>
> It's up to the writer of inline asembly code to DTRT. You're
> expected to know the ABI or not mess with the stack.
The ABI does not talk about inline assembly. :-/
I was just wondering if GCC does something here to simplify matters.
Although it would pessimize code for probably 99% of the users of inline
assembly.
If GCC doesn't disable the red zone on x86_64, calls and push/pop are
quite unsafe, and we have a couple of time bombs in glibc.
Thanks,
Florian
More information about the Gcc-help
mailing list