【发布时间】:2019-09-19 13:12:59
【问题描述】:
以下链接器(ld)标志有什么区别:
--unresolved-symbols=ignore-in-shared-libs
--allow-shlib-undefined
?
作为后续,这个命名法中未解析的符号和未定义的符号有什么区别?
【问题讨论】:
以下链接器(ld)标志有什么区别:
--unresolved-symbols=ignore-in-shared-libs
--allow-shlib-undefined
?
作为后续,这个命名法中未解析的符号和未定义的符号有什么区别?
【问题讨论】:
链接器选项:
--unresolved-symbols=method
允许您为链接器指定 4 种不同标准(方法)中的任何一种 报告或忽略链接中未解析的符号引用。 The manual 说:
--unresolved-symbols=method
确定如何处理未解析的符号。 “方法”有四个可能的值:
‘全部忽略’
Do not report any unresolved symbols.‘全部报告’
Report all unresolved symbols. This is the default.'忽略对象文件'
Report unresolved symbols that are contained in shared libraries, but ignore them if they come from regular object files.‘忽略共享库’
Report unresolved symbols that come from regular object files, but ignore them if they come from shared libraries. This can be useful when creating a dynamic binary and it is known that all the shared libraries that it should be referencing are included on the linker’s command line.共享库自身的行为也可以通过 --[no-]allow-shlib-undefined 选项来控制。
通常链接器会为每个报告的未解析符号生成错误消息,但选项 --warn-unresolved-symbols 可以将其更改为警告。
正如我强调的那句话,链接器选项:
--allow-shlib-undefined
只是一种更简短的说法:
--unresolved-symbols=ignore-in-shared-libs
在这种情况下,undefined 和 unresolved 的含义没有区别:
差异的暗示只是这个古老工具的一部分。
【讨论】: