READELF(1)
π NAME π
okay bestie, meet readelf β the GNU Development Tools icon from manual page readelf(1) that displays 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]
[-n|--notes]
[-r|--relocs]
[-u|--unwind]
[-d|--dynamic]
[-V|--version-info]
[-A|--arch-specific]
[-D|--use-dynamic]
[-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[lLiaprmfFsoRtUuTgAckK]|
--debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]]
[--dwarf-depth=n]
[--dwarf-start=n]
[-I|--histogram]
[-v|--version]
[-W|--wide]
[-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. Both 32-bit and 64-bit ELF files are supported, and archives containing ELF files are supported too. π«Ά
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. periodt. π₯
β¨ OPTIONS β¨
okay bestie, quick heads-up before we dive in: the long forms and the short forms of these options are literally the same thing, shown here as alternatives, so -a and --all are giving the exact same energy. Pick whichever one you vibe with.
π the vibe check: you have to give at least one option besides-vor-H. like, just asking for the version or the help doesn't count as "doing a thing". sorry, rules are rules.
-a,--allβ the whole entire menu, bestie. it's equivalent to specifying--file-header,--program-headers,--sections,--symbols,--relocs,--dynamic,--notes,--version-info,--arch-specific,--unwind,--section-groupsand--histogramall at once. iconic, yes. BUT β note that this option does not turn on--use-dynamicby itself, so if that option isn't on your command line then the dynamic symbols and dynamic relocs simply will not be displayed. no cap, it's a whole separate switch. π-h,--file-headerβ shows you the info chillin' in the ELF header right at the start of the file. the opening credits, if you will. π¬-l,--program-headers,--segmentsβ displays what's inside the file's segment headers, if it has any. no segments? no problem, nothing to show. π¦-S,--sections,--section-headersβ displays what's inside the file's section headers, again if it has any. π-g,--section-groupsβ shows the file's section groups, if there are any. group chat but for sections fr fr. π-t,--section-detailsβ the detailed section information. this one implies-S, so you get the sections listing too whether you asked for it or not. main character energy. β¨-s,--symbols,--symsβ displays the entries in the symbol table section of the file, if it has one. and if a symbol has version information attached to it, that gets shown too. the version string shows up as a suffix to the symbol name, preceded by an@character β for examplefoo@VER_1. if that version is the default version to be used when resolving unversioned references to the symbol, then it's displayed as a suffix preceded by two@characters, likefoo@@VER_2. double@= default, that's the whole tell. π--dyn-symsβ displays the entries in the dynamic symbol table section of the file, if it has one. output format is the same as the one--symsuses, so no new layout to learn. π«Ά-e,--headersβ displays all the headers in the file. equivalent to-h -l -S. the full header tour, no stops skipped. π₯-n,--notesβ displays the contents of theNOTEsegments and/or sections, if any. π-r,--relocsβ displays the contents of the file's relocation section, if it has one. π¦-u,--unwindβ displays the contents of the file's unwind section, if it has one. heads up though: only the unwind sections for IA64 ELF files, as well as ARM unwind tables (".ARM.exidx"/".ARM.extab"), are currently supported. so if you rock up with some other architecture, this is not the option for you, bestie. π-d,--dynamicβ displays the contents of the file's dynamic section, if it has one. π-V,--version-infoβ displays the contents of the version sections in the file, if they exist. (yes, the original manual page really does say "it they exist" β we love a typo moment, but the meaning is clear: if they exist. π) β-A,--arch-specificβ displays architecture-specific information in the file, if there's any. π§-D,--use-dynamicβ this one's a mode-switcher, so pay attention:- when displaying symbols, this option makes
readelfuse the symbol hash tables in the file's dynamic section, rather than the symbol table sections. - when displaying relocations, this option makes
readelfdisplay the dynamic relocations rather than the static relocations.
- when displaying symbols, this option makes
two totally different behaviours, one flag. iykyk. π₯
-x <number or name>,--hex-dump=<number or name>β displays the contents of the indicated section as hexadecimal bytes. a number identifies a particular section by its index in the section table; any other string identifies all sections with that name in the object file. so a number is one section, a name can be many. π-R <number or name>,--relocated-dump=<number or name>β displays the contents of the indicated section as hexadecimal bytes, same identification rules as above: a number picks a particular section by index in the section table, any other string picks all sections with that name in the object file. the difference? the contents of the section will be relocated before they're displayed. glow-up before the reveal. β¨-p <number or name>,--string-dump=<number or name>β displays the contents of the indicated section as printable strings. again: number = particular section by index in the section table, other string = all sections with that name in the object file. π-z,--decompressβ requests that the section(s) being dumped by thex,Rorpoptions are decompressed before being displayed. and if the section(s) aren't compressed in the first place? they're displayed as is. no drama, no error, we just show it. π¦-c,--archive-indexβ displays the file symbol index information contained in the header part of binary archives. does the same function as thetcommand toar, but without using the BFD library. same result, different plumbing. π§-w[lLiaprmfFsoRtUuTgAckK],--debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]β the big one, the DWARF dump. displays the contents of the DWARF debug sections in the file, if any are present. compressed debug sections are automatically decompressed (temporarily) before they're displayed β temporary, bestie, don't worry, they get put back. if one or more of the optional letters or words follows the switch, then only those type(s) of data get dumped. π
the letters and words refer to the following info:
"a","=abbrev"β displays the contents of the.debug_abbrevsection."A","=addr"β displays the contents of the.debug_addrsection."c","=cu_index"β displays the contents of the.debug_cu_indexand/or.debug_tu_indexsections."f","=frames"β display the raw contents of a.debug_framesection."F","=frame-interp"β display the interpreted contents of a.debug_framesection. (raw vs interpreted, lowercase vs uppercase, that's the whole bit π)"g","=gdb_index"β displays the contents of the.gdb_indexand/or.debug_namessections."i","=info"β displays the contents of the.debug_infosection. β οΈ note: the output from this option can also be restricted by using the--dwarf-depthand--dwarf-startoptions."k","=links"β displays the contents of the.gnu_debuglinkand/or.gnu_debugaltlinksections. also displays the link to a separate dwarf object file (dwo), if one is specified by theDW_AT_GNU_dwo_nameorDW_AT_dwo_nameattributes in the.debug_infosection. π"K","=follow-links"β display the contents of any selected debug sections that are found in a linked, separate debug info file. heads up: this can result in multiple versions of the same debug section being displayed if both the main file and the separate debug info file contain sections with the same name. so no, it's not a bug, it's literally what you asked for. π
in addition, when displaying DWARF attributes, if a form is found that references the separate debug info file, then the referenced contents will also be displayed. it follows the link all the way down. π«Ά
"l","=rawline"β displays the contents of the.debug_linesection in a raw format."L","=decodedline"β displays the interpreted contents of the.debug_linesection."m","=macro"β displays the contents of the.debug_macroand/or.debug_macinfosections."o","=loc"β displays the contents of the.debug_locand/or.debug_loclistssections."p","=pubnames"β displays the contents of the.debug_pubnamesand/or.debug_gnu_pubnamessections."r","=aranges"β displays the contents of the.debug_arangessection."R","=Ranges"β displays the contents of the.debug_rangesand/or.debug_rnglistssections."s","=str"β displays the contents of the.debug_str,.debug_line_strand/or.debug_str_offsetssections."t","=pubtype"β displays the contents of the.debug_pubtypesand/or.debug_gnu_pubtypessections."T","=trace_aranges"β displays the contents of the.trace_arangessection."u","=trace_abbrev"β displays the contents of the.trace_abbrevsection."U","=trace_info"β displays the contents of the.trace_infosection.
π note: displaying the contents of.debug_static_funcs,.debug_static_varsanddebug_weaknamessections is not currently supported. don't come for me, it's just not a thing yet.
--dwarf-depth=nβ limits the dump of the".debug_info"section to n children. only useful with--debug-dump=info. the default is to print all DIEs, and the special value0for n will also have that effect. with a non-zero value for n, DIEs at or deeper than n levels will not be printed. and the range for n is zero-based, so don't go testing your luck with negatives. ποΈ--dwarf-start=nβ print only DIEs beginning with the DIE numbered n. only useful with--debug-dump=info. if specified, this option suppresses printing of any header information and all DIEs before the DIE numbered n β only siblings and children of the specified DIE get printed. and yes, you can absolutely use it together with--dwarf-depth. combo meal. π-I,--histogramβ displays a histogram of bucket list lengths when displaying the contents of the symbol tables. graphs! data! slay. π-v,--versionβ displays the version number ofreadelf. and reminder: this alone does not satisfy the "at least one option besides-vor-H" rule. π-W,--wideβ tellsreadelfnot to break output lines to fit into 80 columns. by default,readelfbreaks section header and segment listing lines for 64-bit ELF files so they fit into 80 columns; this option makesreadelfprint each section header, respectively each segment, on a single line, which is far more readable on terminals wider than 80 columns. if your terminal is wide, bestie, use this. your eyes will thank you. π-H,--helpβ displays the command line options understood byreadelf. the classic "what can u even do" move. π@fileβ reads command-line options from file. the options read are inserted in place of the original@fileoption. if file doesn't exist, or can't be read, then the option is treated literally and not removed. yep, it just sits there looking like a weird filename. π«
options in file are separated by whitespace. a whitespace character may be included in an option by surrounding the entire option in either single or double quotes. any character (including a backslash) may be included by prefixing the character to be included with a backslash. and β plot twist β the file may itself contain additional @file options; any such options will be processed recursively. it's @files all the way down. π
πΈ SEE ALSO πΈ
objdump(1), and the Info entries for binutils. go read those too, they're the extended universe. π
π COPYRIGHT π
okay bestie, legal era π but honestly it's kind of iconic of them to just... let you have this:
Copyright (c) 1991-2018 Free Software Foundation, Inc.
yep, that's the whole range, 1991 all the way through 2018, no cap π«Ά
so here's the vibe: permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation β¨ and the conditions are β no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. literally none. zero. the whole thing is free real estate π
and if you wanna read the fine print (and honestly you should, it's giving responsible queen π), a copy of the license is included in the section entitled GNU Free Documentation License. it's right there, go look, i'll wait π¦
and that's the whole page, bestie!! πΈ this little legend comes from binutils-2.30, dated 2018-01-27 β yes she's a 2018 girlie but she still ate ππ₯ love that for her. go forth and read some ELF files, mwah ππ§ββοΈπ
π¦ where this page comes from
- nixpkgs unstable: djgpp 12.2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms