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