【Linux笔记】linux系统下链接可执行文件时,linker如何查找共享库
来源:互联网 发布:联合贷网络贷款 编辑:程序博客网 时间:2024/06/03 14:44
下面的内容出自ld manual,作为笔记,记录于此。
The linker uses the following search paths to locate required shared libraries.
1. Any directories specified by -rpath-link options.
2. Any directories specified by -rpath options. The difference between -rpath and -rpath-link is that directories specified by -rpath options are included in the executable and used at runtime, whereas the -rpath-link option is only effective at link time. It is for the native linker only.3. On an ELF system, if the -rpath and "rpath-link" options were not used, search the contents of the environment variable "LD_RUN_PATH". It is for the native linker only.
4. On SunOS, if the -rpath option was not used, search any directories specified using -L options.
5. For a native linker, the contents of the environment variable "LD_LIBRARY_PATH".
6. For a native ELF linker, the directories in "DT_RUNPATH" or "DT_RPATH" of a shared library are searched for shared libraries needed by it. The "DT_RPATH" entries are ignored if "DT_RUNPATH" entries exist.7. The default directories, normally /lib and /usr/lib.
8. For a native linker on an ELF system, if the file /etc/ld.so.conf exists, the list of directories found in that file.If the required shared library is not found, the linker will issue a warning and continue with the link.
可见,-rpath-link指定的查找路径只会被linker使用,而-rpath指定的查找路径除用于linker查找外,还会在进程启动时被loader作为共享库查找路径。
【参考资料】1. -rpath in manual page of ld: man ld and find -rpath
======================= EOF ====================
- 【Linux笔记】linux系统下链接可执行文件时,linker如何查找共享库
- Linux可执行文件执行时找不到共享库
- Linux可执行文件执行时找不到共享库
- linux可执行文件找不到共享库
- Linux下共享链接库 (1)
- Linux下共享链接库 (2)
- linux 下如何查找文件夹
- linux 下如何查找文件夹
- Linux系统下可执行文件的运行过程
- 如何在Linux系统下查找可执行文件
- linux下把普通文件链接到可执行文件中
- Linux如何查找动态库
- 【Linux笔记】细说linux系统下共享库的命名规范和使用方法
- linux下裁剪可执行文件
- linux系统下Qt动态库链接
- Linux下JNI、可执行文件与动态链接库之间的关系
- Linux系统学习笔记:链接
- linux下查看可执行文件需要的库
- poj 2584 T-Shirt Gumbo 二分图多重匹配
- 学术论文Introduction部分的书写
- iOS开发UIView的属性,父视图和子视图的层级操作,子视图的自适应模式,外加一个定时器
- 测试代码问题
- 开发网络爬虫应该怎样选择爬虫框架?
- 【Linux笔记】linux系统下链接可执行文件时,linker如何查找共享库
- 傻瓜式root Android L
- Xcode6中自动布局autolayout和sizeclass的使用
- 关于stripos和strpos的区别
- 日经社説 20141224 再生エネ拡大にブレーキをかけすぎるな
- iOS 判断网络状态 简单示例
- IOS实现本地消息推送
- html颜色代码表
- 以图灵的方式编程