内容简介:ldd命令用于打印程序或者库文件所依赖的共享库列表ldd不是一个可执行程序,而只是一个shell脚本参考:
ldd
ldd命令用于打印程序或者库文件所依赖的共享库列表
ldd不是一个可执行程序,而只是一个 shell 脚本
golang
go install -buildmode=shared std go build -linkshared hi.go
Linux
ldd /usr/local/bin/openssl linux-vdso.so.1 => (0x00007fffa4913000) libssl.so.1.1 => /usr/local/lib/libssl.so.1.1 (0x00007fc0de4b5000) libcrypto.so.1.1 => /usr/local/lib/libcrypto.so.1.1 (0x00007fc0ddfc5000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc0ddda8000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc0dd9de000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc0dd7da000) /lib64/ld-linux-x86-64.so.2 (0x00007fc0de748000)
Mac
otool -L /usr/local/opt/openssl/bin/openssl /usr/local/Cellar/openssl/1.0.2r/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/Cellar/openssl/1.0.2r/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
LD_TRACE_LOADED_OBJECTS
export LD_TRACE_LOADED_OBJECTS=1 ls linux-vdso.so.1 => (0x00007fffc83fd000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f159e40e000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f159e044000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f159ddd4000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f159dbd0000) /lib64/ld-linux-x86-64.so.2 (0x00007f159e630000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f159d9b3000)
objdump
objdump -s -j .interp `which openssl` Contents of section .interp: 400238 2f6c6962 36342f6c 642d6c69 6e75782d /lib64/ld-linux- 400248 7838362d 36342e73 6f2e3200 x86-64.so.2. ################################ objdump -s -j .interp `which ls` Contents of section .interp: 400238 2f6c6962 36342f6c 642d6c69 6e75782d /lib64/ld-linux- 400248 7838362d 36342e73 6f2e3200 x86-64.so.2.
readelf
readelf -x .interp `which openssl` Hex dump of section '.interp': 0x00400238 2f6c6962 36342f6c 642d6c69 6e75782d /lib64/ld-linux- 0x00400248 7838362d 36342e73 6f2e3200 x86-64.so.2. readelf -x .interp `which ls` Hex dump of section '.interp': 0x00400238 2f6c6962 36342f6c 642d6c69 6e75782d /lib64/ld-linux- 0x00400248 7838362d 36342e73 6f2e3200 x86-64.so.2. readelf -x .interp ./ckb-wallet-linux Warning: Section '.interp' was not dumped because it does not exist!
readelf -d `which openssl` Dynamic section at offset 0x94d88 contains 28 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libssl.so.1.1] 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000001d (RUNPATH) Library runpath: [/usr/local/lib] 0x000000000000000c (INIT) 0x4171c8 0x000000000000000d (FINI) 0x46cc34 0x0000000000000019 (INIT_ARRAY) 0x6948e8 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes) 0x000000000000001a (FINI_ARRAY) 0x6948f0 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes) 0x000000006ffffef5 (GNU_HASH) 0x400298 0x0000000000000005 (STRTAB) 0x408388 0x0000000000000006 (SYMTAB) 0x4003f0 0x000000000000000a (STRSZ) 25298 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000003 (PLTGOT) 0x695000 0x0000000000000002 (PLTRELSZ) 32328 (bytes) 0x0000000000000014 (PLTREL) RELA 0x0000000000000017 (JMPREL) 0x40f380 0x0000000000000007 (RELA) 0x40f200 0x0000000000000008 (RELASZ) 384 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x000000006ffffffe (VERNEED) 0x40f100 0x000000006fffffff (VERNEEDNUM) 4 0x000000006ffffff0 (VERSYM) 0x40e65a 0x0000000000000000 (NULL) 0x0
参考:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
设计模式之禅(第2版)
秦小波 / 机械工业出版社 / 2014-2-25 / 89.00元
本书是设计模式领域公认的3本经典著作之一,“极具趣味,容易理解,但讲解又极为严谨和透彻”是本书的写作风格和方法的最大特点。第1版2010年出版,畅销至今,广受好评,是该领域的里程碑著作。深刻解读6大设计原则和28种设计模式的准确定义、应用方法和最佳实践,全方位比较各种同类模式之间的异同,详细讲解将不同的模式组合使用的方法。第2版在第1版的基础上有两方面的改进,一方面结合读者的意见和建议对原有内容中......一起来看看 《设计模式之禅(第2版)》 这本书的介绍吧!