The functions of objdump and readelf are similar. You can read the corresponding information from the binary file and display the differences between them. The differences are described in readelf. C:
/* The difference between readelf and objdump:
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
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
ELF File than is provided by objdump. In particle it can display dwarf
Debugging information which (at the moment) objdump cannot .*/
The first difference is that objdump uses the BFD library for file reading, while readelf does not. In addition, it writes a set of code and does not strictly judge certain conditions. For example, if the CPU type of the processing method is not specified, the BFD library will refuse to execute it, And the readelf can still display its content.
The second difference is that readelf can display debugging information, while objdump does not. However, in fact, the BFD Library supports dwarf processing. By simply processing objdump, debugging information can also be displayed, just as NM does.