public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Commeownist <commeownist@yandex.ru>
Cc: gcc-help@gcc.gnu.org
Subject: Re: [QUESTION] Extended Asm and red zone
Date: Fri, 17 Sep 2021 16:25:55 -0500	[thread overview]
Message-ID: <20210917212555.GV1583@gate.crashing.org> (raw)
In-Reply-To: <44d37f4823ed7a757afdbb8e9c9078355f2e23d8.camel@yandex.ru>

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

      reply	other threads:[~2021-09-17 21:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 20:12 Commeownist
2021-09-17 21:25 ` Segher Boessenkool [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210917212555.GV1583@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=commeownist@yandex.ru \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).