1. readelf
该指令可以查看当前 elf 文件的依赖。
比如这样:
readelf -d libtinyalsa.a
File: libtinyalsa.a(limits.o)
File: libtinyalsa.a(mixer.o)
File: libtinyalsa.a(pcm.o)
表示这个 .a 依赖于是哪几个 .o 文件
再比如这样:
$ readelf -d libtinyalsa.so
Dynamic section at offset 0x6d24 contains 26 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000e (SONAME) Library soname: [libtinyalsa.so.1]
0x0000000c (INIT) 0x1540
0x0000000d (FINI) 0x6484
0x00000019 (INIT_ARRAY) 0xed18
0x0000001b (INIT_ARRAYSZ) 4 (bytes)
0x0000001a (FINI_ARRAY) 0xed1c
0x0000001c (FINI_ARRAYSZ) 4 (bytes)
0x00000004 (HASH) 0xd4
0x00000005 (STRTAB) 0xb70
0x00000006 (SYMTAB) 0x430
0x0000000a (STRSZ) 1735 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0xee14
0x00000002 (PLTRELSZ) 392 (bytes)
0x00000014 (PLTREL) &n