llvm-objdump - LLVM’s object file dumper¶
:::{program} llvm-objdump :::
SYNOPSIS¶
llvm-objdump [commands] [options] [filenames…]
DESCRIPTION¶
The llvm-objdump utility prints the contents of object files and final linked images named on the command line. If no file name is specified, llvm-objdump will attempt to read from a.out. If - is used as a file name, llvm-objdump will process a file on its standard input stream.
COMMANDS¶
At least one of the following commands are required, and some commands can be combined with other commands:
:::{option} -a, –archive-headers Display the information contained within an archive’s headers. :::
:::{option} -d, –disassemble
Disassemble all executable sections found in the input files. On some
architectures (AArch64, PowerPC, x86), all known instructions are disassembled by
default. On the others, --mcpu or --mattr is needed to
enable some instruction sets. Disabled instructions are displayed as
<unknown>.
:::
:::{option} -D, –disassemble-all Disassemble all sections found in the input files. :::
:::{option} –disassemble-symbols=<symbol1[,symbol2,…]>
Disassemble only the specified symbols. Takes demangled symbol names when
--demangle is specified, otherwise takes mangled symbol names.
Implies --disassemble.
Each argument is split on commas. To select a symbol whose name contains commas,
use --disassemble with a symbol argument instead.
:::
:::{option} –disassemble=--demangle is specified, otherwise takes a mangled symbol name.
Implies --disassemble.
The argument is a single symbol name. To select multiple symbols, specify this
option multiple times or use --disassemble-symbols.
:::
:::{option} –dwarf=
frames - .debug_frame
:::
:::{option} -f, –file-headers Display the contents of the overall file header. :::
:::{option} –fault-map-section Display the content of the fault map section. :::
:::{option} -h, –headers, –section-headers Display summaries of the headers for each section. :::
:::{option} –help Display usage information and exit. Does not stack with other commands. :::
:::{option} -p, –private-headers Display format-specific file headers. :::
:::{option} -r, –reloc Display the relocation entries in the file. :::
:::{option} -R, –dynamic-reloc Display the dynamic relocation entries in the file. :::
:::{option} –raw-clang-ast Dump the raw binary contents of the clang AST section. :::
:::{option} -s, –full-contents Display the contents of each section. :::
:::{option} -t, –syms Display the symbol table. :::
:::{option} -T, –dynamic-syms Display the contents of the dynamic symbol table. :::
:::{option} -u, –unwind-info Display the unwind info of the input(s).
This operation is only currently supported for COFF and Mach-O object files. :::
:::{option} -v, –version Display the version of the llvm-objdump executable. Does not stack with other commands. :::
:::{option} -x, –all-headers
Display all available header information. Equivalent to specifying
--archive-headers, --file-headers,
--private-headers, --reloc, --section-headers,
and --syms.
:::
OPTIONS¶
llvm-objdump supports the following options:
:::{option} –adjust-vma=
:::{option} –arch-name=--version
for a list of available targets.
:::
:::{option} –build-id=
:::{option} -C, –demangle Demangle symbol names in the output. :::
:::{option} –debug-file-directory .build-id subdirectory to search for
debug information for stripped binaries. Multiple instances of this argument
are searched in the order given.
:::
:::{option} –debug-indent=
:::{option} –debug-inlined-funcs[=format may be ascii, limits-only, or unicode, defaulting to
unicode if omitted.
:::
:::{option} –debug-vars[=format may be ascii or unicode, defaulting
to unicode if omitted.
:::
:::{option} –debuginfod, –no-debuginfod
Whether or not to try debuginfod lookups for debug binaries. Unless specified,
debuginfod is only enabled if libcurl was compiled in (LLVM_ENABLE_CURL)
and at least one server URL was provided by the environment variable
DEBUGINFOD_URLS.
:::
:::{option} -j, –section=<section1[,section2,…]>
Perform commands on the specified sections only. For Mach-O use
segment,section to specify the section name.
:::
:::{option} -l, –line-numbers
When disassembling, display source line numbers. Implies
--disassemble.
:::
:::{option} -M, –disassembler-options=<opt1[,opt2,…]> Pass target-specific disassembler options. Available options:
reg-names-std: ARM only (default). Print in ARM ‘s instruction set documentation, with r13/r14/r15 replaced by sp/lr/pc.reg-names-raw: ARM only. Use r followed by the register number.no-aliases: AArch64 and RISC-V only. Print raw instruction mnemonic instead of pseudo instruction mnemonic.numeric: RISC-V only. Print raw register names instead of ABI mnemonic. (e.g. print x1 instead of ra)att: x86 only (default). Print in the AT&T syntax.intel: x86 only. Print in the intel syntax. :::
:::{option} –disassembler-color=
off: Disable disassembler color output.on: Enable disassembler color output.terminal: Enable disassembler color output if the terminal supports it (default). :::
:::{option} –mcpu=--mcpu=help to display
available CPUs.
:::
:::{option} –mattr=<a1,+a2,-a3,…>
Enable/disable target-specific attributes. Specify --mattr=help to display
the available attributes.
:::
:::{option} -mllvm
:::{option} –no-leading-addr, –no-addresses When disassembling, do not print leading addresses for instructions or inline relocations. :::
:::{option} –no-print-imm-hex Do not use hex format for immediate values in disassembly output. :::
:::{option} –no-show-raw-insn When disassembling, do not print the raw bytes of each instruction. :::
:::{option} –offloading Display the content of the LLVM offloading sections and HIP offload bundles. :::
:::{option} –prefix=--source option, prepend prefix to
absolute paths.
:::
:::{option} –prefix-strip=--source option, strip out level
initial directories from absolute paths. This option has no effect without
--prefix.
:::
:::{option} –source-dir
--source option, add dir to the
front of the source search path when looking up source files. For each source
file, llvm-objdump tries the path from the debug info, then each search
directory with the full path appended, then each search directory with only
the file name.
This option may be specified multiple times; each --source-dir adds one
directory. Options on the command line are searched in first to last order.
:::
:::{option} –substitute-path --source option, replace from with
to at the start of the directory part of source file paths when looking up
sources. A rule is applied only if from ends at a directory separator in
the path. This option may be specified multiple times; rules are evaluated in
the order given and the first matching rule is used, as in GDB
set substitute-path.
:::
:::{option} –print-imm-hex Use hex format when printing immediate values in disassembly output (default). :::
:::{option} -S, –source
When disassembling, display source interleaved with the disassembly. Implies
--disassemble.
:::
:::{option} –show-all-symbols Show all symbols during disassembly, even if multiple symbols are defined at the same location. :::
:::{option} –show-lma Display the LMA column when dumping ELF section headers. Defaults to off unless any section has different VMA and LMAs. :::
:::{option} –start-address=
When disassembling, only disassemble from the specified address.When printing relocations, only print the relocations patching offsets from at least address.
When printing symbols, only print symbols with a value of at least address.
:::
:::{option} –stop-address=
When disassembling, only disassemble up to, but not including the specified address.When printing relocations, only print the relocations patching offsets up to address.
When printing symbols, only print symbols with a value up to address.
:::
:::{option} –symbolize-operands, –no-symbolize-operands When disassembling, symbolize a branch target operand to print a label instead of a real address.
When printing a PC-relative global symbol reference, print it as an offset from the leading symbol.
When a bb-address-map section is present (i.e., the object file is built with
-fbasic-block-address-map), labels are retrieved from that section
instead. If a pgo-analysis-map is present alongside the bb-address-map, any
available analyses are printed after the relevant block label. By default,
any analysis with a special representation (i.e. BlockFrequency,
BranchProbability, etc) are printed as raw hex values.
Only supported for AArch64, BPF, PowerPC, RISC-V, and X86. Enabled by default
for BPF; use --no-symbolize-operands to disable.
Example:
: A non-symbolized branch instruction with a local target and pc-relative memory access like
cmp eax, dword ptr [rip + 4112]
jge 0x20117e <_start+0x25>
might become
<L0>:
cmp eax, dword ptr <g>
jge <L0>
:::
:::{option} –pretty-pgo-analysis-map
When using --symbolize-operands with bb-address-map and
pgo-analysis-map, print analyses using the same format as their analysis
passes would. An example of pretty format would be printing block frequencies
relative to the entry block, the same as BFI.
Only works when --symbolize-operands is enabled.
:::
:::{option} –triple=--version for available targets.
:::
:::{option} -w, –wide Ignored for compatibility with GNU objdump. :::
::::{option} –x86-asm-syntax=
