如何查看静态库(.a)所包含的函数?readelf

在linux下可用readelf -c 命令
如静态库为libtest.a,可执行readelf -c libtest.a。

具体命令:

readelf -c xxx.a 查看静态库定义的函数
readelf -A xxx.so 查看动态库定义的函数
readelf -a test 查看test全部信息 
readelf -h test 查看test的ELF Header头信息
readelf -l test 查看test的Program Header Table信息 
readelf -S test 查看test的Section Header Table信息
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
`readelf` 是一个用于查看二进制文件的工具,在这里用于查看静态库文件 `/usr/local/lib/libleveldb.a` 的头部信息。 执行以下命令以查看头部信息: ``` readelf -h /usr/local/lib/libleveldb.a ``` 其中,参数 `-h` 表示查看文件头部信息。 输出类似以下内容: ``` ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 688 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 12 Section header string table index: 11 ``` 其中,我们可以看到一些重要的信息,比如: - 类型 `Type` 是 `REL`,表示是一个可重定位文件。 - 机器架构 `Machine` 是 `Advanced Micro Devices X86-64`,即 x86-64 架构。 - 文件头部大小 `Size of this header` 是 `64` 字节。 - 节头部数量 `Number of section headers` 是 `12`。 - 节头部字符串表索引 `Section header string table index` 是 `11`,表示节头部字符串表在第 11 个位置。 需要注意的是,这里查看的是静态库文件,因此 `Entry point address` 和 `Start of program headers` 等信息都是 0。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值