1READELF(1) GNU Development Tools READELF(1)
2
3
4
6 readelf - display information about ELF files
7
9 readelf [-a|--all]
10 [-h|--file-header]
11 [-l|--program-headers|--segments]
12 [-S|--section-headers|--sections]
13 [-g|--section-groups]
14 [-t|--section-details]
15 [-e|--headers]
16 [-s|--syms|--symbols]
17 [--dyn-syms|--lto-syms]
18 [--sym-base=[0|8|10|16]]
19 [--demangle=style|--no-demangle]
20 [--quiet]
21 [--recurse-limit|--no-recurse-limit]
22 [-U method|--unicode=method]
23 [-n|--notes]
24 [-r|--relocs]
25 [-u|--unwind]
26 [-d|--dynamic]
27 [-V|--version-info]
28 [-A|--arch-specific]
29 [-D|--use-dynamic]
30 [-L|--lint|--enable-checks]
31 [-x <number or name>|--hex-dump=<number or name>]
32 [-p <number or name>|--string-dump=<number or name>]
33 [-R <number or name>|--relocated-dump=<number or name>]
34 [-z|--decompress]
35 [-c|--archive-index]
36 [-w[lLiaprmfFsoORtUuTgAck]|
37 --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]]
38 [-wK|--debug-dump=follow-links]
39 [-wN|--debug-dump=no-follow-links]
40 [-wD|--debug-dump=use-debuginfod]
41 [-wE|--debug-dump=do-not-use-debuginfod]
42 [-P|--process-links]
43 [--dwarf-depth=n]
44 [--dwarf-start=n]
45 [--ctf=section]
46 [--ctf-parent=section]
47 [--ctf-symbols=section]
48 [--ctf-strings=section]
49 [--sframe=section]
50 [-I|--histogram]
51 [-v|--version]
52 [-W|--wide]
53 [-T|--silent-truncation]
54 [-H|--help]
55 elffile...
56
58 readelf displays information about one or more ELF format object files.
59 The options control what particular information to display.
60
61 elffile... are the object files to be examined. 32-bit and 64-bit ELF
62 files are supported, as are archives containing ELF files.
63
64 This program performs a similar function to objdump but it goes into
65 more detail and it exists independently of the BFD library, so if there
66 is a bug in BFD then readelf will not be affected.
67
69 The long and short forms of options, shown here as alternatives, are
70 equivalent. At least one option besides -v or -H must be given.
71
72 -a
73 --all
74 Equivalent to specifying --file-header, --program-headers,
75 --sections, --symbols, --relocs, --dynamic, --notes,
76 --version-info, --arch-specific, --unwind, --section-groups and
77 --histogram.
78
79 Note - this option does not enable --use-dynamic itself, so if that
80 option is not present on the command line then dynamic symbols and
81 dynamic relocs will not be displayed.
82
83 -h
84 --file-header
85 Displays the information contained in the ELF header at the start
86 of the file.
87
88 -l
89 --program-headers
90 --segments
91 Displays the information contained in the file's segment headers,
92 if it has any.
93
94 --quiet
95 Suppress "no symbols" diagnostic.
96
97 -S
98 --sections
99 --section-headers
100 Displays the information contained in the file's section headers,
101 if it has any.
102
103 -g
104 --section-groups
105 Displays the information contained in the file's section groups, if
106 it has any.
107
108 -t
109 --section-details
110 Displays the detailed section information. Implies -S.
111
112 -s
113 --symbols
114 --syms
115 Displays the entries in symbol table section of the file, if it has
116 one. If a symbol has version information associated with it then
117 this is displayed as well. The version string is displayed as a
118 suffix to the symbol name, preceded by an @ character. For example
119 foo@VER_1. If the version is the default version to be used when
120 resolving unversioned references to the symbol then it is displayed
121 as a suffix preceded by two @ characters. For example foo@@VER_2.
122
123 --dyn-syms
124 Displays the entries in dynamic symbol table section of the file,
125 if it has one. The output format is the same as the format used by
126 the --syms option.
127
128 --lto-syms
129 Displays the contents of any LTO symbol tables in the file.
130
131 --sym-base=[0|8|10|16]
132 Forces the size field of the symbol table to use the given base.
133 Any unrecognized options will be treated as 0. --sym-base=0
134 represents the default and legacy behaviour. This will output
135 sizes as decimal for numbers less than 100000. For sizes 100000
136 and greater hexadecimal notation will be used with a 0x prefix.
137 --sym-base=8 will give the symbol sizes in octal. --sym-base=10
138 will always give the symbol sizes in decimal. --sym-base=16 will
139 always give the symbol sizes in hexadecimal with a 0x prefix.
140
141 -C
142 --demangle[=style]
143 Decode (demangle) low-level symbol names into user-level names.
144 This makes C++ function names readable. Different compilers have
145 different mangling styles. The optional demangling style argument
146 can be used to choose an appropriate demangling style for your
147 compiler.
148
149 --no-demangle
150 Do not demangle low-level symbol names. This is the default.
151
152 --recurse-limit
153 --no-recurse-limit
154 --recursion-limit
155 --no-recursion-limit
156 Enables or disables a limit on the amount of recursion performed
157 whilst demangling strings. Since the name mangling formats allow
158 for an infinite level of recursion it is possible to create strings
159 whose decoding will exhaust the amount of stack space available on
160 the host machine, triggering a memory fault. The limit tries to
161 prevent this from happening by restricting recursion to 2048 levels
162 of nesting.
163
164 The default is for this limit to be enabled, but disabling it may
165 be necessary in order to demangle truly complicated names. Note
166 however that if the recursion limit is disabled then stack
167 exhaustion is possible and any bug reports about such an event will
168 be rejected.
169
170 -U [d|i|l|e|x|h]
171 --unicode=[default|invalid|locale|escape|hex|highlight]
172 Controls the display of non-ASCII characters in identifier names.
173 The default (--unicode=locale or --unicode=default) is to treat
174 them as multibyte characters and display them in the current
175 locale. All other versions of this option treat the bytes as UTF-8
176 encoded values and attempt to interpret them. If they cannot be
177 interpreted or if the --unicode=invalid option is used then they
178 are displayed as a sequence of hex bytes, encloses in curly
179 parethesis characters.
180
181 Using the --unicode=escape option will display the characters as as
182 unicode escape sequences (\uxxxx). Using the --unicode=hex will
183 display the characters as hex byte sequences enclosed between angle
184 brackets.
185
186 Using the --unicode=highlight will display the characters as
187 unicode escape sequences but it will also highlighted them in red,
188 assuming that colouring is supported by the output device. The
189 colouring is intended to draw attention to the presence of unicode
190 sequences when they might not be expected.
191
192 -e
193 --headers
194 Display all the headers in the file. Equivalent to -h -l -S.
195
196 -n
197 --notes
198 Displays the contents of the NOTE segments and/or sections, if any.
199
200 -r
201 --relocs
202 Displays the contents of the file's relocation section, if it has
203 one.
204
205 -u
206 --unwind
207 Displays the contents of the file's unwind section, if it has one.
208 Only the unwind sections for IA64 ELF files, as well as ARM unwind
209 tables (".ARM.exidx" / ".ARM.extab") are currently supported. If
210 support is not yet implemented for your architecture you could try
211 dumping the contents of the .eh_frames section using the
212 --debug-dump=frames or --debug-dump=frames-interp options.
213
214 -d
215 --dynamic
216 Displays the contents of the file's dynamic section, if it has one.
217
218 -V
219 --version-info
220 Displays the contents of the version sections in the file, it they
221 exist.
222
223 -A
224 --arch-specific
225 Displays architecture-specific information in the file, if there is
226 any.
227
228 -D
229 --use-dynamic
230 When displaying symbols, this option makes readelf use the symbol
231 hash tables in the file's dynamic section, rather than the symbol
232 table sections.
233
234 When displaying relocations, this option makes readelf display the
235 dynamic relocations rather than the static relocations.
236
237 -L
238 --lint
239 --enable-checks
240 Displays warning messages about possible problems with the file(s)
241 being examined. If used on its own then all of the contents of the
242 file(s) will be examined. If used with one of the dumping options
243 then the warning messages will only be produced for the things
244 being displayed.
245
246 -x <number or name>
247 --hex-dump=<number or name>
248 Displays the contents of the indicated section as a hexadecimal
249 bytes. A number identifies a particular section by index in the
250 section table; any other string identifies all sections with that
251 name in the object file.
252
253 -R <number or name>
254 --relocated-dump=<number or name>
255 Displays the contents of the indicated section as a hexadecimal
256 bytes. A number identifies a particular section by index in the
257 section table; any other string identifies all sections with that
258 name in the object file. The contents of the section will be
259 relocated before they are displayed.
260
261 -p <number or name>
262 --string-dump=<number or name>
263 Displays the contents of the indicated section as printable
264 strings. A number identifies a particular section by index in the
265 section table; any other string identifies all sections with that
266 name in the object file.
267
268 -z
269 --decompress
270 Requests that the section(s) being dumped by x, R or p options are
271 decompressed before being displayed. If the section(s) are not
272 compressed then they are displayed as is.
273
274 -c
275 --archive-index
276 Displays the file symbol index information contained in the header
277 part of binary archives. Performs the same function as the t
278 command to ar, but without using the BFD library.
279
280 -w[lLiaprmfFsOoRtUuTgAckK]
281 --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,=follow-links]
282 Displays the contents of the DWARF debug sections in the file, if
283 any are present. Compressed debug sections are automatically
284 decompressed (temporarily) before they are displayed. If one or
285 more of the optional letters or words follows the switch then only
286 those type(s) of data will be dumped. The letters and words refer
287 to the following information:
288
289 "a"
290 "=abbrev"
291 Displays the contents of the .debug_abbrev section.
292
293 "A"
294 "=addr"
295 Displays the contents of the .debug_addr section.
296
297 "c"
298 "=cu_index"
299 Displays the contents of the .debug_cu_index and/or
300 .debug_tu_index sections.
301
302 "f"
303 "=frames"
304 Display the raw contents of a .debug_frame section.
305
306 "F"
307 "=frames-interp"
308 Display the interpreted contents of a .debug_frame section.
309
310 "g"
311 "=gdb_index"
312 Displays the contents of the .gdb_index and/or .debug_names
313 sections.
314
315 "i"
316 "=info"
317 Displays the contents of the .debug_info section. Note: the
318 output from this option can also be restricted by the use of
319 the --dwarf-depth and --dwarf-start options.
320
321 "k"
322 "=links"
323 Displays the contents of the .gnu_debuglink, .gnu_debugaltlink
324 and .debug_sup sections, if any of them are present. Also
325 displays any links to separate dwarf object files (dwo), if
326 they are specified by the DW_AT_GNU_dwo_name or DW_AT_dwo_name
327 attributes in the .debug_info section.
328
329 "K"
330 "=follow-links"
331 Display the contents of any selected debug sections that are
332 found in linked, separate debug info file(s). This can result
333 in multiple versions of the same debug section being displayed
334 if it exists in more than one file.
335
336 In addition, when displaying DWARF attributes, if a form is
337 found that references the separate debug info file, then the
338 referenced contents will also be displayed.
339
340 Note - in some distributions this option is enabled by default.
341 It can be disabled via the N debug option. The default can be
342 chosen when configuring the binutils via the
343 --enable-follow-debug-links=yes or
344 --enable-follow-debug-links=no options. If these are not used
345 then the default is to enable the following of debug links.
346
347 Note - if support for the debuginfod protocol was enabled when
348 the binutils were built then this option will also include an
349 attempt to contact any debuginfod servers mentioned in the
350 DEBUGINFOD_URLS environment variable. This could take some
351 time to resolve. This behaviour can be disabled via the
352 =do-not-use-debuginfod debug option.
353
354 "N"
355 "=no-follow-links"
356 Disables the following of links to separate debug info files.
357
358 "D"
359 "=use-debuginfod"
360 Enables contacting debuginfod servers if there is a need to
361 follow debug links. This is the default behaviour.
362
363 "E"
364 "=do-not-use-debuginfod"
365 Disables contacting debuginfod servers when there is a need to
366 follow debug links.
367
368 "l"
369 "=rawline"
370 Displays the contents of the .debug_line section in a raw
371 format.
372
373 "L"
374 "=decodedline"
375 Displays the interpreted contents of the .debug_line section.
376
377 "m"
378 "=macro"
379 Displays the contents of the .debug_macro and/or .debug_macinfo
380 sections.
381
382 "o"
383 "=loc"
384 Displays the contents of the .debug_loc and/or .debug_loclists
385 sections.
386
387 "O"
388 "=str-offsets"
389 Displays the contents of the .debug_str_offsets section.
390
391 "p"
392 "=pubnames"
393 Displays the contents of the .debug_pubnames and/or
394 .debug_gnu_pubnames sections.
395
396 "r"
397 "=aranges"
398 Displays the contents of the .debug_aranges section.
399
400 "R"
401 "=Ranges"
402 Displays the contents of the .debug_ranges and/or
403 .debug_rnglists sections.
404
405 "s"
406 "=str"
407 Displays the contents of the .debug_str, .debug_line_str and/or
408 .debug_str_offsets sections.
409
410 "t"
411 "=pubtype"
412 Displays the contents of the .debug_pubtypes and/or
413 .debug_gnu_pubtypes sections.
414
415 "T"
416 "=trace_aranges"
417 Displays the contents of the .trace_aranges section.
418
419 "u"
420 "=trace_abbrev"
421 Displays the contents of the .trace_abbrev section.
422
423 "U"
424 "=trace_info"
425 Displays the contents of the .trace_info section.
426
427 Note: displaying the contents of .debug_static_funcs,
428 .debug_static_vars and debug_weaknames sections is not currently
429 supported.
430
431 --dwarf-depth=n
432 Limit the dump of the ".debug_info" section to n children. This is
433 only useful with --debug-dump=info. The default is to print all
434 DIEs; the special value 0 for n will also have this effect.
435
436 With a non-zero value for n, DIEs at or deeper than n levels will
437 not be printed. The range for n is zero-based.
438
439 --dwarf-start=n
440 Print only DIEs beginning with the DIE numbered n. This is only
441 useful with --debug-dump=info.
442
443 If specified, this option will suppress printing of any header
444 information and all DIEs before the DIE numbered n. Only siblings
445 and children of the specified DIE will be printed.
446
447 This can be used in conjunction with --dwarf-depth.
448
449 -P
450 --process-links
451 Display the contents of non-debug sections found in separate
452 debuginfo files that are linked to the main file. This option
453 automatically implies the -wK option, and only sections requested
454 by other command line options will be displayed.
455
456 --ctf[=section]
457 Display the contents of the specified CTF section. CTF sections
458 themselves contain many subsections, all of which are displayed in
459 order.
460
461 By default, display the name of the section named .ctf, which is
462 the name emitted by ld.
463
464 --ctf-parent=member
465 If the CTF section contains ambiguously-defined types, it will
466 consist of an archive of many CTF dictionaries, all inheriting from
467 one dictionary containing unambiguous types. This member is by
468 default named .ctf, like the section containing it, but it is
469 possible to change this name using the
470 "ctf_link_set_memb_name_changer" function at link time. When
471 looking at CTF archives that have been created by a linker that
472 uses the name changer to rename the parent archive member,
473 --ctf-parent can be used to specify the name used for the parent.
474
475 --ctf-symbols=section
476 --ctf-strings=section
477 Specify the name of another section from which the CTF file can
478 inherit strings and symbols. By default, the ".symtab" and its
479 linked string table are used.
480
481 If either of --ctf-symbols or --ctf-strings is specified, the other
482 must be specified as well.
483
484 -I
485 --histogram
486 Display a histogram of bucket list lengths when displaying the
487 contents of the symbol tables.
488
489 -v
490 --version
491 Display the version number of readelf.
492
493 -W
494 --wide
495 Don't break output lines to fit into 80 columns. By default readelf
496 breaks section header and segment listing lines for 64-bit ELF
497 files, so that they fit into 80 columns. This option causes readelf
498 to print each section header resp. each segment one a single line,
499 which is far more readable on terminals wider than 80 columns.
500
501 -T
502 --silent-truncation
503 Normally when readelf is displaying a symbol name, and it has to
504 truncate the name to fit into an 80 column display, it will add a
505 suffix of "[...]" to the name. This command line option disables
506 this behaviour, allowing 5 more characters of the name to be
507 displayed and restoring the old behaviour of readelf (prior to
508 release 2.35).
509
510 -H
511 --help
512 Display the command-line options understood by readelf.
513
514 @file
515 Read command-line options from file. The options read are inserted
516 in place of the original @file option. If file does not exist, or
517 cannot be read, then the option will be treated literally, and not
518 removed.
519
520 Options in file are separated by whitespace. A whitespace
521 character may be included in an option by surrounding the entire
522 option in either single or double quotes. Any character (including
523 a backslash) may be included by prefixing the character to be
524 included with a backslash. The file may itself contain additional
525 @file options; any such options will be processed recursively.
526
528 objdump(1), and the Info entries for binutils.
529
531 Copyright (c) 1991-2023 Free Software Foundation, Inc.
532
533 Permission is granted to copy, distribute and/or modify this document
534 under the terms of the GNU Free Documentation License, Version 1.3 or
535 any later version published by the Free Software Foundation; with no
536 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
537 Texts. A copy of the license is included in the section entitled "GNU
538 Free Documentation License".
539
540
541
542binutils-2.40.00 2023-07-19 READELF(1)