问题
Is there a flag or any other directive that I can use to force the Linux Dynamic Linker ld.so
to load all shared libraries at once at start of the program instead of lazy binding.
Essentially I want to turn off lazy binding.
Thanks
回答1:
Setting environment variable LD_BIND_NOW = 1
will do that.
Thanks to @skwllsp for the answer.
回答2:
man ld sayes:
-z keyword
now - When generating an executable or shared library, mark it to tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is linked to using dlopen, instead of deferring function call resolution to the point when the function is first called
http://linux.die.net/man/1/ld
来源:https://stackoverflow.com/questions/22954753/is-there-a-linker-flag-to-force-it-to-load-all-shared-libraries-at-start-time