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