public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* [QUESTION] Extended Asm and red zone
@ 2021-09-17 20:12 Commeownist
  2021-09-17 21:25 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Commeownist @ 2021-09-17 20:12 UTC (permalink / raw)
  To: gcc-help

Is it safe to push onto the stack in an Extended Asm block if `-mred-
zone` flag is specified (red zone is enabled)? Does GCC assume that any
`asm` block invalidates red zone? Is some additional setup required to
inform the compiler about it?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [QUESTION] Extended Asm and red zone
  2021-09-17 20:12 [QUESTION] Extended Asm and red zone Commeownist
@ 2021-09-17 21:25 ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2021-09-17 21:25 UTC (permalink / raw)
  To: Commeownist; +Cc: gcc-help

On Fri, Sep 17, 2021 at 11:12:07PM +0300, Commeownist wrote:
> Is it safe to push onto the stack in an Extended Asm block if `-mred-
> zone` flag is specified (red zone is enabled)? Does GCC assume that any
> `asm` block invalidates red zone? Is some additional setup required to
> inform the compiler about it?

You have to follow the ABI in your inline asm.  You are typically
allowed to use N bytes of red zone, for some given N; but how will you
know how much the compiler already uses?

So (with most existing ABIs that have the "red zone" concept at all) you
cannot safely use it from inline asm.  Including with the x86-64 ELF ABI
you likely use.  Sorry.


Segher

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-17 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 20:12 [QUESTION] Extended Asm and red zone Commeownist
2021-09-17 21:25 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).