SPRUIG8J January 2018 – March 2024
The compiler recognizes a function whose definition contains only a call to another function. If the two functions have the same signature (same return value and same number of parameters with the same type, in the same order), then the compiler can make the calling function an alias of the called function.
For example, consider the following:
int bbb(int arg1, char *arg2);
int aaa(int n, char *str)
{
return bbb(n, str);
}
For this example, the compiler makes aaa an alias of bbb, so that at link time all calls to function aaa should be redirected to bbb. If the linker can successfully redirect all references to aaa, then the body of function aaa can be removed and the symbol aaa is defined at the same address as bbb.
For information about using the GCC function attribute syntax to declare function aliases, see Section 5.13.2