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