以下链接器(ld)标志之间的区别是什么?
-unresolved-symbols = ignore-in-shared-libs
-allow-shlib-undefined
?
作为后续工作,此命名法中未解析的符号和未定义的符号有什么区别?
答案 0 :(得分:3)
链接器选项:
--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
的含义没有区别:
差异的建议只是这个古老工具的一部分。