ldd与otool

栏目: 编程工具 · 发布时间: 5年前

内容简介: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

参考:


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

个体崛起

个体崛起

水木然 / 2017-8-1 / 49.00

互联网时代,社会的组织结构发生着巨变,个体经济将开始大放异彩,未来社会经济的基本单元不再是企业,而是个体。 在这种变化中,如何围绕核心竞争力来构建商业模式,在市场上取得独特地位?每个人的核心竞争力是什么?本书围绕经济战略布局、个体发展规划的生存模式予以分析与梳理,同时把个人命运与国家命脉紧密联系在一起,充满正能量,旨在给读者以反思与启示。一起来看看 《个体崛起》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具