美文网首页
Linux # ld-2.17.so

Linux # ld-2.17.so

作者: FlyingPenguin | 来源:发表于2019-03-05 18:08 被阅读0次

    /lib64/ld-linux-x86-64.so.2只是个软链,真实文件是/usr/lib64/ld-2.17.so。而ld-2.17.so本身并不是库文件,可以把它理解为库文件的管理程序,而且它很特别。

    ld-linux-x86-64.so.2 is a pretty core part of your OS. 
    It actually runs every (64 bit) dynamic application. 
    It's not a library as much as an app itself, a handler that is called when you run an app.
    
    Basically, when you run a dynamic app, the kernel first runs ld-linux.so (or whatever name it is for your bitsize, distro, etc). 
    ld-linux.so then peers into your app, sees the libraries that you need, sees any hard coded paths for the libraries (e.g. rpath's) 
    checks LD_LIBRARY_PATH, 
    and then goes looking for all those libraries, makes sure they match bitsizes, names, what have you. 
    It then collects all of those, loads them, and runs your app. 
    If it can't find the libs, it doesn't run your app.
    
    ld-linux.so can not be affected by LD_LIBRARY_PATH because it is run by the kernel, 
    and the kernel does not load libraries like ld-linux.so does, 
    it just has the one it's configured to run. 
    Again, not a library, so don't use library semantics (LD_LIBRARY_PATH) to change how it's called. 
    It does have environment variables that affect it running - see man ld-linux.so for details.
    

    References:

    https://www.linuxidc.com/Linux/2017-01/139826.htm

    相关文章

      网友评论

          本文标题:Linux # ld-2.17.so

          本文链接:https://www.haomeiwen.com/subject/peuouqtx.html