xref: /llvm-project/llvm/docs/CommandGuide/llvm-readobj.rst (revision 89c95effe82c09b9a42408f4823409331f8fa266)
1llvm-readobj - LLVM Object Reader
2=================================
3
4.. program:: llvm-readobj
5
6SYNOPSIS
7--------
8
9:program:`llvm-readobj` [*options*] [*input...*]
10
11DESCRIPTION
12-----------
13
14The :program:`llvm-readobj` tool displays low-level format-specific information
15about one or more object files.
16
17If ``input`` is "``-``", :program:`llvm-readobj` reads from standard
18input. Otherwise, it will read from the specified ``filenames``.
19
20DIFFERENCES TO LLVM-READELF
21---------------------------
22
23:program:`llvm-readelf` is an alias for the :manpage:`llvm-readobj` tool with a
24slightly different command-line interface and output that is GNU compatible.
25Following is a list of differences between :program:`llvm-readelf` and
26:program:`llvm-readobj`:
27
28- :program:`llvm-readelf` uses `GNU` for the :option:`--elf-output-style` option
29  by default. :program:`llvm-readobj` uses `LLVM`.
30- :program:`llvm-readelf` allows single-letter grouped flags (e.g.
31  ``llvm-readelf -SW`` is the same as  ``llvm-readelf -S -W``).
32  :program:`llvm-readobj` does not allow grouping.
33- :program:`llvm-readelf` provides :option:`-s` as an alias for
34  :option:`--symbols`, for GNU :program:`readelf` compatibility, whereas it is
35  an alias for :option:`--section-headers` in :program:`llvm-readobj`.
36- :program:`llvm-readobj` provides ``-t`` as an alias for :option:`--symbols`.
37  :program:`llvm-readelf` does not.
38- :program:`llvm-readobj` provides ``--sr``, ``--sd``, ``--st`` and ``--dt`` as
39  aliases for :option:`--section-relocations`, :option:`--section-data`,
40  :option:`--section-symbols` and :option:`--dyn-symbols` respectively.
41  :program:`llvm-readelf` does not provide these aliases, to avoid conflicting
42  with grouped flags.
43
44GENERAL AND MULTI-FORMAT OPTIONS
45--------------------------------
46
47These options are applicable to more than one file format, or are unrelated to
48file formats.
49
50.. option:: --all
51
52 Equivalent to specifying all the main display options relevant to the file
53 format.
54
55.. option:: --addrsig
56
57 Display the address-significance table.
58
59.. option:: --decompress, -z
60
61  Dump decompressed section content when used with ``-x`` or ``-p``.
62  If the section(s) are not compressed, they are displayed as is.
63
64.. option:: --demangle, -C
65
66 Display demangled symbol names in the output. This option is only for ELF and
67 XCOFF file formats.
68
69.. option:: --expand-relocs
70
71 When used with :option:`--relocs`, display each relocation in an expanded
72 multi-line format.
73
74.. option:: --file-header, -h
75
76 Display file headers.
77
78.. option:: --headers, -e
79
80 Equivalent to setting: :option:`--file-header`, :option:`--program-headers`,
81 and :option:`--sections`.
82
83.. option:: --help
84
85 Display a summary of command line options.
86
87.. option:: --hex-dump=<section[,section,...]>, -x
88
89 Display the specified section(s) as hexadecimal bytes. ``section`` may be a
90 section index or section name.
91
92 .. option:: --memtag
93
94 Display information about memory tagging present in the binary. This includes
95 various memtag-specific dynamic entries, decoded global descriptor sections,
96 and decoded Android-specific ELF notes.
97
98.. option:: --needed-libs
99
100 Display the needed libraries.
101
102.. option:: --no-demangle
103
104 Do not demangle symbol names in the output. This option is only for ELF and
105 XCOFF file formats. The option is enabled by default.
106
107.. option:: --relocations, --relocs, -r
108
109 Display the relocation entries in the file.
110
111.. option:: --sections, --section-headers, -S
112
113 Display all sections.
114
115.. option:: --section-data, --sd
116
117 When used with :option:`--sections`, display section data for each section
118 shown. This option has no effect for GNU style output.
119
120.. option:: --section-relocations, --sr
121
122 When used with :option:`--sections`, display relocations for each section
123 shown. This option has no effect for GNU style output.
124
125.. option:: --section-symbols, --st
126
127 When used with :option:`--sections`, display symbols for each section shown.
128 This option has no effect for GNU style output.
129
130.. option:: --sort-symbols=<sort_key[,sort_key]>
131
132 Specify the keys to sort symbols before displaying symtab.
133 Valid values for sort_key are ``name`` and ``type``.
134.. option:: --stackmap
135
136 Display contents of the stackmap section.
137
138.. option:: --string-dump=<section[,section,...]>, -p
139
140 Display the specified section(s) as a list of strings. ``section`` may be a
141 section index or section name.
142
143.. option:: --string-table
144
145 Display contents of the string table.
146
147.. option:: --symbols, --syms, -s
148
149 Display the symbol table.
150
151.. option:: --unwind, -u
152
153 Display unwind information.
154
155.. option:: --version
156
157 Display the version of the :program:`llvm-readobj` executable.
158
159.. option:: @<FILE>
160
161 Read command-line options from response file `<FILE>`.
162
163ELF SPECIFIC OPTIONS
164--------------------
165
166The following options are implemented only for the ELF file format.
167
168.. option:: --arch-specific, -A
169
170 Display architecture-specific information, e.g. the ARM attributes section on ARM.
171
172.. option:: --bb-addr-map
173
174 Display the contents of the basic block address map section(s), which contain the
175 address of each function, along with the relative offset of each basic block.
176
177 When pgo analysis maps are present, all analyses are printed as their raw
178 value.
179
180.. option:: --pretty-pgo-analysis-map
181
182 When pgo analysis maps are present in the basic block address map section(s),
183 analyses with special formats (i.e. BlockFrequency, BranchProbability, etc)
184 are printed using the same format as their respective analysis pass.
185
186 Requires :option:`--bb-addr-map` to have an effect.
187
188.. option:: --dependent-libraries
189
190 Display the dependent libraries section.
191
192.. option:: --dyn-relocations
193
194 Display the dynamic relocation entries.
195
196.. option:: --dyn-symbols, --dyn-syms, --dt
197
198 Display the dynamic symbol table.
199
200.. option:: --dynamic-table, --dynamic, -d
201
202 Display the dynamic table.
203
204.. option:: --cg-profile
205
206 Display the callgraph profile section.
207
208.. option:: --histogram, -I
209
210 Display a bucket list histogram for dynamic symbol hash tables.
211
212.. option:: --elf-linker-options
213
214 Display the linker options section.
215
216.. option:: --elf-output-style=<value>
217
218 Format ELF information in the specified style. Valid options are ``LLVM``,
219 ``GNU``, and ``JSON``. ``LLVM`` output (the default) is an expanded and
220 structured format. ``GNU`` output mimics the equivalent GNU :program:`readelf`
221 output. ``JSON`` is JSON formatted output intended for machine consumption.
222
223.. option:: --section-groups, -g
224
225 Display section groups.
226
227.. option:: --gnu-hash-table
228
229 Display the GNU hash table for dynamic symbols.
230
231.. option:: --hash-symbols
232
233 Display the expanded hash table with dynamic symbol data.
234
235.. option:: --hash-table
236
237 Display the hash table for dynamic symbols.
238
239.. option:: --memtag
240
241 Display information about memory tagging present in the binary. This includes
242 various dynamic entries, decoded global descriptor sections, and decoded
243 Android-specific ELF notes.
244
245.. option:: --notes, -n
246
247 Display all notes.
248
249.. option:: --pretty-print
250
251 When used with :option:`--elf-output-style`, JSON output will be formatted in
252 a more readable format.
253
254.. option:: --program-headers, --segments, -l
255
256 Display the program headers.
257
258.. option:: --section-mapping
259
260 Display the section to segment mapping.
261
262.. option:: --stack-sizes
263
264 Display the contents of the stack sizes section(s), i.e. pairs of function
265 names and the size of their stack frames. Currently only implemented for GNU
266 style output.
267
268.. option:: --version-info, -V
269
270 Display version sections.
271
272MACH-O SPECIFIC OPTIONS
273-----------------------
274
275The following options are implemented only for the Mach-O file format.
276
277.. option:: --macho-data-in-code
278
279 Display the Data in Code command.
280
281.. option:: --macho-dsymtab
282
283 Display the Dsymtab command.
284
285.. option:: --macho-indirect-symbols
286
287 Display indirect symbols.
288
289.. option:: --macho-linker-options
290
291 Display the Mach-O-specific linker options.
292
293.. option:: --macho-segment
294
295 Display the Segment command.
296
297.. option:: --macho-version-min
298
299 Display the version min command.
300
301PE/COFF SPECIFIC OPTIONS
302------------------------
303
304The following options are implemented only for the PE/COFF file format.
305
306.. option:: --codeview
307
308 Display CodeView debug information.
309
310.. option:: --codeview-ghash
311
312 Enable global hashing for CodeView type stream de-duplication.
313
314.. option:: --codeview-merged-types
315
316 Display the merged CodeView type stream.
317
318.. option:: --codeview-subsection-bytes
319
320 Dump raw contents of CodeView debug sections and records.
321
322.. option:: --coff-basereloc
323
324 Display the .reloc section.
325
326.. option:: --coff-debug-directory
327
328 Display the debug directory.
329
330.. option:: --coff-tls-directory
331
332 Display the TLS directory.
333
334.. option:: --coff-directives
335
336 Display the .drectve section.
337
338.. option:: --coff-exports
339
340 Display the export table.
341
342.. option:: --coff-imports
343
344 Display the import table.
345
346.. option:: --coff-load-config
347
348 Display the load config.
349
350.. option:: --coff-resources
351
352 Display the .rsrc section.
353
354XCOFF SPECIFIC OPTIONS
355----------------------
356
357The following options are implemented only for the XCOFF file format.
358
359.. option:: --auxiliary-header
360
361  Display XCOFF Auxiliary header.
362
363.. option:: --exception-section
364
365  Display XCOFF exception section entries.
366
367.. option:: --loader-section-header
368
369  Display XCOFF loader section header.
370
371.. option:: --loader-section-symbols
372
373  Display symbol table of loader section.
374
375.. option:: --loader-section-relocations
376
377  Display relocation entries of loader section.
378
379EXIT STATUS
380-----------
381
382:program:`llvm-readobj` returns 0 under normal operation. It returns a non-zero
383exit code if there were any errors.
384
385SEE ALSO
386--------
387
388:manpage:`llvm-nm(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`
389