The alias function attribute causes the function declaration to appear in the object file as an alias for another symbol. This language feature provides a technique for coping with duplicate or cumbersome names.
The aliased function can be defined after the specification of its alias with this function attribute. C also allows an alias specification in the absence of a definition of the aliased function in the same compilation unit.
The original_function_name must be the mangled name.
/* C only */ void __foo(){ /* function body */ } void bar() __attribute__((alias("__foo")));
/* C++ only */ extern "C" __foo(){ /* function body */ } void bar() __attribute__((alias("__foo")));
The compiler does not check for consistency between the declaration of bar and definition of __foo. Such consistency remains the responsibility of the programmer.