gpt4 book ai didi

linux - readelf 与 objdump : why are both needed

转载 作者:IT老高 更新时间:2023-10-28 12:38:23 25 4
gpt4 key购买 nike

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

最佳答案

来自 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. */

关于linux - readelf 与 objdump : why are both needed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8979664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com