§ Big list of elf file munging / linker / ABI
nm: list symbols in file.
- Useful tools are available at binutils
readelf -a : see everything in an ELF file.
ldd : see shared libraries used by an ELF file.
file : shows filetype info of a given fuile.
- 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.
readelf is arch. independent,
objdump needs the appropriate toolchain.
- Stack overflow reference for difference between objdump and readelf