summaryrefslogtreecommitdiff
path: root/llvm/docs/CommandGuide/llvm-objdump.rst
AgeCommit message (Collapse)Author
2025-07-21[llvm-objdump] Add inlined function display support (#142246)gulfemsavrun
This patch adds the support for displaying inlined functions into llvm-objdump. 1) It extends the source variable display support for inlined functions both for ascii and unicode formats. 2) It also introduces a new format called limits-only that only prints a line for the start and end of an inlined function without line-drawing characters.
2025-06-25[llvm-objdump] Support --symbolize-operand on AArch64Alexis Engelke
Similar to the existing implementations for X86 and PPC, support symbolizing branch targets for AArch64. Do not omit the address for ADRP as the target is typically not at an intended location. Pull Request: https://github.com/llvm/llvm-project/pull/145009
2025-05-23Extend llvm objdump fatbin (#140286)David Salinas
Utilize the new extensions to the LLVM Offloading API to extend to llvm-objdump to handle dumping fatbin offload bundles generated by HIP. This extension to llvm-objdump adds the option --offload-fatbin. Specifying this option will take the input object/executable and extract all offload fatbin bundle entries into distinct code object files with names reflecting the source file name combined with the Bundle Entry ID. Users can also use the --arch-name option to filter offload fatbin bundle entries by their target triple. --------- Co-authored-by: dsalinas <dsalinas@MKM-L1-DSALINAS.amd.com>
2025-05-16Revert "Reapply: [llvm-objdump] Add support for HIP offload bundles (#140128)"Kazu Hirata
This reverts commit 910220b84fa18ce2cbb2e21dd53b9f3d0ae582a7. Multiple buildbot failures have been reported: https://github.com/llvm/llvm-project/pull/140128
2025-05-16Reapply: [llvm-objdump] Add support for HIP offload bundles (#140128)David Salinas
Utilize the new extensions to the LLVM Offloading API to extend to llvm-objdump to handle dumping fatbin offload bundles generated by HIP. This extension to llvm-objdump adds the option --offload-fatbin. Specifying this option will take the input object/executable and extract all offload fatbin bundle entries into distinct code object files with names reflecting the source file name combined with the Bundle Entry ID. Users can also use the --arch-name option to filter offload fatbin bundle entries by their target triple. --------- Co-authored-by: dsalinas <dsalinas@MKM-L1-DSALINAS.amd.com>
2025-05-08Revert "[llvm-objdump] Add support for HIP offload bundles (#114834)"Kazu Hirata
This reverts commit 06d6623bc304d5fc2fe11b80b62b4c5d10f9eaa1. Buildbot failure: https://lab.llvm.org/buildbot/#/builders/145/builds/6871/steps/5/logs/stdio
2025-05-08[llvm-objdump] Add support for HIP offload bundles (#114834)David Salinas
Utilize the new extensions to the LLVM Offloading API to extend to llvm-objdump to handle dumping fatbin offload bundles generated by HIP. This extension to llvm-objdump adds the option --offload-fatbin. Specifying this option will take the input object/executable and extract all offload fatbin bundle entries into distinct code object files with names reflecting the source file name combined with the Bundle Entry ID. Users can also use the --arch-name option to filter offload fatbin bundle entries by their target triple. --------- Co-authored-by: dsalinas <dsalinas@MKM-L1-DSALINAS.amd.com>
2024-09-25Reapply "Deprecate the `-fbasic-block-sections=labels` option." (#110039)Rahman Lavaee
This reapplies commit 1911a50fae8a441b445eb835b98950710d28fc88 with a minor fix in lld/ELF/LTO.cpp which sets Options.BBAddrMap when `--lto-basic-block-sections=labels` is passed.
2024-09-25Revert "Deprecate the `-fbasic-block-sections=labels` option. (#107494)"Kazu Hirata
This reverts commit 1911a50fae8a441b445eb835b98950710d28fc88. Several bots are failing: https://lab.llvm.org/buildbot/#/builders/190/builds/6519 https://lab.llvm.org/buildbot/#/builders/3/builds/5248 https://lab.llvm.org/buildbot/#/builders/18/builds/4463
2024-09-25Deprecate the `-fbasic-block-sections=labels` option. (#107494)Rahman Lavaee
This feature is supported via the newer option `-fbasic-block-address-map`. Using the old option still works by delegating to the newer option, while a warning is printed to show deprecation.
2024-02-27[SHT_LLVM_BB_ADDR_MAP] Adds pretty printing of BFI and BPI for PGO Analysis ↵Micah Weston
Map in tools. (#82292) Primary change is to add a flag `--pretty-pgo-analysis-map` to llvm-readobj and llvm-objdump that prints block frequencies and branch probabilities in the same manner as BFI and BPI respectively. This can be helpful if you are manually inspecting the outputs from the tools. In order to print, I moved the `printBlockFreqImpl` function from Analysis to Support and renamed it to `printRelativeBlockFreq`.
2023-12-19[llvm-objdump] Add -mllvm (#75892)Fangrui Song
When llvm-objdump switched from cl:: to OptTable (https://reviews.llvm.org/D100433), we dropped support for LLVM cl:: options. Some LLVM_DEBUG in `llvm/lib/Target/$target/MCDisassembler/` files might be useful. Add -mllvm to allow dumping the information. ``` # -debug is available in an LLVM_ENABLE_ASSERTIONS=on build llvm-objdump -d -mllvm -debug a.o > /dev/null ``` Link: https://discourse.llvm.org/t/how-to-enable-debug-logs-in-llvm-objdump/75758
2023-09-01[llvm-objdump] Enable disassembly color highlightingJonas Devlieghere
Enable color highlighting of disassembly in llvm-objdump. This patch introduces a new flag --disassembler-color=<mode> that enables or disables highlighting disassembly with ANSI escape codes. The default mode is to enable color highlighting if outputting to a color-enabled terminal. Differential revision: https://reviews.llvm.org/D159224
2023-07-12[llvm-objdump] Default to --mcpu=future for PPC32Fangrui Song
Extend D127824 to the 32-bit Power architecture. AFAICT GNU objdump -d dumps all instructions for 32-bit as well. Reviewed By: #powerpc, nemanjai Differential Revision: https://reviews.llvm.org/D155114
2023-07-06[AIX][XCOFF] print out the traceback infozhijian
Summary: Adding a new option -traceback-table to print out the traceback info of xcoff ojbect file. Reviewers: James Henderson, Fangrui Song, Stephen Peckham, Xing Xue Differential Revision: https://reviews.llvm.org/D89049
2022-12-05[llvm-objdump][docs] Mention --show-all-symbolsFangrui Song
after D131589 Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D139282
2022-10-30[llvm-objdump] Set --print-imm-hex by default.Daniel Thornburgh
This was previously attempted in 2016 by colinl's D18770, but LLD tests were missed, which caused the change to be reverted. Setting --print-imm-hex by default brings llvm-objdump's behavior closer in line with objdump, and it makes it easier to read addresses and alignment from the disassembly. It may make non-address immediates harder to interpret, but it still seems the better default, barring more context-sensitive base selection logic. Differential Revision: https://reviews.llvm.org/D136972
2022-10-14[llvm-objdump/mac] Add new function starts print modeKeith Smiley
This updates the `--function-starts` argument to now accept 3 different modes, `addrs` for just printing the addresses of the function starts (previous behavior), `names` for just printing the names of the function starts, and `both` to print them both side by side. In general if you're debugging function starts issues it's useful to see the symbol name alongside the address. This also mirrors Apple's `dyldinfo -function_starts` command which prints both. Differential Revision: https://reviews.llvm.org/D119050
2022-10-04[llvm-objdump] Add --build-id flag for debuginfod lookups without binary.Daniel Thornburgh
Adding a --build-id flag allows handling binaries that are referenced in logs from remote systems, but that aren't necessarily present on the local machine. These are fetched via debuginfod and handled as if they were input filenames. Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D133992
2022-10-04[llvm-objdump] Add --no-addresses as an alias for --no-leading-addrFangrui Song
The output is similar to objdump --no-addresses since binutils 2.35. Depends on D135039 Close #58088 Differential Revision: https://reviews.llvm.org/D135040
2022-10-04[llvm-objdump] --no-leading-addr: hide inline relocation offsetsFangrui Song
It seems to make sense to omit offsets when --no-leading-addr is specified. The output is now closer to objdump -dr --no-addresses (non-wide output). Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D135039
2022-10-03[llvm-objdump] Find debug information with Build ID/debuginfod.Daniel Thornburgh
Uses the library introduced in https://reviews.llvm.org/D132504 to add build ID fetching to llvm-objdump. This allows viewing source when disassembling stripped objects. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D131224
2022-08-17[llvm-objdump --macho] Rename --dyld_info to --dyld-infoNico Weber
llvm-objdump takes foo-bar style flags, while llvm-otool takes foo_bar style flags. dyld_info was the only exception to that. Add a -dyld_info flag to llvm-otool instead. (Both in llvm-objdump and llvm-otool, the flag doesn't really do anything yet.) Differential Revision: https://reviews.llvm.org/D131897
2022-08-15[llvm-objdump] Start on -chained_fixups for llvm-otoolNico Weber
And --chained-fixups for llvm-objdump. For now, this only prints the dyld_chained_fixups_header and adds plumbing for the flag. This will be expanded in future commits. When Apple's effort to upstream their chained fixups code continues, we'll replace this code with the then-upstreamed code. But we need something in the meantime for testing ld64.lld's chained fixups code. Update chained-fixups.yaml with a file that actually contains the chained fixup data (`LinkEditData` doesn't encode it yet, so use `__LINKEDIT` via `--raw-segment=data`). Differential Revision: https://reviews.llvm.org/D131890
2022-07-11[llvm-objdump][docs] Fix documentation for offloading flagsJoseph Huber
2022-07-07[llvm-objdump][Docs] Document new flagJoseph Huber
2022-06-30[llvm-objdump] Default to --mcpu=future for PPC64Fangrui Song
GNU objdump disassembles all unknown instructions by default. Match this user friendly behavior with the cpu value `future`. Differential Revision: https://reviews.llvm.org/D127824
2022-06-30[llvm-objdump] Default to --mattr=+all for AArch64Fangrui Song
GNU objdump disassembles all unknown instructions by default. Match this user friendly behavior with the target feature "all" (D128029) designed for disassemblers. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D128030
2022-05-16[llvm-objdump] Let --symbolize-operands symbolize basic block addresses ↵Rahman Lavaee
based on the SHT_LLVM_BB_ADDR_MAP section. `--symbolize-operands` already symbolizes branch targets based on the disassembly. When the object file is created with `-fbasic-block-sections=labels` (ELF-only) it will include a SHT_LLVM_BB_ADDR_MAP section which maps basic blocks to their addresses. In such case `llvm-objdump` can annotate the disassembly based on labels inferred on this section. In contrast to the current labels, SHT_LLVM_BB_ADDR_MAP-based labels are created for every machine basic block including empty blocks and those which are not branched into (fallthrough blocks). The old logic is still executed even when the SHT_LLVM_BB_ADDR_MAP section is present to handle functions which have not been received an entry in this section. Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D124560
2022-02-22Add a (nonfunctional) -dyld_info flag to llvm-objdump.Adrian Prantl
Darwin otool implements this flag as a one-stop solution for displaying bind and rebase info. As I am working on upstreaming chained fixup support this command will be useful to write testcases. Differential Revision: https://reviews.llvm.org/D113573
2022-01-06Update Bug report URL to Github IssuesChuanqi Xu
Although we moved to Github Issues. The bug report message refers to Bugzilla still. This patch tries to update these URLs. Reviewed By: MaskRay, Quuxplusone, jhenderson, libunwind, libc++ Differential Revision: https://reviews.llvm.org/D116351
2021-12-21[PowerPC][llvm-objdump] enable --symbolize-operands for PowerPC ELF/XCOFF.Esme-Yi
Summary: When disassembling, symbolize a branch target operand to print a label instead of a real address. Reviewed By: shchenz Differential Revision: https://reviews.llvm.org/D114492
2021-11-15[NFC] Trim trailing whitespace in *.rstShao-Ce SUN
2021-10-07[llvm-objdump][docs] Add details to the help output and command guidegbreynoo
This change is to add some missing details, clarifies some options and brings the help text and command guide of objdump closer together. - Added to the help that --all-headers also outputs symbols and relocations to match the command guide. - Added to the help that --debug-vars accepts an optional ascii/unicode format to match the command guide. - Changed the help descriptions for --disassemble, --disassemble-all, --dwarf=<value>, --fault-map-section, --line-numbers, --no-leading-addr and --source descriptions to match the command guide. - Added to the help that --start-address and --stop-address also effect relocation entries and the symbol table output to match the command guide. - Added a note to the command guide that --unwind-info and -u are not available for the elf format. Differential Revision: https://reviews.llvm.org/D110633
2021-08-28[llvm] Fix typos in documentation (NFC)Kazu Hirata
2021-06-29[llvm-objdump] Add --no-print-imm-hex to the command guidegbreynoo
The option --no-print-imm-hex was not included in the command guide for llvm-objdump but appears in the help text. This commit adds it to the command guide. Differential Revision: https://reviews.llvm.org/D104717
2021-06-28[llvm-objdump] Prevent variable locations to overlap short commentsIgor Kudrin
For now, the source variable locations are printed at about the same space as the comments for disassembled code, which can make some ranges for variables disappear if a line contains comments, for example: ┠─ bar = W1 0: add x0, x2, #2, lsl #12 // =8192┃ 4: add z31.d, z31.d, #65280 // =0xff00 8: nop ┻ The patch shifts the report a bit to allow printing comments up to approximately 16 characters without interferences. Differential Revision: https://reviews.llvm.org/D104700
2021-05-26[docs] llvm-objdump: Mention -M no-aliases is supported on AArch64Fangrui Song
2021-05-05[llvm-objdump] Add -M {att,intel} & deprecate --x86-asm-syntax={att,intel}Fangrui Song
The internal `cl::opt` option --x86-asm-syntax sets the AsmParser and AsmWriter dialect. The option is used by llc and llvm-mc tests to set the AsmWriter dialect. This patch adds -M {att,intel} as GNU objdump compatible aliases (PR43413). Note: the dialect is initialized when the MCAsmInfo is constructed. `MCInstPrinter::applyTargetSpecificCLOption` is called too late and its MCAsmInfo reference is const, so changing the `cl::opt` in `MCInstPrinter::applyTargetSpecificCLOption` is not an option, at least without large amount of refactoring. Reviewed By: hoy, jhenderson, thakis Differential Revision: https://reviews.llvm.org/D101695
2021-05-04[llvm-objdump] Remove --cfg option from command guidegbreynoo
The llvm-objdump command guide has the option --cfg which was removed from the tool by 888320e9fa5eb33194c066f68d50f1e73c5fff5e in 2014. This change updates the command guide to reflect this. Differential Revision: https://reviews.llvm.org/D101648
2021-04-30[llvm-objdump] add -v alias for --versionNick Desaulniers
Used by the Linux kernel's CONFIG_X86_DECODER_SELFTEST. Link: https://github.com/ClangBuiltLinux/linux/issues/1130 Reviewed By: MaskRay, jhenderson, rupprecht Differential Revision: https://reviews.llvm.org/D101483
2021-04-22llvm-objdump: add --rpaths to macho supportKeith Smiley
This prints the rpaths for the given binary Reviewed By: kastiglione Differential Revision: https://reviews.llvm.org/D100681
2021-04-20[llvm-objdump] Add an llvm-otool toolNico Weber
This implements an LLVM tool that's flag- and output-compatible with macOS's `otool` -- except for bugs, but from testing with both `otool` and `xcrun otool-classic`, llvm-otool matches vanilla otool's behavior very well already. It's not 100% perfect, but it's a very solid start. This uses the same approach as llvm-objcopy: llvm-objdump uses a different OptTable when it's invoked as llvm-otool. This is possible thanks to D100433. Differential Revision: https://reviews.llvm.org/D100583
2021-03-24[llvm-objdump] Implement --prefix-strip optionVinicius Tinti
The option `--prefix-strip` is only used when `--prefix` is not empty. It removes N initial directories from absolute paths before adding the prefix. This matches GNU's objdump behavior. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D96679
2021-03-08[llvm-objdump][MachO] Add support for dumping function startsAlexander Shaposhnikov
Add support for dumping function starts for Mach-O binaries. Test plan: make check-all Differential revision: https://reviews.llvm.org/D97027
2020-11-30[llvm-objdump] Document --mattr=help in --help outputDavid Spickett
This does the same as `--mcpu=help` but was only documented in the user guide. * Added a test for both options. * Corrected the single dash in `-mcpu=help` text. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D92305
2020-10-16[llvm-objdump] Implement --prefix optionVinicius Tinti
The prefix given to --prefix will be added to GNU absolute paths when used with --source option (source interleaved with the disassembly). This matches GNU's objdump behavior. GNU and C++17 rules for absolute paths are different. Differential Revision: https://reviews.llvm.org/D85024 Fixes PR46368. Differential Revision: https://reviews.llvm.org/D85024
2020-08-17[llvm-objdump] Attempt to fix html doc generation issue.Hongtao Yu
https://reviews.llvm.org/D84191 caused a html doc build issue with the changes in `llvm-objdump.rst`. It looks like a blank line is missing from the `code-block` directives. Test Plan: Differential Revision: https://reviews.llvm.org/D86123
2020-08-17[llvm-objdump] Symbolize binary addresses for low-noisy asm diff.Hongtao Yu
When diffing disassembly dump of two binaries, I see lots of noises from mismatched jump target addresses and global data references, which unnecessarily causes diffs on every function, making it impractical. I'm trying to symbolize the raw binary addresses to minimize the diff noise. In this change, a local branch target is modeled as a label and the branch target operand will simply be printed as a label. Local labels are collected by a separate pre-decoding pass beforehand. A global data memory operand will be printed as a global symbol instead of the raw data address. Unfortunately, due to the way the disassembler is set up and to be less intrusive, a global symbol is always printed as the last operand of a memory access instruction. This is less than ideal but is probably acceptable from checking code quality point of view since on most targets an instruction can have at most one memory operand. So far only the X86 disassemblers are supported. Test Plan: llvm-objdump -d --x86-asm-syntax=intel --no-show-raw-insn --no-leading-addr : ``` Disassembly of section .text: <_start>: push rax mov dword ptr [rsp + 4], 0 mov dword ptr [rsp], 0 mov eax, dword ptr [rsp] cmp eax, dword ptr [rip + 4112] # 202182 <g> jge 0x20117e <_start+0x25> call 0x201158 <foo> inc dword ptr [rsp] jmp 0x201169 <_start+0x10> xor eax, eax pop rcx ret ``` llvm-objdump -d **--symbolize-operands** --x86-asm-syntax=intel --no-show-raw-insn --no-leading-addr : ``` Disassembly of section .text: <_start>: push rax mov dword ptr [rsp + 4], 0 mov dword ptr [rsp], 0 <L1>: mov eax, dword ptr [rsp] cmp eax, dword ptr <g> jge <L0> call <foo> inc dword ptr [rsp] jmp <L1> <L0>: xor eax, eax pop rcx ret ``` Note that the jump instructions like `jge 0x20117e <_start+0x25>` without this work is printed as a real target address and an offset from the leading symbol. With a change in the optimizer that adds/deletes an instruction, the address and offset may shift for targets placed after the instruction. This will be a problem when diffing the disassembly from two optimizers where there are unnecessary false positives due to such branch target address changes. With `--symbolize-operand`, a label is printed for a branch target instead to reduce the false positives. Similarly, the disassemble of PC-relative global variable references is also prone to instruction insertion/deletion. Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D84191
2020-07-09[llvm-objdump] Display locations of variables alongside disassemblyOliver Stannard
This adds the --debug-vars option to llvm-objdump, which prints locations (registers/memory) of source-level variables alongside the disassembly based on DWARF info. A vertical line is printed for each live-range, with a label at the top giving the variable name and location, and the position and length of the line indicating the program counter range in which it is valid. Differential revision: https://reviews.llvm.org/D70720