📑 Table of Contents

readelf is a program for displaying various information about object files on Unix-like systems, similar to objdump. It is part of the GNU binutils.

readelf and objdump

edit

Both programs are capable of displaying the contents of ELF format files. objdump sees an ELF file through a BFD filter. If BFD has a bug where 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.[1]

Example

edit

The following command displays the contents of the file's dynamic section (to examine the shared library dependencies and rpath):[2]

$ readelf -d <file name>

References

edit
  1. ^ "readelf vs. objdump: why are both needed" on binutils-gdb". GitHub.
  2. ^ "readelf(1) - Linux manual page". man7.org. Retrieved 2021-04-09.


📚 Artikel Terkait di Wikipedia

Objdump

object files. Similar utilities are Borland TDUMP, Microsoft DUMPBIN and readelf. On certain platforms (e.g. macOS), the objdump binary may actually be

Executable and Linkable Format

structure location for alignment reasons. Each entry is structured as: readelf is a Unix binary utility that displays information about one or more ELF

Rpath

"cannot open shared object file: No such file or directory" error. Notes: readelf -d <binary_name> | grep 'R.*PATH' displays the RPATH or RUNPATH of a binary

GNU Binutils

ranlib generate indices for archives (for compatibility; same as ar -s) readelf display contents of ELF files size list section sizes and total size of