Gcc/10.2.0/gcc/Symbol 002dRenaming-Pragmas
From Get docs
Next: Structure-Layout Pragmas, Previous: Solaris Pragmas, Up: Pragmas [Contents][Index]
6.62.10 Symbol-Renaming Pragmas
GCC supports a #pragma
directive that changes the name used in
assembly for a given declaration. While this pragma is supported on all
platforms, it is intended primarily to provide compatibility with the
Solaris system headers. This effect can also be achieved using the asm
labels extension (see Asm Labels).
redefine_extname oldname newname
This pragma gives the C function
oldname
the assembly symbolnewname
. The preprocessor macro__PRAGMA_REDEFINE_EXTNAME
is defined if this pragma is available (currently on all platforms).
This pragma and the asm
labels extension interact in a complicated
manner. Here are some corner cases you may want to be aware of:
- This pragma silently applies only to declarations with external linkage. The
asm
label feature does not have this restriction. - In C++, this pragma silently applies only to declarations with āCā linkage. Again,
asm
labels do not have this restriction. - If either of the ways of changing the assembly name of a declaration are applied to a declaration whose assembly name has already been determined (either by a previous use of one of these features, or because the compiler needed the assembly name in order to generate code), and the new name is different, a warning issues and the name does not change.
- The
oldname
used by#pragma redefine_extname
is always the C-language name.