xref: /llvm-project/llvm/docs/CommandGuide/llvm-readelf.rst (revision 89c95effe82c09b9a42408f4823409331f8fa266)
1llvm-readelf - GNU-style LLVM Object Reader
2===========================================
3
4.. program:: llvm-readelf
5
6SYNOPSIS
7--------
8
9:program:`llvm-readelf` [*options*] [*input...*]
10
11DESCRIPTION
12-----------
13
14The :program:`llvm-readelf` tool displays low-level format-specific information
15about one or more object files.
16
17If ``input`` is "``-``", :program:`llvm-readelf` reads from standard
18input. Otherwise, it will read from the specified ``filenames``.
19
20OPTIONS
21-------
22
23.. option:: --all, -a
24
25 Equivalent to specifying all the main display options relevant to the file
26 format.
27
28.. option:: --addrsig
29
30 Display the address-significance table.
31
32.. option:: --arch-specific, -A
33
34 Display architecture-specific information, e.g. the ARM attributes section on ARM.
35
36.. option:: --bb-addr-map
37
38 Display the contents of the basic block address map section(s), which contain the
39 address of each function, along with the relative offset of each basic block.
40
41.. option:: --decompress, -z
42
43  Dump decompressed section content when used with ``-x`` or ``-p``.
44  If the section(s) are not compressed, they are displayed as is.
45
46.. option:: --demangle, -C
47
48 Display demangled symbol names in the output.
49
50.. option:: --dependent-libraries
51
52 Display the dependent libraries section.
53
54.. option:: --dyn-relocations
55
56 Display the dynamic relocation entries.
57
58.. option:: --dyn-symbols, --dyn-syms
59
60 Display the dynamic symbol table.
61
62.. option:: --dynamic-table, --dynamic, -d
63
64 Display the dynamic table.
65
66.. option:: --cg-profile
67
68 Display the callgraph profile section.
69
70.. option:: --histogram, -I
71
72 Display a bucket list histogram for dynamic symbol hash tables.
73
74.. option:: --elf-linker-options
75
76 Display the linker options section.
77
78.. option:: --elf-output-style=<value>
79
80 Format ELF information in the specified style. Valid options are ``LLVM``,
81 ``GNU``, and ``JSON``. ``LLVM`` output is an expanded and structured format.
82 ``GNU`` (the default) output mimics the equivalent GNU :program:`readelf`
83 output. ``JSON`` is JSON formatted output intended for machine consumption.
84
85.. option:: --extra-sym-info
86
87 Display extra information (section name) when showing symbols.
88
89.. option:: --section-groups, -g
90
91 Display section groups.
92
93.. option:: --expand-relocs
94
95 When used with :option:`--relocations`, display each relocation in an expanded
96 multi-line format.
97
98.. option:: --file-header, -h
99
100 Display file headers.
101
102.. option:: --gnu-hash-table
103
104 Display the GNU hash table for dynamic symbols.
105
106.. option:: --hash-symbols
107
108 Display the expanded hash table with dynamic symbol data.
109
110.. option:: --hash-table
111
112 Display the hash table for dynamic symbols.
113
114.. option:: --headers, -e
115
116 Equivalent to setting: :option:`--file-header`, :option:`--program-headers`,
117 and :option:`--sections`.
118
119.. option:: --help
120
121 Display a summary of command line options.
122
123.. option:: --hex-dump=<section[,section,...]>, -x
124
125 Display the specified section(s) as hexadecimal bytes. ``section`` may be a
126 section index or section name.
127
128.. option:: --memtag
129
130 Display information about memory tagging present in the binary. This includes
131 various memtag-specific dynamic entries, decoded global descriptor sections,
132 and decoded Android-specific ELF notes.
133
134.. option:: --needed-libs
135
136 Display the needed libraries.
137
138.. option:: --no-demangle
139
140 Do not display demangled symbol names in the output. On by default.
141
142.. option:: --notes, -n
143
144 Display all notes.
145
146.. option:: --pretty-print
147
148 When used with :option:`--elf-output-style`, JSON output will be formatted in
149 a more readable format.
150
151.. option:: --program-headers, --segments, -l
152
153 Display the program headers.
154
155.. option:: --relocations, --relocs, -r
156
157 Display the relocation entries in the file.
158
159.. option:: --sections, --section-headers, -S
160
161 Display all sections.
162
163.. option:: --section-data
164
165 When used with :option:`--sections`, display section data for each section
166 shown. This option has no effect for GNU style output.
167
168.. option:: --section-details, -t
169
170 Display all section details. Used as an alternative to :option:`--sections`.
171
172.. option:: --section-mapping
173
174 Display the section to segment mapping.
175
176.. option:: --section-relocations
177
178 When used with :option:`--sections`, display relocations for each section
179 shown. This option has no effect for GNU style output.
180
181.. option:: --section-symbols
182
183 When used with :option:`--sections`, display symbols for each section shown.
184 This option has no effect for GNU style output.
185
186.. option:: --stackmap
187
188 Display contents of the stackmap section.
189
190.. option:: --stack-sizes
191
192 Display the contents of the stack sizes section(s), i.e. pairs of function
193 names and the size of their stack frames. Currently only implemented for GNU
194 style output.
195
196.. option:: --string-dump=<section[,section,...]>, -p
197
198 Display the specified section(s) as a list of strings. ``section`` may be a
199 section index or section name.
200
201.. option:: --symbols, --syms, -s
202
203 Display the symbol table. Also display the dynamic symbol table when using GNU output style for ELF.
204
205.. option:: --unwind, -u
206
207 Display unwind information.
208
209.. option:: --version
210
211 Display the version of the :program:`llvm-readelf` executable.
212
213.. option:: --version-info, -V
214
215 Display version sections.
216
217.. option:: --wide, -W
218
219 Ignored for GNU readelf compatibility. The output is already similar to when using -W with GNU readelf.
220
221.. option:: @<FILE>
222
223 Read command-line options from response file `<FILE>`.
224
225EXIT STATUS
226-----------
227
228:program:`llvm-readelf` returns 0 under normal operation. It returns a non-zero
229exit code if there were any errors.
230
231SEE ALSO
232--------
233
234:manpage:`llvm-nm(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readobj(1)`
235