gcc: Asm Labels
1
1 6.45.4 Controlling Names Used in Assembler Code
1 -----------------------------------------------
1
1 You can specify the name to be used in the assembler code for a C
1 function or variable by writing the 'asm' (or '__asm__') keyword after
1 the declarator. It is up to you to make sure that the assembler names
1 you choose do not conflict with any other assembler symbols, or
1 reference registers.
1
1 Assembler names for data:
1 .........................
1
1 This sample shows how to specify the assembler name for data:
1
1 int foo asm ("myfoo") = 2;
1
1 This specifies that the name to be used for the variable 'foo' in the
1 assembler code should be 'myfoo' rather than the usual '_foo'.
1
1 On systems where an underscore is normally prepended to the name of a C
1 variable, this feature allows you to define names for the linker that do
1 not start with an underscore.
1
1 GCC does not support using this feature with a non-static local
1 variable since such variables do not have assembler names. If you are
11 trying to put the variable in a particular register, see ⇒Explicit
Register Variables.
1
1 Assembler names for functions:
1 ..............................
1
1 To specify the assembler name for functions, write a declaration for the
1 function before its definition and put 'asm' there, like this:
1
1 int func (int x, int y) asm ("MYFUNC");
1
1 int func (int x, int y)
1 {
1 /* ... */
1
1 This specifies that the name to be used for the function 'func' in the
1 assembler code should be 'MYFUNC'.
1