如何显示动态库的的依赖关系

前端之家收集整理的这篇文章主要介绍了如何显示动态库的的依赖关系前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

X86环境下:


root@192.168.1.197:/usr/bin#ldd /usr/lib/libglib-2.0.so
linux-gate.so.1 => (0x00ccc000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00110000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0054a000)
/lib/ld-linux.so.2 (0x00840000)


ARM环境下,显示交叉编译出来的的动态共享库的依赖关系


root@192.168.1.197:/root/Qt/output/qt-arm/lib#arm-none-linux-gnueabi-readelf -d libQtCore.so

Dynamic section at offset 0x2b1260 contains 33 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libts-0.0.so.0]
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000e (SONAME) Library soname: [libQtCore.so.4]
0x0000000f (RPATH) Library rpath: [/root/Qt/output/qt-arm/lib]
0x0000000c (INIT) 0x68c6c
0x0000000d (FINI) 0x1dfaf4
0x00000019 (INIT_ARRAY) 0x2b3000
0x0000001b (INIT_ARRAYSZ) 12 (bytes)
0x0000001a (FINI_ARRAY) 0x2b300c
0x0000001c (FINI_ARRAYSZ) 4 (bytes)
0x00000004 (HASH) 0x114
0x00000005 (STRTAB) 0x20dd4
0x00000006 (SYMTAB) 0x83a4
0x0000000a (STRSZ) 227242 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0x2b9388
0x00000002 (PLTRELSZ) 23984 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x62ebc
0x00000011 (REL) 0x5b7c4
0x00000012 (RELSZ) 30456 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x5b6c4
0x6fffffff (VERNEEDNUM) 7
0x6ffffff0 (VERSYM) 0x5857e
0x6ffffffa (RELCOUNT) 787
0x00000000 (NULL) 0x0
root@192.168.1.197:/root/Qt/output/qt-arm/lib#


显示依赖关系的命令 ***readelf 和交叉编译器有关:

或用 arm-linux-readelf -d *.so

猜你在找的设计模式相关文章