xref: /llvm-project/llvm/docs/CommandGuide/llvm-objdump.rst (revision bbce75e352be0637305a1b59ac5eca7175bceece)
1llvm-objdump - LLVM's object file dumper
2========================================
3
4.. program:: llvm-objdump
5
6SYNOPSIS
7--------
8
9:program:`llvm-objdump` [*commands*] [*options*] [*filenames...*]
10
11DESCRIPTION
12-----------
13The :program:`llvm-objdump` utility prints the contents of object files and
14final linked images named on the command line. If no file name is specified,
15:program:`llvm-objdump` will attempt to read from *a.out*. If *-* is used as a
16file name, :program:`llvm-objdump` will process a file on its standard input
17stream.
18
19COMMANDS
20--------
21At least one of the following commands are required, and some commands can be
22combined with other commands:
23
24.. option:: -a, --archive-headers
25
26  Display the information contained within an archive's headers.
27
28.. option:: -d, --disassemble
29
30  Disassemble all executable sections found in the input files.
31
32.. option:: -D, --disassemble-all
33
34  Disassemble all sections found in the input files.
35
36.. option:: --disassemble-symbols=<symbol1[,symbol2,...]>
37
38  Disassemble only the specified symbols. Takes demangled symbol names when
39  :option:`--demangle` is specified, otherwise takes mangled symbol names.
40  Implies :option:`--disassemble`.
41
42.. option:: --dwarf=<value>
43
44  Dump the specified DWARF debug sections. The supported values are:
45
46  `frames` - .debug_frame
47
48.. option:: -f, --file-headers
49
50  Display the contents of the overall file header.
51
52.. option:: --fault-map-section
53
54  Display the content of the fault map section.
55
56.. option:: -h, --headers, --section-headers
57
58  Display summaries of the headers for each section.
59
60.. option:: --help
61
62  Display usage information and exit. Does not stack with other commands.
63
64.. option:: -p, --private-headers
65
66  Display format-specific file headers.
67
68.. option:: -r, --reloc
69
70  Display the relocation entries in the file.
71
72.. option:: -R, --dynamic-reloc
73
74  Display the dynamic relocation entries in the file.
75
76.. option:: --raw-clang-ast
77
78  Dump the raw binary contents of the clang AST section.
79
80.. option:: -s, --full-contents
81
82  Display the contents of each section.
83
84.. option:: -t, --syms
85
86  Display the symbol table.
87
88.. option:: -T, --dynamic-syms
89
90  Display the contents of the dynamic symbol table.
91
92.. option:: -u, --unwind-info
93
94  Display the unwind info of the input(s).
95
96  This operation is only currently supported for COFF and Mach-O object files.
97
98.. option:: -v, --version
99
100  Display the version of the :program:`llvm-objdump` executable. Does not stack
101  with other commands.
102
103.. option:: -x, --all-headers
104
105  Display all available header information. Equivalent to specifying
106  :option:`--archive-headers`, :option:`--file-headers`,
107  :option:`--private-headers`, :option:`--reloc`, :option:`--section-headers`,
108  and :option:`--syms`.
109
110OPTIONS
111-------
112:program:`llvm-objdump` supports the following options:
113
114.. option:: --adjust-vma=<offset>
115
116  Increase the displayed address in disassembly or section header printing by
117  the specified offset.
118
119.. option:: --arch-name=<string>
120
121  Specify the target architecture when disassembling. Use :option:`--version`
122  for a list of available targets.
123
124.. option:: -C, --demangle
125
126  Demangle symbol names in the output.
127
128.. option:: --debug-vars=<format>
129
130  Print the locations (in registers or memory) of source-level variables
131  alongside disassembly. ``format`` may be ``unicode`` or ``ascii``, defaulting
132  to ``unicode`` if omitted.
133
134.. option:: --debug-vars-indent=<width>
135
136  Distance to indent the source-level variable display, relative to the start
137  of the disassembly. Defaults to 52 characters.
138
139.. option:: -j, --section=<section1[,section2,...]>
140
141  Perform commands on the specified sections only. For Mach-O use
142  `segment,section` to specify the section name.
143
144.. option:: -l, --line-numbers
145
146  When disassembling, display source line numbers. Implies
147  :option:`--disassemble`.
148
149.. option:: -M, --disassembler-options=<opt1[,opt2,...]>
150
151  Pass target-specific disassembler options. Available options:
152
153  * ``reg-names-std``: ARM only (default). Print in ARM 's instruction set documentation, with r13/r14/r15 replaced by sp/lr/pc.
154  * ``reg-names-raw``: ARM only. Use r followed by the register number.
155  * ``no-aliases``: AArch64 and RISC-V only. Print raw instruction mnemonic instead of pseudo instruction mnemonic.
156  * ``numeric``: RISC-V only. Print raw register names instead of ABI mnemonic. (e.g. print x1 instead of ra)
157  * ``att``: x86 only (default). Print in the AT&T syntax.
158  * ``intel``: x86 only. Print in the intel syntax.
159
160.. option:: --mcpu=<cpu-name>
161
162  Target a specific CPU type for disassembly. Specify ``--mcpu=help`` to display
163  available CPUs.
164
165.. option:: --mattr=<a1,+a2,-a3,...>
166
167  Enable/disable target-specific attributes. Specify ``--mattr=help`` to display
168  the available attributes.
169
170.. option:: --no-leading-addr
171
172  When disassembling, do not print leading addresses.
173
174.. option:: --no-print-imm-hex
175
176  Do not use hex format for immediate values in disassembly output (default).
177
178.. option:: --no-show-raw-insn
179
180  When disassembling, do not print the raw bytes of each instruction.
181
182.. option:: --prefix=<prefix>
183
184  When disassembling with the :option:`--source` option, prepend ``prefix`` to
185  absolute paths.
186
187.. option:: --prefix-strip=<level>
188
189  When disassembling with the :option:`--source` option, strip out ``level``
190  initial directories from absolute paths. This option has no effect without
191  :option:`--prefix`.
192
193.. option:: --print-imm-hex
194
195  Use hex format when printing immediate values in disassembly output.
196
197.. option:: -S, --source
198
199  When disassembling, display source interleaved with the disassembly. Implies
200  :option:`--disassemble`.
201
202.. option:: --show-lma
203
204  Display the LMA column when dumping ELF section headers. Defaults to off
205  unless any section has different VMA and LMAs.
206
207.. option:: --start-address=<address>
208
209  When disassembling, only disassemble from the specified address.
210
211  When printing relocations, only print the relocations patching offsets from at least ``address``.
212
213  When printing symbols, only print symbols with a value of at least ``address``.
214
215.. option:: --stop-address=<address>
216
217  When disassembling, only disassemble up to, but not including the specified address.
218
219  When printing relocations, only print the relocations patching offsets up to ``address``.
220
221  When printing symbols, only print symbols with a value up to ``address``.
222
223.. option:: --symbolize-operands
224
225  When disassembling, symbolize a branch target operand to print a label instead of a real address.
226
227  When printing a PC-relative global symbol reference, print it as an offset from the leading symbol.
228
229  Only works with PowerPC objects or X86 linked images.
230
231  Example:
232    A non-symbolized branch instruction with a local target and pc-relative memory access like
233
234  .. code-block:: none
235
236      cmp eax, dword ptr [rip + 4112]
237      jge 0x20117e <_start+0x25>
238
239  might become
240
241  .. code-block:: none
242
243     <L0>:
244       cmp eax, dword ptr <g>
245       jge	<L0>
246
247.. option:: --triple=<string>
248
249  Target triple to disassemble for, see ``--version`` for available targets.
250
251.. option:: -w, --wide
252
253  Ignored for compatibility with GNU objdump.
254
255.. option:: --x86-asm-syntax=<style>
256
257  Deprecated.
258  When used with :option:`--disassemble`, choose style of code to emit from
259  X86 backend. Supported values are:
260
261   .. option:: att
262
263    AT&T-style assembly
264
265   .. option:: intel
266
267    Intel-style assembly
268
269
270  The default disassembly style is **att**.
271
272.. option:: -z, --disassemble-zeroes
273
274  Do not skip blocks of zeroes when disassembling.
275
276.. option:: @<FILE>
277
278  Read command-line options and commands from response file `<FILE>`.
279
280MACH-O ONLY OPTIONS AND COMMANDS
281--------------------------------
282
283.. option:: --arch=<architecture>
284
285  Specify the architecture to disassemble. see ``--version`` for available
286  architectures.
287
288.. option:: --archive-member-offsets
289
290  Print the offset to each archive member for Mach-O archives (requires
291  :option:`--archive-headers`).
292
293.. option:: --bind
294
295  Display binding info
296
297.. option:: --data-in-code
298
299  Display the data in code table.
300
301.. option:: --dis-symname=<name>
302
303  Disassemble just the specified symbol's instructions.
304
305.. option:: --dylibs-used
306
307  Display the shared libraries used for linked files.
308
309.. option:: --dsym=<string>
310
311  Use .dSYM file for debug info.
312
313.. option:: --dylib-id
314
315  Display the shared library's ID for dylib files.
316
317.. option:: --exports-trie
318
319  Display exported symbols.
320
321.. option:: --function-starts
322
323  Print the function starts table for Mach-O objects.
324
325.. option:: -g
326
327  Print line information from debug info if available.
328
329.. option:: --full-leading-addr
330
331  Print the full leading address when disassembling.
332
333.. option:: --indirect-symbols
334
335  Display the indirect symbol table.
336
337.. option:: --info-plist
338
339  Display the info plist section as strings.
340
341.. option:: --lazy-bind
342
343  Display lazy binding info.
344
345.. option:: --link-opt-hints
346
347  Display the linker optimization hints.
348
349.. option:: -m, --macho
350
351  Use Mach-O specific object file parser. Commands and other options may behave
352  differently when used with ``--macho``.
353
354.. option:: --no-leading-headers
355
356  Do not print any leading headers.
357
358.. option:: --no-symbolic-operands
359
360  Do not print symbolic operands when disassembling.
361
362.. option:: --non-verbose
363
364  Display the information for Mach-O objects in non-verbose or numeric form.
365
366.. option:: --objc-meta-data
367
368  Display the Objective-C runtime meta data.
369
370.. option:: --private-header
371
372  Display only the first format specific file header.
373
374.. option:: --rebase
375
376  Display rebasing information.
377
378.. option:: --rpaths
379
380  Display runtime search paths for the binary.
381
382.. option:: --universal-headers
383
384  Display universal headers.
385
386.. option:: --weak-bind
387
388  Display weak binding information.
389
390XCOFF ONLY OPTIONS AND COMMANDS
391---------------------------------
392
393.. option:: --symbol-description
394
395  Add symbol description to disassembly output.
396
397BUGS
398----
399
400To report bugs, please visit <https://github.com/llvm/llvm-project/labels/tools:llvm-objdump/>.
401
402SEE ALSO
403--------
404
405:manpage:`llvm-nm(1)`, :manpage:`llvm-otool(1)`, :manpage:`llvm-readelf(1)`,
406:manpage:`llvm-readobj(1)`
407