xref: /llvm-project/llvm/docs/CommandGuide/llvm-readobj.rst (revision 3034632a2708f3b79aa30f895dc42f35569c3647)
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:: --raw-relr
259
260 Do not decode relocations in RELR relocation sections when displaying them.
261
262.. option:: --section-mapping
263
264 Display the section to segment mapping.
265
266.. option:: --stack-sizes
267
268 Display the contents of the stack sizes section(s), i.e. pairs of function
269 names and the size of their stack frames. Currently only implemented for GNU
270 style output.
271
272.. option:: --version-info, -V
273
274 Display version sections.
275
276MACH-O SPECIFIC OPTIONS
277-----------------------
278
279The following options are implemented only for the Mach-O file format.
280
281.. option:: --macho-data-in-code
282
283 Display the Data in Code command.
284
285.. option:: --macho-dsymtab
286
287 Display the Dsymtab command.
288
289.. option:: --macho-indirect-symbols
290
291 Display indirect symbols.
292
293.. option:: --macho-linker-options
294
295 Display the Mach-O-specific linker options.
296
297.. option:: --macho-segment
298
299 Display the Segment command.
300
301.. option:: --macho-version-min
302
303 Display the version min command.
304
305PE/COFF SPECIFIC OPTIONS
306------------------------
307
308The following options are implemented only for the PE/COFF file format.
309
310.. option:: --codeview
311
312 Display CodeView debug information.
313
314.. option:: --codeview-ghash
315
316 Enable global hashing for CodeView type stream de-duplication.
317
318.. option:: --codeview-merged-types
319
320 Display the merged CodeView type stream.
321
322.. option:: --codeview-subsection-bytes
323
324 Dump raw contents of CodeView debug sections and records.
325
326.. option:: --coff-basereloc
327
328 Display the .reloc section.
329
330.. option:: --coff-debug-directory
331
332 Display the debug directory.
333
334.. option:: --coff-tls-directory
335
336 Display the TLS directory.
337
338.. option:: --coff-directives
339
340 Display the .drectve section.
341
342.. option:: --coff-exports
343
344 Display the export table.
345
346.. option:: --coff-imports
347
348 Display the import table.
349
350.. option:: --coff-load-config
351
352 Display the load config.
353
354.. option:: --coff-resources
355
356 Display the .rsrc section.
357
358XCOFF SPECIFIC OPTIONS
359----------------------
360
361The following options are implemented only for the XCOFF file format.
362
363.. option:: --auxiliary-header
364
365  Display XCOFF Auxiliary header.
366
367.. option:: --exception-section
368
369  Display XCOFF exception section entries.
370
371.. option:: --loader-section-header
372
373  Display XCOFF loader section header.
374
375.. option:: --loader-section-symbols
376
377  Display symbol table of loader section.
378
379.. option:: --loader-section-relocations
380
381  Display relocation entries of loader section.
382
383EXIT STATUS
384-----------
385
386:program:`llvm-readobj` returns 0 under normal operation. It returns a non-zero
387exit code if there were any errors.
388
389SEE ALSO
390--------
391
392:manpage:`llvm-nm(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`
393