what does the weak_alias function do and where is it defined
from https://github.com/lattera/glibc/blob/master/include/libc-symbols.h
/* Define ALIASNAME as a weak alias for NAME.
If weak aliases are not available, this defines a strong alias. */
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
# define _weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
About weak symbol:
https://en.wikipedia.org/wiki/Weak_symbol
It is a macro that does the following:
It declares a weak function, if you didnt provide a strong symbol name for that function it will call the function you have laised it to. for example
int _foo(){ return 1;}
//And weak alias
int __attribute__((weak, alias("_foo"))) foo();
So if you haven't provided actual implementation for foo it will basically use _foo and return 1.