Controlling Names Used in Assembler Code
6.43 Controlling Names Used in Assembler Code
You can specify the name to be used in the assembler code for a C function or variable by writing the asm
(or __asm__
) keyword after the declarator as follows:
int foo asm ("myfoo") = 2;
This specifies that the name to be used for the variable foo
in the assembler code should be ‘myfoo
’ rather than the usual ‘_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 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 Explici