gpt4 book ai didi

linux - 动态库查找ld的规则是什么?

转载 作者:太空宇宙 更新时间:2023-11-04 12:32:49 29 4
gpt4 key购买 nike

Linux 将链接器时搜索路径和运行时搜索路径分开。

对于运行时搜索路径,我在其man page (8 ld.so) 中找到了ld.so 的规则。 :

  1. DT_RPATH
  2. 环境 LD_LIBRARY_PATH
  3. DT_RUNPATH
  4. ld.so.cache
  5. /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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com