readelf和objdump的区别
发布日期:2021-06-29 14:21:09 浏览次数:3 分类:技术文章

本文共 1277 字,大约阅读时间需要 4 分钟。

第一个区别,objdump使用了bfd库进行文件读取,而readelf则没有,另外写的一套代码,且对一些条件的判断并不是很严格。比如对于没有指定处理方式的CPU类型,BFD库将拒绝往下执行,readelf还是可以显示其内容。

第二个区别,readelf可以显示调试信息,而objdump则没有。但是实际上bfd库支持DWARF的处理,通过简单处理objdump也可以显示调试信息,就如同nm做的那样。

 

BFD库是binutils项目的子项目,目标是通过一种统一接口,处理不同目标文件格式。

BFD库:Binary File Description Library。

 

 

/* The difference between readelf and objdump:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

  Both programs are capable of displaying the contents of ELF format files,

  so why does the binutils project have two file dumpers ?

 

  The reason is that objdump sees an ELF file through a BFD filter of the

  world; if BFD has a bug where, say, it disagrees about a machine constant

  in e_flags, then the odds are good that it will remain internally

  consistent.  The linker sees it the BFD way, objdump sees it the BFD way,

  GAS sees it the BFD way.  There was need for a tool to go find out what

  the file actually says.

 

  This is why the readelf program does not link against the BFD library - it

  exists as an independent program to help verify the correct working of BFD.

 

  There is also the case that readelf can provide more information about an

  ELF file than is provided by objdump.  In particular it can display DWARF

  debugging information which (at the moment) objdump cannot.  */

转载地址:https://chilaidashi.blog.csdn.net/article/details/107229323 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:项目构建工具 - CMake (8)常用命令
下一篇:项目构建工具 - CMake (8)安装文件 - install

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月28日 04时36分56秒