1

我有一个我正在从源代码构建的 linux 应用程序。当我对二进制文件运行 ldd 时,我了解大多数库......但不是全部。

有没有办法将标志添加到 ld 或 gcc/g++ 或我能做的任何事情来确定链接器选择链接特定库的原因?


编辑:

为了探索@shloim 设置的路线,我尝试了以下方法:

> nm -u /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
nm: /lib/x86_64-linux-gnu/libcrypto.so.1.0.0: no symbols

> file /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 
/lib/x86_64-linux-gnu/libcrypto.so.1.0.0: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=230ebe6145b6681d0cb7e4c9021f0d899c02e0c4, stripped

是否有明显的原因nm不能在 libcrypto 上工作?

4

2 回答 2

1

This should show you all symbols used in the so file that are undefined within the so:

nm -u <your_so_file>

You can then compare it with

nm --defined-only <3rd_party_so_file>

And try to figure out the common symbols

于 2014-08-21T11:04:34.950 回答
1
Is there an obvious reason why nm would not work on libcrypto?

一般nm是列出目标文件的符号。这里,nm用于share object文件。所以试试这样nm -D libcrypto.so

readelfobjdump也可用于检查shared objects.

readelf -Ws将显示所有符号

于 2014-08-21T13:40:10.477 回答