1、查看库的函数及变量
nm -D /usr/local/lib/liblog4cplus.so
log4/log4cplus-2.0.8$ nm -D /usr/local/lib/liblog4cplus.so
0000000000034aa0 T log4cplus_add_callback_appender
0000000000033980 T log4cplus_file_reconfigure
0000000000033810 T log4cplus_initialize
0000000000033ba0 T log4cplus_logger_exists
...
2、查看有关库的详细信息,包括段、符号表、重定位表等
objdump -x /usr/local/lib/liblog4cplus.so
log4/log4cplus-2.0.8$ objdump -x /usr/local/lib/liblog4cplus.so
/usr/local/lib/liblog4cplus.so: file format elf64-x86-64
Dynamic Section:
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libpthread.so.0
NEEDED libc.so.6
NEEDED ld-linux-x86-64.so.2
NEEDED libgcc_s.so.1
SONAME liblog4cplus-2.0.so.3
3、查看有关库的详细信息,包括头部、段、符号表等
readelf 命令用于显示 ELF(Executable and Linkable Format)文件的信息,包括共享库
readelf -a /usr/local/lib/liblog4cplus.so
log4/log4cplus-2.0.8$ readelf -a /usr/local/lib/liblog4cplus.so
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x2d170
Start of program headers: 64 (bytes into file)
Start of section headers: 7745520 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 8
Size of section headers: 64 (bytes)
Number of section headers: 38
Section header string table index: 37
4、查看库所依赖的其他库
ldd /usr/local/lib/liblog4cplus.so
log4/log4cplus-2.0.8$ ldd /usr/local/lib/liblog4cplus.so
linux-vdso.so.1 (0x00007fffd218a000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f67d0f89000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f67d0beb000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f67d09cc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f67d05db000)
/lib64/ld-linux-x86-64.so.2 (0x00007f67d15a0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f67d03c3000)