[llvm] [llvm-objdump] --adjust-vma: Call getInstruction with adjusted address (PR #140471)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 09:49:35 PDT 2025
MaskRay wrote:
> Hi @MaskRay , I'm also confused why SystemZ is supposedly doing anything special here. The only use of the `Address` argument to `getInstruction` in the SystemZ implementation is to pass it on to `MCDecoder::tryAddingSymbolicOperand`, which looks to be exactly the same that most other targets do as well.
Branch target addresses are dependent on the current instruction address. It seems that we have two mechanisms.
At this point perhaps most targets use InstPrinter, e.g. ` AArch64InstPrinter::printAlignedLabel(const MCInst *MI, uint64_t Address, ...`
I have added the TableGen support and migrates some targets around https://reviews.llvm.org/D77853
Actually an older interface for Disassembler had existed before my changes, used by SystemZ.
It seems that most targets have ignored `uint64_t Address` in their Disassembler.cpp files,
`llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp`
I think handling the branch target display in InstPrinter makes more sense, as a decoded instruction
ideally should not change its internal representation due to the `getInstruction`-time address.
Perhaps the Disassembler `uint64_t Address` argument can be removed from most functions.
---
> Also, there seem to be several other calls to `getInstruction` in llvm-objdump.cpp - don't they also need to pass the adjusted address`
Handling --adjust-vma= with another option is like a whac-a-mole game.... I think we will just make change when we see a new issue. One call is for --symbolize-operands, where the address doesn't seem to matter. Another call is used by AMDGPU, which I do not yet to touch in this PR.
In the future we should probably just adjust the variable `SectionAddr`.
https://github.com/llvm/llvm-project/pull/140471
More information about the llvm-commits
mailing list