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