Is there a linker flag to force it to load all shared libraries at start time?

痞子三分冷 提交于 2019-12-10 15:59:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!