命令行查看共享对象模块(lib*.so)的内容

发布于 2024-09-18 04:31:23 字数 333 浏览 3 评论 0原文

查看共享对象模块 (lib*.so) 内容的命令行是什么?

就像我们如何使用:

ar -t lib*.a

for archives(lib*.a) 一样,它显示库中的所有目标文件。

EDIT1

示例

ar -t lib*.a

给我一个显示:

asset.o

sldep.o

What is the command line to see the contents of a Shared Object module (lib*.so)?

Like how we use:

ar -t lib*.a

for archives(lib*.a) and it displays all the object files in the library.

EDIT1

Example

ar -t lib*.a

gives me a display:

asset.o

sldep.o

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

末蓝 2024-09-25 04:31:23

使用 nm -D --define-only libname.so 从动态库中获取符号名称。
--define-only 开关仅显示这些文件中定义的符号,而不显示对外部函数的引用。

另一种方法是使用 objdump,并仅捕获文本部分中的符号:

objdump -T /usr/lib/libjpeg.so | grep text
...
0001b5c0 g    DF .text  00000016  Base        jdiv_round_up
00003730 g    DF .text  00000417  Base        jpeg_set_colorspace
0000cda0 g    DF .text  000002de  Base        jpeg_consume_input
00002b30 g    DF .text  00000023  Base        jpeg_abort_compress
00003b50 g    DF .text  000000b6  Base        jpeg_default_colorspace
00002810 g    DF .text  00000067  Base        jpeg_suppress_tables
00004110 g    DF .text  00000130  Base        jpeg_add_quant_table
000100c0 g    DF .text  0000011f  Base        jpeg_save_markers
...

use nm -D --defined-only libname.so to get the symbol names from your dynamic library.
The --defined-only switch shows you only the symbol that are defined in these files, and not references to external functions.

An alternative is to use objdump, and catch only the symbols in the text section :

objdump -T /usr/lib/libjpeg.so | grep text
...
0001b5c0 g    DF .text  00000016  Base        jdiv_round_up
00003730 g    DF .text  00000417  Base        jpeg_set_colorspace
0000cda0 g    DF .text  000002de  Base        jpeg_consume_input
00002b30 g    DF .text  00000023  Base        jpeg_abort_compress
00003b50 g    DF .text  000000b6  Base        jpeg_default_colorspace
00002810 g    DF .text  00000067  Base        jpeg_suppress_tables
00004110 g    DF .text  00000130  Base        jpeg_add_quant_table
000100c0 g    DF .text  0000011f  Base        jpeg_save_markers
...
浅浅淡淡 2024-09-25 04:31:23

我认为 nm -D 就是您正在寻找的。

$ nm -D /usr/lib/libpng.so
...
00000000000058f0 T png_reset_zstream
000000000000d420 T png_save_int_32
000000000000d450 T png_save_uint_16
000000000000d3f0 T png_save_uint_32
0000000000007810 T png_set_IHDR
0000000000007500 T png_set_PLTE
000000000000ce20 T png_set_add_alpha
0000000000006670 T png_set_asm_flags
0000000000006970 T png_set_bKGD
000000000001a740 T png_set_background
...

I think nm -D is what you're looking for.

$ nm -D /usr/lib/libpng.so
...
00000000000058f0 T png_reset_zstream
000000000000d420 T png_save_int_32
000000000000d450 T png_save_uint_16
000000000000d3f0 T png_save_uint_32
0000000000007810 T png_set_IHDR
0000000000007500 T png_set_PLTE
000000000000ce20 T png_set_add_alpha
0000000000006670 T png_set_asm_flags
0000000000006970 T png_set_bKGD
000000000001a740 T png_set_background
...
伤痕我心 2024-09-25 04:31:23

nm -D 命令列出了共享库的动态符号,这似乎正是您想要的。

The nm -D command lists the dynamic symbols of your shared library, which seems to be exactly what you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文