Using the stack from inline assembly

Florian Weimer fweimer@redhat.com
Tue Dec 13 15:51:00 GMT 2016


On 12/13/2016 04:41 PM, Jeff Law wrote:
> On 12/13/2016 12:13 AM, 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.
> You can push/pop and perform a function call.  Obviously you have to
> express what's going on from a dataflow standpoint if you use a new
> style asm -- that includes notifying GCC of the registers clobbered at
> the call point and the memory usage.

How do I express that?  It's not that %rsp is clobbered, its unchanged. 
How can I express a clobber on memory which does not even have an 
address as far as C is concerned?

> I do not think the use of inline assembler disables the red zone on the
> x86.

I think Andrew's example shows that we do have a problem here.  I 
wouldn't have thought it so easy to demonstrate.

I'm not aware of a constraint that expresses this properly.

Thanks,
Florian



More information about the Gcc-help mailing list