readelf.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1991-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3
  6. or any later version published by the Free Software Foundation;
  7. with no Invariant Sections, with no Front-Cover Texts, and with no
  8. Back-Cover Texts. A copy of the license is included in the
  9. section entitled "GNU Free Documentation License".
  10. -->
  11. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  12. <head>
  13. <title>GNU Binary Utilities: readelf</title>
  14. <meta name="description" content="GNU Binary Utilities: readelf">
  15. <meta name="keywords" content="GNU Binary Utilities: readelf">
  16. <meta name="resource-type" content="document">
  17. <meta name="distribution" content="global">
  18. <meta name="Generator" content="makeinfo">
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <link href="index.html#Top" rel="start" title="Top">
  21. <link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
  22. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="index.html#Top" rel="up" title="Top">
  24. <link href="elfedit.html#elfedit" rel="next" title="elfedit">
  25. <link href="def-file-format.html#def-file-format" rel="prev" title="def file format">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.smallquotation {font-size: smaller}
  30. div.display {margin-left: 3.2em}
  31. div.example {margin-left: 3.2em}
  32. div.indentedblock {margin-left: 3.2em}
  33. div.lisp {margin-left: 3.2em}
  34. div.smalldisplay {margin-left: 3.2em}
  35. div.smallexample {margin-left: 3.2em}
  36. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style:oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nocodebreak {white-space:nowrap}
  48. span.nolinebreak {white-space:nowrap}
  49. span.roman {font-family:serif; font-weight:normal}
  50. span.sansserif {font-family:sans-serif; font-weight:normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  56. <a name="readelf"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="elfedit.html#elfedit" accesskey="n" rel="next">elfedit</a>, Previous: <a href="dlltool.html#dlltool" accesskey="p" rel="prev">dlltool</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="readelf-1"></a>
  63. <h2 class="chapter">15 readelf</h2>
  64. <a name="index-ELF-file-information"></a>
  65. <a name="index-readelf"></a>
  66. <div class="smallexample">
  67. <pre class="smallexample">readelf [<samp>-a</samp>|<samp>--all</samp>]
  68. [<samp>-h</samp>|<samp>--file-header</samp>]
  69. [<samp>-l</samp>|<samp>--program-headers</samp>|<samp>--segments</samp>]
  70. [<samp>-S</samp>|<samp>--section-headers</samp>|<samp>--sections</samp>]
  71. [<samp>-g</samp>|<samp>--section-groups</samp>]
  72. [<samp>-t</samp>|<samp>--section-details</samp>]
  73. [<samp>-e</samp>|<samp>--headers</samp>]
  74. [<samp>-s</samp>|<samp>--syms</samp>|<samp>--symbols</samp>]
  75. [<samp>--dyn-syms</samp>]
  76. [<samp>-n</samp>|<samp>--notes</samp>]
  77. [<samp>-r</samp>|<samp>--relocs</samp>]
  78. [<samp>-u</samp>|<samp>--unwind</samp>]
  79. [<samp>-d</samp>|<samp>--dynamic</samp>]
  80. [<samp>-V</samp>|<samp>--version-info</samp>]
  81. [<samp>-A</samp>|<samp>--arch-specific</samp>]
  82. [<samp>-D</samp>|<samp>--use-dynamic</samp>]
  83. [<samp>-x</samp> &lt;number or name&gt;|<samp>--hex-dump=</samp>&lt;number or name&gt;]
  84. [<samp>-p</samp> &lt;number or name&gt;|<samp>--string-dump=</samp>&lt;number or name&gt;]
  85. [<samp>-R</samp> &lt;number or name&gt;|<samp>--relocated-dump=</samp>&lt;number or name&gt;]
  86. [<samp>-z</samp>|<samp>--decompress</samp>]
  87. [<samp>-c</samp>|<samp>--archive-index</samp>]
  88. [<samp>-w[lLiaprmfFsoRt]</samp>|
  89. <samp>--debug-dump</samp>[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
  90. [<samp>--dwarf-depth=<var>n</var></samp>]
  91. [<samp>--dwarf-start=<var>n</var></samp>]
  92. [<samp>-I</samp>|<samp>--histogram</samp>]
  93. [<samp>-v</samp>|<samp>--version</samp>]
  94. [<samp>-W</samp>|<samp>--wide</samp>]
  95. [<samp>-H</samp>|<samp>--help</samp>]
  96. <var>elffile</var>&hellip;
  97. </pre></div>
  98. <p><code>readelf</code> displays information about one or more ELF format object
  99. files. The options control what particular information to display.
  100. </p>
  101. <p><var>elffile</var>&hellip; are the object files to be examined. 32-bit and
  102. 64-bit ELF files are supported, as are archives containing ELF files.
  103. </p>
  104. <p>This program performs a similar function to <code>objdump</code> but it
  105. goes into more detail and it exists independently of the <small>BFD</small>
  106. library, so if there is a bug in <small>BFD</small> then readelf will not be
  107. affected.
  108. </p>
  109. <p>The long and short forms of options, shown here as alternatives, are
  110. equivalent. At least one option besides &lsquo;<samp>-v</samp>&rsquo; or &lsquo;<samp>-H</samp>&rsquo; must be
  111. given.
  112. </p>
  113. <dl compact="compact">
  114. <dt><code>-a</code></dt>
  115. <dt><code>--all</code></dt>
  116. <dd><p>Equivalent to specifying <samp>--file-header</samp>,
  117. <samp>--program-headers</samp>, <samp>--sections</samp>, <samp>--symbols</samp>,
  118. <samp>--relocs</samp>, <samp>--dynamic</samp>, <samp>--notes</samp> and
  119. <samp>--version-info</samp>.
  120. </p>
  121. </dd>
  122. <dt><code>-h</code></dt>
  123. <dt><code>--file-header</code></dt>
  124. <dd><a name="index-ELF-file-header-information"></a>
  125. <p>Displays the information contained in the ELF header at the start of the
  126. file.
  127. </p>
  128. </dd>
  129. <dt><code>-l</code></dt>
  130. <dt><code>--program-headers</code></dt>
  131. <dt><code>--segments</code></dt>
  132. <dd><a name="index-ELF-program-header-information"></a>
  133. <a name="index-ELF-segment-information"></a>
  134. <p>Displays the information contained in the file&rsquo;s segment headers, if it
  135. has any.
  136. </p>
  137. </dd>
  138. <dt><code>-S</code></dt>
  139. <dt><code>--sections</code></dt>
  140. <dt><code>--section-headers</code></dt>
  141. <dd><a name="index-ELF-section-information"></a>
  142. <p>Displays the information contained in the file&rsquo;s section headers, if it
  143. has any.
  144. </p>
  145. </dd>
  146. <dt><code>-g</code></dt>
  147. <dt><code>--section-groups</code></dt>
  148. <dd><a name="index-ELF-section-group-information"></a>
  149. <p>Displays the information contained in the file&rsquo;s section groups, if it
  150. has any.
  151. </p>
  152. </dd>
  153. <dt><code>-t</code></dt>
  154. <dt><code>--section-details</code></dt>
  155. <dd><a name="index-ELF-section-information-1"></a>
  156. <p>Displays the detailed section information. Implies <samp>-S</samp>.
  157. </p>
  158. </dd>
  159. <dt><code>-s</code></dt>
  160. <dt><code>--symbols</code></dt>
  161. <dt><code>--syms</code></dt>
  162. <dd><a name="index-ELF-symbol-table-information"></a>
  163. <p>Displays the entries in symbol table section of the file, if it has one.
  164. If a symbol has version information associated with it then this is
  165. displayed as well. The version string is displayed as a suffix to the
  166. symbol name, preceeded by an @ character. For example
  167. &lsquo;<samp>foo@VER_1</samp>&rsquo;. If the version is the default version to be used
  168. when resolving unversioned references to the symbol then it is
  169. displayed as a suffix preceeded by two @ characters. For example
  170. &lsquo;<samp>foo@@VER_2</samp>&rsquo;.
  171. </p>
  172. </dd>
  173. <dt><code>--dyn-syms</code></dt>
  174. <dd><a name="index-ELF-dynamic-symbol-table-information"></a>
  175. <p>Displays the entries in dynamic symbol table section of the file, if it
  176. has one. The output format is the same as the format used by the
  177. <samp>--syms</samp> option.
  178. </p>
  179. </dd>
  180. <dt><code>-e</code></dt>
  181. <dt><code>--headers</code></dt>
  182. <dd><p>Display all the headers in the file. Equivalent to <samp>-h -l -S</samp>.
  183. </p>
  184. </dd>
  185. <dt><code>-n</code></dt>
  186. <dt><code>--notes</code></dt>
  187. <dd><a name="index-ELF-notes"></a>
  188. <p>Displays the contents of the NOTE segments and/or sections, if any.
  189. </p>
  190. </dd>
  191. <dt><code>-r</code></dt>
  192. <dt><code>--relocs</code></dt>
  193. <dd><a name="index-ELF-reloc-information"></a>
  194. <p>Displays the contents of the file&rsquo;s relocation section, if it has one.
  195. </p>
  196. </dd>
  197. <dt><code>-u</code></dt>
  198. <dt><code>--unwind</code></dt>
  199. <dd><a name="index-unwind-information"></a>
  200. <p>Displays the contents of the file&rsquo;s unwind section, if it has one. Only
  201. the unwind sections for IA64 ELF files, as well as ARM unwind tables
  202. (<code>.ARM.exidx</code> / <code>.ARM.extab</code>) are currently supported.
  203. </p>
  204. </dd>
  205. <dt><code>-d</code></dt>
  206. <dt><code>--dynamic</code></dt>
  207. <dd><a name="index-ELF-dynamic-section-information"></a>
  208. <p>Displays the contents of the file&rsquo;s dynamic section, if it has one.
  209. </p>
  210. </dd>
  211. <dt><code>-V</code></dt>
  212. <dt><code>--version-info</code></dt>
  213. <dd><a name="index-ELF-version-sections-information"></a>
  214. <p>Displays the contents of the version sections in the file, it they
  215. exist.
  216. </p>
  217. </dd>
  218. <dt><code>-A</code></dt>
  219. <dt><code>--arch-specific</code></dt>
  220. <dd><p>Displays architecture-specific information in the file, if there
  221. is any.
  222. </p>
  223. </dd>
  224. <dt><code>-D</code></dt>
  225. <dt><code>--use-dynamic</code></dt>
  226. <dd><p>When displaying symbols, this option makes <code>readelf</code> use the
  227. symbol hash tables in the file&rsquo;s dynamic section, rather than the
  228. symbol table sections.
  229. </p>
  230. </dd>
  231. <dt><code>-x &lt;number or name&gt;</code></dt>
  232. <dt><code>--hex-dump=&lt;number or name&gt;</code></dt>
  233. <dd><p>Displays the contents of the indicated section as a hexadecimal bytes.
  234. A number identifies a particular section by index in the section table;
  235. any other string identifies all sections with that name in the object file.
  236. </p>
  237. </dd>
  238. <dt><code>-R &lt;number or name&gt;</code></dt>
  239. <dt><code>--relocated-dump=&lt;number or name&gt;</code></dt>
  240. <dd><p>Displays the contents of the indicated section as a hexadecimal
  241. bytes. A number identifies a particular section by index in the
  242. section table; any other string identifies all sections with that name
  243. in the object file. The contents of the section will be relocated
  244. before they are displayed.
  245. </p>
  246. </dd>
  247. <dt><code>-p &lt;number or name&gt;</code></dt>
  248. <dt><code>--string-dump=&lt;number or name&gt;</code></dt>
  249. <dd><p>Displays the contents of the indicated section as printable strings.
  250. A number identifies a particular section by index in the section table;
  251. any other string identifies all sections with that name in the object file.
  252. </p>
  253. </dd>
  254. <dt><code>-z</code></dt>
  255. <dt><code>--decompress</code></dt>
  256. <dd><p>Requests that the section(s) being dumped by <samp>x</samp>, <samp>R</samp> or
  257. <samp>p</samp> options are decompressed before being displayed. If the
  258. section(s) are not compressed then they are displayed as is.
  259. </p>
  260. </dd>
  261. <dt><code>-c</code></dt>
  262. <dt><code>--archive-index</code></dt>
  263. <dd><a name="index-Archive-file-symbol-index-information"></a>
  264. <p>Displays the file symbol index information contained in the header part
  265. of binary archives. Performs the same function as the <samp>t</samp>
  266. command to <code>ar</code>, but without using the BFD library. See <a href="ar.html#ar">ar</a>.
  267. </p>
  268. </dd>
  269. <dt><code>-w[lLiaprmfFsoRt]</code></dt>
  270. <dt><code>--debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]</code></dt>
  271. <dd><p>Displays the contents of the debug sections in the file, if any are
  272. present. If one of the optional letters or words follows the switch
  273. then only data found in those specific sections will be dumped.
  274. </p>
  275. <p>Note that there is no single letter option to display the content of
  276. trace sections or .gdb_index.
  277. </p>
  278. <p>Note: the <samp>=decodedline</samp> option will display the interpreted
  279. contents of a .debug_line section whereas the <samp>=rawline</samp> option
  280. dumps the contents in a raw format.
  281. </p>
  282. <p>Note: the <samp>=frames-interp</samp> option will display the interpreted
  283. contents of a .debug_frame section whereas the <samp>=frames</samp> option
  284. dumps the contents in a raw format.
  285. </p>
  286. <p>Note: the output from the <samp>=info</samp> option can also be affected
  287. by the options <samp>--dwarf-depth</samp> and <samp>--dwarf-start</samp>.
  288. </p>
  289. </dd>
  290. <dt><code>--dwarf-depth=<var>n</var></code></dt>
  291. <dd><p>Limit the dump of the <code>.debug_info</code> section to <var>n</var> children.
  292. This is only useful with <samp>--debug-dump=info</samp>. The default is
  293. to print all DIEs; the special value 0 for <var>n</var> will also have this
  294. effect.
  295. </p>
  296. <p>With a non-zero value for <var>n</var>, DIEs at or deeper than <var>n</var>
  297. levels will not be printed. The range for <var>n</var> is zero-based.
  298. </p>
  299. </dd>
  300. <dt><code>--dwarf-start=<var>n</var></code></dt>
  301. <dd><p>Print only DIEs beginning with the DIE numbered <var>n</var>. This is only
  302. useful with <samp>--debug-dump=info</samp>.
  303. </p>
  304. <p>If specified, this option will suppress printing of any header
  305. information and all DIEs before the DIE numbered <var>n</var>. Only
  306. siblings and children of the specified DIE will be printed.
  307. </p>
  308. <p>This can be used in conjunction with <samp>--dwarf-depth</samp>.
  309. </p>
  310. </dd>
  311. <dt><code>-I</code></dt>
  312. <dt><code>--histogram</code></dt>
  313. <dd><p>Display a histogram of bucket list lengths when displaying the contents
  314. of the symbol tables.
  315. </p>
  316. </dd>
  317. <dt><code>-v</code></dt>
  318. <dt><code>--version</code></dt>
  319. <dd><p>Display the version number of readelf.
  320. </p>
  321. </dd>
  322. <dt><code>-W</code></dt>
  323. <dt><code>--wide</code></dt>
  324. <dd><p>Don&rsquo;t break output lines to fit into 80 columns. By default
  325. <code>readelf</code> breaks section header and segment listing lines for
  326. 64-bit ELF files, so that they fit into 80 columns. This option causes
  327. <code>readelf</code> to print each section header resp. each segment one a
  328. single line, which is far more readable on terminals wider than 80 columns.
  329. </p>
  330. </dd>
  331. <dt><code>-H</code></dt>
  332. <dt><code>--help</code></dt>
  333. <dd><p>Display the command line options understood by <code>readelf</code>.
  334. </p>
  335. </dd>
  336. </dl>
  337. <hr>
  338. <div class="header">
  339. <p>
  340. Next: <a href="elfedit.html#elfedit" accesskey="n" rel="next">elfedit</a>, Previous: <a href="dlltool.html#dlltool" accesskey="p" rel="prev">dlltool</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
  341. </div>
  342. </body>
  343. </html>