aboutsummaryrefslogtreecommitdiff
path: root/llvm/docs/CommandGuide/llvm-readobj.rst
blob: cb9232ef5e560a494fc2e91782d5dcab15d92c3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
llvm-readobj - LLVM Object Reader
=================================

.. program:: llvm-readobj

SYNOPSIS
--------

:program:`llvm-readobj` [*options*] [*input...*]

DESCRIPTION
-----------

The :program:`llvm-readobj` tool displays low-level format-specific information
about one or more object files.

If ``input`` is "``-``", :program:`llvm-readobj` reads from standard
input. Otherwise, it will read from the specified ``filenames``.

DIFFERENCES TO LLVM-READELF
---------------------------

:program:`llvm-readelf` is an alias for the :manpage:`llvm-readobj` tool with a
slightly different command-line interface and output that is GNU compatible.
Following is a list of differences between :program:`llvm-readelf` and
:program:`llvm-readobj`:

- :program:`llvm-readelf` uses `GNU` for the :option:`--elf-output-style` option
  by default. :program:`llvm-readobj` uses `LLVM`.
- :program:`llvm-readelf` allows single-letter grouped flags (e.g.
  ``llvm-readelf -SW`` is the same as  ``llvm-readelf -S -W``).
  :program:`llvm-readobj` does not allow grouping.
- :program:`llvm-readelf` provides :option:`-s` as an alias for
  :option:`--symbols`, for GNU :program:`readelf` compatibility, whereas it is
  an alias for :option:`--section-headers` in :program:`llvm-readobj`.
- :program:`llvm-readobj` provides ``-t`` as an alias for :option:`--symbols`.
  :program:`llvm-readelf` does not.
- :program:`llvm-readobj` provides ``--sr``, ``--sd``, ``--st`` and ``--dt`` as
  aliases for :option:`--section-relocations`, :option:`--section-data`,
  :option:`--section-symbols` and :option:`--dyn-symbols` respectively.
  :program:`llvm-readelf` does not provide these aliases, to avoid conflicting
  with grouped flags.

GENERAL AND MULTI-FORMAT OPTIONS
--------------------------------

These options are applicable to more than one file format, or are unrelated to
file formats.

.. option:: --all

 Equivalent to specifying all the main display options relevant to the file
 format.

.. option:: --addrsig

 Display the address-significance table.

.. option:: --expand-relocs

 When used with :option:`--relocs`, display each relocation in an expanded
 multi-line format.

.. option:: --file-header, -h

 Display file headers.

.. option:: --headers, -e

 Equivalent to setting: :option:`--file-header`, :option:`--program-headers`,
 and :option:`--sections`.

.. option:: --help

 Display a summary of command line options.

.. option:: --hex-dump=<section[,section,...]>, -x

 Display the specified section(s) as hexadecimal bytes. ``section`` may be a
 section index or section name.

 .. option:: --memtag

 Display information about memory tagging present in the binary. This includes
 various memtag-specific dynamic entries, decoded global descriptor sections,
 and decoded Android-specific ELF notes.

.. option:: --needed-libs

 Display the needed libraries.

.. option:: --relocations, --relocs, -r

 Display the relocation entries in the file.

.. option:: --sections, --section-headers, -S

 Display all sections.

.. option:: --section-data, --sd

 When used with :option:`--sections`, display section data for each section
 shown. This option has no effect for GNU style output.

.. option:: --section-relocations, --sr

 When used with :option:`--sections`, display relocations for each section
 shown. This option has no effect for GNU style output.

.. option:: --section-symbols, --st

 When used with :option:`--sections`, display symbols for each section shown.
 This option has no effect for GNU style output.

.. option:: --sort-symbols=<sort_key[,sort_key]>

 Specify the keys to sort symbols before displaying symtab.
 Valid values for sort_key are ``name`` and ``type``.
.. option:: --stackmap

 Display contents of the stackmap section.

.. option:: --string-dump=<section[,section,...]>, -p

 Display the specified section(s) as a list of strings. ``section`` may be a
 section index or section name.

.. option:: --string-table

 Display contents of the string table.

.. option:: --symbols, --syms, -s

 Display the symbol table.

.. option:: --unwind, -u

 Display unwind information.

.. option:: --version

 Display the version of the :program:`llvm-readobj` executable.

.. option:: @<FILE>

 Read command-line options from response file `<FILE>`.

ELF SPECIFIC OPTIONS
--------------------

The following options are implemented only for the ELF file format.

.. option:: --arch-specific, -A

 Display architecture-specific information, e.g. the ARM attributes section on ARM.

.. option:: --bb-addr-map

 Display the contents of the basic block address map section(s), which contain the
 address of each function, along with the relative offset of each basic block.

.. option:: --demangle, -C

 Display demangled symbol names in the output.

.. option:: --dependent-libraries

 Display the dependent libraries section.

.. option:: --dyn-relocations

 Display the dynamic relocation entries.

.. option:: --dyn-symbols, --dyn-syms, --dt

 Display the dynamic symbol table.

.. option:: --dynamic-table, --dynamic, -d

 Display the dynamic table.

.. option:: --cg-profile

 Display the callgraph profile section.

.. option:: --histogram, -I

 Display a bucket list histogram for dynamic symbol hash tables.

.. option:: --elf-linker-options

 Display the linker options section.

.. option:: --elf-output-style=<value>

 Format ELF information in the specified style. Valid options are ``LLVM``,
 ``GNU``, and ``JSON``. ``LLVM`` output (the default) is an expanded and
 structured format. ``GNU`` output mimics the equivalent GNU :program:`readelf`
 output. ``JSON`` is JSON formatted output intended for machine consumption.

.. option:: --section-groups, -g

 Display section groups.

.. option:: --gnu-hash-table

 Display the GNU hash table for dynamic symbols.

.. option:: --hash-symbols

 Display the expanded hash table with dynamic symbol data.

.. option:: --hash-table

 Display the hash table for dynamic symbols.

.. option:: --memtag

 Display information about memory tagging present in the binary. This includes
 various dynamic entries, decoded global descriptor sections, and decoded
 Android-specific ELF notes.

.. option:: --notes, -n

 Display all notes.

.. option:: --pretty-print

 When used with :option:`--elf-output-style`, JSON output will be formatted in
 a more readable format.

.. option:: --program-headers, --segments, -l

 Display the program headers.

.. option:: --raw-relr

 Do not decode relocations in RELR relocation sections when displaying them.

.. option:: --section-mapping

 Display the section to segment mapping.

.. option:: --stack-sizes

 Display the contents of the stack sizes section(s), i.e. pairs of function
 names and the size of their stack frames. Currently only implemented for GNU
 style output.

.. option:: --version-info, -V

 Display version sections.

MACH-O SPECIFIC OPTIONS
-----------------------

The following options are implemented only for the Mach-O file format.

.. option:: --macho-data-in-code

 Display the Data in Code command.

.. option:: --macho-dsymtab

 Display the Dsymtab command.

.. option:: --macho-indirect-symbols

 Display indirect symbols.

.. option:: --macho-linker-options

 Display the Mach-O-specific linker options.

.. option:: --macho-segment

 Display the Segment command.

.. option:: --macho-version-min

 Display the version min command.

PE/COFF SPECIFIC OPTIONS
------------------------

The following options are implemented only for the PE/COFF file format.

.. option:: --codeview

 Display CodeView debug information.

.. option:: --codeview-ghash

 Enable global hashing for CodeView type stream de-duplication.

.. option:: --codeview-merged-types

 Display the merged CodeView type stream.

.. option:: --codeview-subsection-bytes

 Dump raw contents of CodeView debug sections and records.

.. option:: --coff-basereloc

 Display the .reloc section.

.. option:: --coff-debug-directory

 Display the debug directory.

.. option:: --coff-tls-directory

 Display the TLS directory.

.. option:: --coff-directives

 Display the .drectve section.

.. option:: --coff-exports

 Display the export table.

.. option:: --coff-imports

 Display the import table.

.. option:: --coff-load-config

 Display the load config.

.. option:: --coff-resources

 Display the .rsrc section.

XCOFF SPECIFIC OPTIONS
----------------------

The following options are implemented only for the XCOFF file format.

.. option:: --auxiliary-header

  Display XCOFF Auxiliary header.

.. option:: --exception-section

  Display XCOFF exception section entries.

.. option:: --loader-section-header

  Display XCOFF loader section header.

.. option:: --loader-section-symbols

  Display symbol table of loader section.

.. option:: --loader-section-relocations

  Display relocation entries of loader section.

EXIT STATUS
-----------

:program:`llvm-readobj` returns 0 under normal operation. It returns a non-zero
exit code if there were any errors.

SEE ALSO
--------

:manpage:`llvm-nm(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`