This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using the stack from inline assembly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]