This is done with the help of weak aliases of a "non-standard" linker, which has been around since early versions and was supported by all the unix compilers / linkers that I know of. This is mainly done as:
void __foo(void); void foo(void) __attribute__((weak, alias("__foo")));
often with macros to abstract it a bit. This makes the foo character have the same address and print as the __foo character by default, but allows it to override the βstrongβ definition somewhere else.
source share