aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wohlferd <dw@LimeGreenSocks.com>2015-09-28 16:45:31 +0000
committerSandra Loosemore <sandra@gcc.gnu.org>2015-09-28 12:45:31 -0400
commit0a53bd6d4dc25af160c2986eb1efecd949118ad3 (patch)
tree3809452aabd9fb20d10e6ee6de455d0db711dae9
parent2876a13f6c35a63bee3cf99c297299248075f423 (diff)
downloadgcc-0a53bd6d4dc25af160c2986eb1efecd949118ad3.zip
gcc-0a53bd6d4dc25af160c2986eb1efecd949118ad3.tar.gz
gcc-0a53bd6d4dc25af160c2986eb1efecd949118ad3.tar.bz2
extend.texi (Asm Labels): Break out text for data vs functions.
2015-09-28 David Wohlferd <dw@LimeGreenSocks.com> * doc/extend.texi (Asm Labels): Break out text for data vs functions. From-SVN: r228212
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/extend.texi45
2 files changed, 29 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dfa382e..f55f53d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-28 David Wohlferd <dw@LimeGreenSocks.com>
+
+ * doc/extend.texi (Asm Labels): Break out text for data vs
+ functions.
+
2015-09-28 Jiong Wang <jiong.wang@arm.com>
Revert:
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 23e6a76..8406945 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -8367,7 +8367,13 @@ asm ("fyl2xp1" : "=t" (result) : "0" (x), "u" (y) : "st(1)");
You can specify the name to be used in the assembler code for a C
function or variable by writing the @code{asm} (or @code{__asm__})
-keyword after the declarator as follows:
+keyword after the declarator.
+It is up to you to make sure that the assembler names you choose do not
+conflict with any other assembler symbols, or reference registers.
+
+@subsubheading Assembler names for data:
+
+This sample shows how to specify the assembler name for data:
@smallexample
int foo asm ("myfoo") = 2;
@@ -8379,33 +8385,30 @@ the assembler code should be @samp{myfoo} rather than the usual
@samp{_foo}.
On systems where an underscore is normally prepended to the name of a C
-function or variable, this feature allows you to define names for the
+variable, this feature allows you to define names for the
linker that do not start with an underscore.
-It does not make sense to use this feature with a non-static local
-variable since such variables do not have assembler names. If you are
-trying to put the variable in a particular register, see @ref{Explicit
-Reg Vars}. GCC presently accepts such code with a warning, but will
-probably be changed to issue an error, rather than a warning, in the
-future.
+GCC does not support using this feature with a non-static local variable
+since such variables do not have assembler names. If you are
+trying to put the variable in a particular register, see
+@ref{Explicit Reg Vars}.
-You cannot use @code{asm} in this way in a function @emph{definition}; but
-you can get the same effect by writing a declaration for the function
-before its definition and putting @code{asm} there, like this:
+@subsubheading Assembler names for functions:
-@smallexample
-extern func () asm ("FUNC");
+To specify the assembler name for functions, write a declaration for the
+function before its definition and put @code{asm} there, like this:
-func (x, y)
- int x, y;
-/* @r{@dots{}} */
+@smallexample
+int func (int x, int y) asm ("MYFUNC");
+
+int func (int x, int y)
+@{
+ /* @r{@dots{}} */
@end smallexample
-It is up to you to make sure that the assembler names you choose do not
-conflict with any other assembler symbols. Also, you must not use a
-register name; that would produce completely invalid assembler code. GCC
-does not as yet have the ability to store static variables in registers.
-Perhaps that will be added.
+@noindent
+This specifies that the name to be used for the function @code{func} in
+the assembler code should be @code{MYFUNC}.
@node Explicit Reg Vars
@subsection Variables in Specified Registers