本文介绍了readelf与objdump:为什么都需要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解我正在研究的项目的ELF文件布局,并且注意到这些工具的存在.为什么所有Linux发行版都同时包含readelf和objdump?这些工具相互补充吗?我什么时候更喜欢一个使用另一个?

I need to learn about the ELF file layout for a project I am working on and I noticed the existence of these tools.Why do all Linux distributions include both readelf and objdump? Do these tools complement one another? When would i prefer to use one over another?

推荐答案

来自binutils/readelf.c:

from binutils/readelf.c:

 /* The difference between readelf and objdump:

   Both programs are capabale 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.  */

这篇关于readelf与objdump:为什么都需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 14:00