This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request for discussion: Rewrite of inline assembler docs
- From: Andi Kleen <andi at firstfloor dot org>
- To: Andrew Haley <aph at redhat dot com>
- Cc: "gcc\ at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, limegreensocks at yahoo dot com
- Date: Thu, 27 Feb 2014 09:35:49 -0800
- Subject: Re: Request for discussion: Rewrite of inline assembler docs
- Authentication-results: sourceware.org; auth=none
- References: <530F1C69 dot 5050305 at redhat dot com>
Andrew Haley <aph@redhat.com> writes:
> Over the years there has been a great deal of traffic on these lists
> caused by misunderstandings of GCC's inline assembler. That's partly
> because it's inherently tricky, but the existing documentation needs
> to be improved.
>
> dw <limegreensocks@yahoo.com> has done a fairly thorough reworking of
> the documentation. I've helped a bit.
It would be nice if you could include some discussion of the LTO
reference problems.
Something like:
It is not legal to reference a static variable or function symbol from
the assembler code, as the compiler may optimize unused symbols
away. For inline asm in functions these should be referred as "m" input
arguments. For top level asm the referenced symbol should be made global
and marked with __attribute__((externally_visible)) .
And another common problem:
For top level asm there is no guarantee the compiler outputs the
statements in order.
[unless -fno-toplevel-reorder is specified, but I'm not should mention that]
-Andi
--
ak@linux.intel.com -- Speaking for myself only