ldd usr bin mysql_ldd与otool

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

参考:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值