SysTutorials

Man Pages › Section 1

readelf(1)

NAME

readelf – display information about ELF files

SYNOPSIS

readelf [-a|–all]
        [-h|–file-header]
        [-l|–program-headers|–segments]
        [-S|–section-headers|–sections]
        [-g|–section-groups]
        [-t|–section-details]
        [-e|–headers]
        [-s|–syms|–symbols]
        [–dyn-syms|–lto-syms]
        [–sym-base=[0|8|10|16]]
        [–demangle=style|–no-demangle]
        [–quiet]
        [–recurse-limit|–no-recurse-limit]
        [-U method|–unicode=method]
        [-n|–notes]
        [-r|–relocs]
        [-u|–unwind]
        [-d|–dynamic]
        [-V|–version-info]
        [-A|–arch-specific]
        [-D|–use-dynamic]
        [-L|–lint|–enable-checks]
        [-x <number or name>|–hex-dump=<number or name>]
        [-p <number or name>|–string-dump=<number or name>]
        [-R <number or name>|–relocated-dump=<number or name>]
        [-z|–decompress]
        [-c|–archive-index]
        [-w[lLiaprmfFsoORtUuTgAck]|
         –debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
        [-wK|–debug-dump=follow-links]
        [-wN|–debug-dump=no-follow-links]
        [-P|–process-links]
        [–dwarf-depth=n]
        [–dwarf-start=n]
        [–ctf=section]
        [–ctf-parent=section]
        [–ctf-symbols=section]
        [–ctf-strings=section]
        [-I|–histogram]
        [-v|–version]
        [-W|–wide]
        [-T|–silent-truncation]
        [-H|–help]
        elffile…

DESCRIPTION

readelf displays information about one or more ELF format object files. The options control what particular information to display.

elffile… are the object files to be examined. 32-bit and 64-bit ELF files are supported, as are archives containing ELF files.

This program performs a similar function to objdump but it goes into more detail and it exists independently of the BFD library, so if there is a bug in BFD then readelf will not be affected.

OPTIONS

The long and short forms of options, shown here as alternatives, are equivalent. At least one option besides -v or -H must be given.

-a

–all

Equivalent to specifying –file-header, –program-headers, –sections, –symbols, –relocs, –dynamic, –notes, –version-info, –arch-specific, –unwind, –section-groups and –histogram.

Note – this option does not enable –use-dynamic itself, so if that option is not present on the command line then dynamic symbols and dynamic relocs will not be displayed.

-h

–file-header

Displays the information contained in the ELF header at the start of the file.

-l

–program-headers

–segments

Displays the information contained in the file’s segment headers, if it has any.

–quiet

Suppress “no symbols” diagnostic.

-S

–sections

–section-headers

Displays the information contained in the file’s section headers, if it has any.

-g

–section-groups

Displays the information contained in the file’s section groups, if it has any.

-t

–section-details

Displays the detailed section information. Implies -S.

-s

–symbols

–syms

Displays the entries in symbol table section of the file, if it has one. If a symbol has version information associated with it then this is displayed as well. The version string is displayed as a suffix to the symbol name, preceded by an @ character. For example foo [at] VER_1. If the version is the default version to be used when resolving unversioned references to the symbol then it is displayed as a suffix preceded by two @ characters. For example foo@@VER_2.

–dyn-syms

Displays the entries in dynamic symbol table section of the file, if it has one. The output format is the same as the format used by the –syms option.

–lto-syms

Displays the contents of any LTO symbol tables in the file.

–sym-base=[0|8|10|16]

Forces the size field of the symbol table to use the given base. Any unrecognized options will be treated as 0. –sym-base=0 represents the default and legacy behaviour. This will output sizes as decimal for numbers less than 100000. For sizes 100000 and greater hexadecimal notation will be used with a 0x prefix. –sym-base=8 will give the symbol sizes in octal. –sym-base=10 will always give the symbol sizes in decimal. –sym-base=16 will always give the symbol sizes in hexadecimal with a 0x prefix.

-C

–demangle[=style]

Decode (demangle) low-level symbol names into user-level names. This makes C++ function names readable. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler.

–no-demangle

Do not demangle low-level symbol names. This is the default.

–recurse-limit

–no-recurse-limit

–recursion-limit

–no-recursion-limit

Enables or disables a limit on the amount of recursion performed whilst demangling strings. Since the name mangling formats allow for an infinite level of recursion it is possible to create strings whose decoding will exhaust the amount of stack space available on the host machine, triggering a memory fault. The limit tries to prevent this from happening by restricting recursion to 2048 levels of nesting.

The default is for this limit to be enabled, but disabling it may be necessary in order to demangle truly complicated names. Note however that if the recursion limit is disabled then stack exhaustion is possible and any bug reports about such an event will be rejected.

-U [d|i|l|e|x|h]

–unicode=[default|invalid|locale|escape|hex|highlight]

Controls the display of non-ASCII characters in identifier names. The default (–unicode=locale or –unicode=default) is to treat them as multibyte characters and display them in the current locale. All other versions of this option treat the bytes as UTF-8 encoded values and attempt to interpret them. If they cannot be interpreted or if the –unicode=invalid option is used then they are displayed as a sequence of hex bytes, encloses in curly parethesis characters.

Using the –unicode=escape option will display the characters as as unicode escape sequences (