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