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