man-pages/man1/readelf.1.html
2021-03-31 01:06:50 +01:00

820 lines
19 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of READELF</TITLE>
</HEAD><BODY>
<H1>READELF</H1>
Section: GNU Development Tools (1)<BR>Updated: 2021-01-21<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
readelf - display information about ELF files
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
readelf [<B>-a</B>|<B>--all</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-h</B>|<B>--file-header</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-l</B>|<B>--program-headers</B>|<B>--segments</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-S</B>|<B>--section-headers</B>|<B>--sections</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-g</B>|<B>--section-groups</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-t</B>|<B>--section-details</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-e</B>|<B>--headers</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-s</B>|<B>--syms</B>|<B>--symbols</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--dyn-syms</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-n</B>|<B>--notes</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-r</B>|<B>--relocs</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-u</B>|<B>--unwind</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-d</B>|<B>--dynamic</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-V</B>|<B>--version-info</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-A</B>|<B>--arch-specific</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-D</B>|<B>--use-dynamic</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-x</B>&nbsp;&lt;number&nbsp;or&nbsp;name&gt;|<B>--hex-dump=</B>&lt;number&nbsp;or&nbsp;name&gt;]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-p</B>&nbsp;&lt;number&nbsp;or&nbsp;name&gt;|<B>--string-dump=</B>&lt;number&nbsp;or&nbsp;name&gt;]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-R</B>&nbsp;&lt;number&nbsp;or&nbsp;name&gt;|<B>--relocated-dump=</B>&lt;number&nbsp;or&nbsp;name&gt;]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-z</B>|<B>--decompress</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-c</B>|<B>--archive-index</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-w[lLiaprmfFsoRtUuTgAckK]</B>|
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>--debug-dump</B>[=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]]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--dwarf-depth=</B><I>n</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--dwarf-start=</B><I>n</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--ctf=</B><I>section</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--ctf-parent=</B><I>section</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--ctf-symbols=</B><I>section</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>--ctf-strings=</B><I>section</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-I</B>|<B>--histogram</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-v</B>|<B>--version</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-W</B>|<B>--wide</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-H</B>|<B>--help</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>elffile</I>...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>readelf</B> displays information about one or more <FONT SIZE="-1">ELF</FONT> format object
files. The options control what particular information to display.
<P>
<I>elffile</I>... are the object files to be examined. 32-bit and
64-bit <FONT SIZE="-1">ELF</FONT> files are supported, as are archives containing <FONT SIZE="-1">ELF</FONT> files.
<P>
This program performs a similar function to <B>objdump</B> but it
goes into more detail and it exists independently of the <FONT SIZE="-1">BFD</FONT>
library, so if there is a bug in <FONT SIZE="-1">BFD</FONT> then readelf will not be
affected.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
The long and short forms of options, shown here as alternatives, are
equivalent. At least one option besides <B>-v</B> or <B>-H</B> must be
given.
<DL COMPACT>
<DT id="1"><B>-a</B><DD>
<DT id="2"><B>--all</B><DD>
Equivalent to specifying <B>--file-header</B>,
<B>--program-headers</B>, <B>--sections</B>, <B>--symbols</B>,
<B>--relocs</B>, <B>--dynamic</B>, <B>--notes</B>,
<B>--version-info</B>, <B>--arch-specific</B>, <B>--unwind</B>,
<B>--section-groups</B> and <B>--histogram</B>.
<P>
Note - this option does not enable <B>--use-dynamic</B> itself, so
if that option is not present on the command line then dynamic symbols
and dynamic relocs will not be displayed.
<DT id="3"><B>-h</B><DD>
<DT id="4"><B>--file-header</B><DD>
Displays the information contained in the <FONT SIZE="-1">ELF</FONT> header at the start of the
file.
<DT id="5"><B>-l</B><DD>
<DT id="6"><B>--program-headers</B><DD>
<DT id="7"><B>--segments</B><DD>
Displays the information contained in the file's segment headers, if it
has any.
<DT id="8"><B>-S</B><DD>
<DT id="9"><B>--sections</B><DD>
<DT id="10"><B>--section-headers</B><DD>
Displays the information contained in the file's section headers, if it
has any.
<DT id="11"><B>-g</B><DD>
<DT id="12"><B>--section-groups</B><DD>
Displays the information contained in the file's section groups, if it
has any.
<DT id="13"><B>-t</B><DD>
<DT id="14"><B>--section-details</B><DD>
Displays the detailed section information. Implies <B>-S</B>.
<DT id="15"><B>-s</B><DD>
<DT id="16"><B>--symbols</B><DD>
<DT id="17"><B>--syms</B><DD>
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, preceeded by an @ character. For example
<B><A HREF="mailto:foo@VER_1">foo@VER_1</A></B>. If the version is the default version to be used
when resolving unversioned references to the symbol then it is
displayed as a suffix preceeded by two @ characters. For example
<B>foo@@VER_2</B>.
<DT id="18"><B>--dyn-syms</B><DD>
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
<B>--syms</B> option.
<DT id="19"><B>-e</B><DD>
<DT id="20"><B>--headers</B><DD>
Display all the headers in the file. Equivalent to <B>-h -l -S</B>.
<DT id="21"><B>-n</B><DD>
<DT id="22"><B>--notes</B><DD>
Displays the contents of the <FONT SIZE="-1">NOTE</FONT> segments and/or sections, if any.
<DT id="23"><B>-r</B><DD>
<DT id="24"><B>--relocs</B><DD>
Displays the contents of the file's relocation section, if it has one.
<DT id="25"><B>-u</B><DD>
<DT id="26"><B>--unwind</B><DD>
Displays the contents of the file's unwind section, if it has one. Only
the unwind sections for <FONT SIZE="-1">IA64 ELF</FONT> files, as well as <FONT SIZE="-1">ARM</FONT> unwind tables
(<TT>&quot;.ARM.exidx&quot;</TT> / <TT>&quot;.ARM.extab&quot;</TT>) are currently supported. If
support is not yet implemented for your architecture you could try
dumping the contents of the <I>.eh_frames</I> section using the
<B>--debug-dump=frames</B> or <B>--debug-dump=frames-interp</B>
options.
<DT id="27"><B>-d</B><DD>
<DT id="28"><B>--dynamic</B><DD>
Displays the contents of the file's dynamic section, if it has one.
<DT id="29"><B>-V</B><DD>
<DT id="30"><B>--version-info</B><DD>
Displays the contents of the version sections in the file, it they
exist.
<DT id="31"><B>-A</B><DD>
<DT id="32"><B>--arch-specific</B><DD>
Displays architecture-specific information in the file, if there
is any.
<DT id="33"><B>-D</B><DD>
<DT id="34"><B>--use-dynamic</B><DD>
When displaying symbols, this option makes <B>readelf</B> use the
symbol hash tables in the file's dynamic section, rather than the
symbol table sections.
<P>
When displaying relocations, this option makes <B>readelf</B>
display the dynamic relocations rather than the static relocations.
<DT id="35"><B>-x &lt;number or name&gt;</B><DD>
<DT id="36"><B>--hex-dump=&lt;number or name&gt;</B><DD>
Displays the contents of the indicated section as a hexadecimal bytes.
A number identifies a particular section by index in the section table;
any other string identifies all sections with that name in the object file.
<DT id="37"><B>-R &lt;number or name&gt;</B><DD>
<DT id="38"><B>--relocated-dump=&lt;number or name&gt;</B><DD>
Displays the contents of the indicated section as a hexadecimal
bytes. A number identifies a particular section by index in the
section table; any other string identifies all sections with that name
in the object file. The contents of the section will be relocated
before they are displayed.
<DT id="39"><B>-p &lt;number or name&gt;</B><DD>
<DT id="40"><B>--string-dump=&lt;number or name&gt;</B><DD>
Displays the contents of the indicated section as printable strings.
A number identifies a particular section by index in the section table;
any other string identifies all sections with that name in the object file.
<DT id="41"><B>-z</B><DD>
<DT id="42"><B>--decompress</B><DD>
Requests that the section(s) being dumped by <B>x</B>, <B>R</B> or
<B>p</B> options are decompressed before being displayed. If the
section(s) are not compressed then they are displayed as is.
<DT id="43"><B>-c</B><DD>
<DT id="44"><B>--archive-index</B><DD>
Displays the file symbol index information contained in the header part
of binary archives. Performs the same function as the <B>t</B>
command to <B>ar</B>, but without using the <FONT SIZE="-1">BFD</FONT> library.
<DT id="45"><B>-w[lLiaprmfFsoRtUuTgAckK]</B><DD>
<DT id="46"><B>--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]</B><DD>
Displays the contents of the <FONT SIZE="-1">DWARF</FONT> debug sections in the file, if any
are present. Compressed debug sections are automatically decompressed
(temporarily) before they are displayed. If one or more of the
optional letters or words follows the switch then only those type(s)
of data will be dumped. The letters and words refer to the following
information:
<DL COMPACT><DT id="47"><DD>
<DL COMPACT>
<DT id="48">&quot;a&quot;<DD>
<DT id="49">&quot;=abbrev&quot;<DD>
Displays the contents of the <B>.debug_abbrev</B> section.
<DT id="50">&quot;A&quot;<DD>
<DT id="51">&quot;=addr&quot;<DD>
Displays the contents of the <B>.debug_addr</B> section.
<DT id="52">&quot;c&quot;<DD>
<DT id="53">&quot;=cu_index&quot;<DD>
Displays the contents of the <B>.debug_cu_index</B> and/or
<B>.debug_tu_index</B> sections.
<DT id="54">&quot;f&quot;<DD>
<DT id="55">&quot;=frames&quot;<DD>
Display the raw contents of a <B>.debug_frame</B> section.
<DT id="56">&quot;F&quot;<DD>
<DT id="57">&quot;=frame-interp&quot;<DD>
Display the interpreted contents of a <B>.debug_frame</B> section.
<DT id="58">&quot;g&quot;<DD>
<DT id="59">&quot;=gdb_index&quot;<DD>
Displays the contents of the <B>.gdb_index</B> and/or
<B>.debug_names</B> sections.
<DT id="60">&quot;i&quot;<DD>
<DT id="61">&quot;=info&quot;<DD>
Displays the contents of the <B>.debug_info</B> section. Note: the
output from this option can also be restricted by the use of the
<B>--dwarf-depth</B> and <B>--dwarf-start</B> options.
<DT id="62">&quot;k&quot;<DD>
<DT id="63">&quot;=links&quot;<DD>
Displays the contents of the <B>.gnu_debuglink</B> and/or
<B>.gnu_debugaltlink</B> sections. Also displays any links to
separate dwarf object files (dwo), if they are specified by the
DW_AT_GNU_dwo_name or DW_AT_dwo_name attributes in the
<B>.debug_info</B> section.
<DT id="64">&quot;K&quot;<DD>
<DT id="65">&quot;=follow-links&quot;<DD>
Display the contents of any selected debug sections that are found in
linked, separate debug info file(s). This can result in multiple
versions of the same debug section being displayed if it exists in
more than one file.
<P>
In addition, when displaying <FONT SIZE="-1">DWARF</FONT> attributes, if a form is found that
references the separate debug info file, then the referenced contents
will also be displayed.
<DT id="66">&quot;l&quot;<DD>
<DT id="67">&quot;=rawline&quot;<DD>
Displays the contents of the <B>.debug_line</B> section in a raw
format.
<DT id="68">&quot;L&quot;<DD>
<DT id="69">&quot;=decodedline&quot;<DD>
Displays the interpreted contents of the <B>.debug_line</B> section.
<DT id="70">&quot;m&quot;<DD>
<DT id="71">&quot;=macro&quot;<DD>
Displays the contents of the <B>.debug_macro</B> and/or
<B>.debug_macinfo</B> sections.
<DT id="72">&quot;o&quot;<DD>
<DT id="73">&quot;=loc&quot;<DD>
Displays the contents of the <B>.debug_loc</B> and/or
<B>.debug_loclists</B> sections.
<DT id="74">&quot;p&quot;<DD>
<DT id="75">&quot;=pubnames&quot;<DD>
Displays the contents of the <B>.debug_pubnames</B> and/or
<B>.debug_gnu_pubnames</B> sections.
<DT id="76">&quot;r&quot;<DD>
<DT id="77">&quot;=aranges&quot;<DD>
Displays the contents of the <B>.debug_aranges</B> section.
<DT id="78">&quot;R&quot;<DD>
<DT id="79">&quot;=Ranges&quot;<DD>
Displays the contents of the <B>.debug_ranges</B> and/or
<B>.debug_rnglists</B> sections.
<DT id="80">&quot;s&quot;<DD>
<DT id="81">&quot;=str&quot;<DD>
Displays the contents of the <B>.debug_str</B>, <B>.debug_line_str</B>
and/or <B>.debug_str_offsets</B> sections.
<DT id="82">&quot;t&quot;<DD>
<DT id="83">&quot;=pubtype&quot;<DD>
Displays the contents of the <B>.debug_pubtypes</B> and/or
<B>.debug_gnu_pubtypes</B> sections.
<DT id="84">&quot;T&quot;<DD>
<DT id="85">&quot;=trace_aranges&quot;<DD>
Displays the contents of the <B>.trace_aranges</B> section.
<DT id="86">&quot;u&quot;<DD>
<DT id="87">&quot;=trace_abbrev&quot;<DD>
Displays the contents of the <B>.trace_abbrev</B> section.
<DT id="88">&quot;U&quot;<DD>
<DT id="89">&quot;=trace_info&quot;<DD>
Displays the contents of the <B>.trace_info</B> section.
</DL>
</DL>
<DL COMPACT><DT id="90"><DD>
<P>
Note: displaying the contents of <B>.debug_static_funcs</B>,
<B>.debug_static_vars</B> and <B>debug_weaknames</B> sections is not
currently supported.
</DL>
<DT id="91"><B>--dwarf-depth=</B><I>n</I><DD>
Limit the dump of the <TT>&quot;.debug_info&quot;</TT> section to <I>n</I> children.
This is only useful with <B>--debug-dump=info</B>. The default is
to print all DIEs; the special value 0 for <I>n</I> will also have this
effect.
<P>
With a non-zero value for <I>n</I>, DIEs at or deeper than <I>n</I>
levels will not be printed. The range for <I>n</I> is zero-based.
<DT id="92"><B>--dwarf-start=</B><I>n</I><DD>
Print only DIEs beginning with the <FONT SIZE="-1">DIE</FONT> numbered <I>n</I>. This is only
useful with <B>--debug-dump=info</B>.
<P>
If specified, this option will suppress printing of any header
information and all DIEs before the <FONT SIZE="-1">DIE</FONT> numbered <I>n</I>. Only
siblings and children of the specified <FONT SIZE="-1">DIE</FONT> will be printed.
<P>
This can be used in conjunction with <B>--dwarf-depth</B>.
<DT id="93"><B>--ctf=</B><I>section</I><DD>
Display the contents of the specified <FONT SIZE="-1">CTF</FONT> section. <FONT SIZE="-1">CTF</FONT> sections themselves
contain many subsections, all of which are displayed in order.
<DT id="94"><B>--ctf-parent=</B><I>section</I><DD>
Specify the name of another section from which the <FONT SIZE="-1">CTF</FONT> dictionary can inherit
types. (If none is specified, we assume the <FONT SIZE="-1">CTF</FONT> dictionary inherits types
from the default-named member of the archive contained within this section.)
<DT id="95"><B>--ctf-symbols=</B><I>section</I><DD>
<DT id="96"><B>--ctf-strings=</B><I>section</I><DD>
Specify the name of another section from which the <FONT SIZE="-1">CTF</FONT> file can inherit
strings and symbols. By default, the <TT>&quot;.symtab&quot;</TT> and its linked
string table are used.
<P>
If either of <B>--ctf-symbols</B> or <B>--ctf-strings</B> is specified, the
other must be specified as well.
<DT id="97"><B>-I</B><DD>
<DT id="98"><B>--histogram</B><DD>
Display a histogram of bucket list lengths when displaying the contents
of the symbol tables.
<DT id="99"><B>-v</B><DD>
<DT id="100"><B>--version</B><DD>
Display the version number of readelf.
<DT id="101"><B>-W</B><DD>
<DT id="102"><B>--wide</B><DD>
Don't break output lines to fit into 80 columns. By default
<B>readelf</B> breaks section header and segment listing lines for
64-bit <FONT SIZE="-1">ELF</FONT> files, so that they fit into 80 columns. This option causes
<B>readelf</B> to print each section header resp. each segment one a
single line, which is far more readable on terminals wider than 80 columns.
<DT id="103"><B>-H</B><DD>
<DT id="104"><B>--help</B><DD>
Display the command-line options understood by <B>readelf</B>.
<DT id="105"><B>@</B><I>file</I><DD>
Read command-line options from <I>file</I>. The options read are
inserted in place of the original @<I>file</I> option. If <I>file</I>
does not exist, or cannot be read, then the option will be treated
literally, and not removed.
<P>
Options in <I>file</I> 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. The <I>file</I> may itself contain additional
@<I>file</I> options; any such options will be processed recursively.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+objdump">objdump</A></B>(1), and the Info entries for <I>binutils</I>.
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (c) 1991-2020 Free Software Foundation, Inc.
<P>
Permission is granted to copy, distribute and/or modify this document
under the terms of the <FONT SIZE="-1">GNU</FONT> Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``<FONT SIZE="-1">GNU</FONT> Free Documentation License''.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="106"><A HREF="#lbAB">NAME</A><DD>
<DT id="107"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="108"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="109"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="110"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="111"><A HREF="#lbAG">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:26 GMT, March 31, 2021
</BODY>
</HTML>