Linux 将链接器时搜索路径和运行时搜索路径分开。
对于运行时搜索路径,我在其man page (8 ld.so) 中找到了ld.so
的规则。 :
- DT_RPATH
- 环境 LD_LIBRARY_PATH
- DT_RUNPATH
- ld.so.cache
- /lib,/usr/lib
但是对于链接器时搜索路径,ld
运气不好 :(
Man page for ld
(1 ld)说,除了 -L
选项:
The default set of paths searched (without being specified with
-L
) depends on which emulation mode ld is using, and in some cases also on how it was configured.The paths can also be specified in a link script with the "
SEARCH_DIR
" command. Directories specified this way are searched at the point in which the linker script appears in the command line.
取决于仿真模式的“默认路径集”是否表示“SEARCH_DIR
”?
最佳答案
misssprite , 要查找特定 ELF 仿真的链接器搜索路径,只需运行 ld -m<emulation> --verbose | grep SEARCH_DIR
关于linux - 动态库查找ld的规则是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42808821/