This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weak symbol in an executable, overridable by shared libraries at runtime


Hello,
Is there a way to define a weak symbol in an executable (not a .so!), that can be overridden by the runtime linking process by a symbol found in another library? The aim is to provide a fallback implementation, within my executable, for systems where a specific function in a standard library cannot be found. More exactly, if I compile my program with -ffast-math, some calls to __pow_finite are generated: on recent systems this function is in libm.so, but on older systems this function simply does not exist. The idea is then to have a weak symbol "__pow_infinite" in my executable, whose implementation just calls the normal "pow": this way, on a recent system, the weak symbol is overridden and the libm.so version is used, whereas on an old system there's no other symbol than the weak one, that would be then picked up.

Cheers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]