This is the mail archive of the gcc@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: Request for discussion: Rewrite of inline assembler docs


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


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