all.
I want to link a library which calls malloc() function.
However, my target environment is different one and
malloc() is supplied as in
I think the alias attribute might solve your problem:
alias ("target")
The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified. For instance,
void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));
defines `f' to be a weak alias for `__f'. In C++, the mangled name for the target must be used. It is an error if `__f' is not defined in the same translation unit.
Not all target machines support this attribute.
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html