aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-05-20 08:54:53 -0700
committerGitHub <noreply@github.com>2025-05-20 08:54:53 -0700
commit95e4db8fa7d4adf1cd629e3fa7877ec95a1adfaa (patch)
tree106a87415f18d58ca885c246c36de91c8ec75d7c /llvm/tools/llvm-objdump/llvm-objdump.cpp
parentad80f736312c73c51501bf26ca9d2d0569b8a8c0 (diff)
downloadllvm-95e4db8fa7d4adf1cd629e3fa7877ec95a1adfaa.zip
llvm-95e4db8fa7d4adf1cd629e3fa7877ec95a1adfaa.tar.gz
llvm-95e4db8fa7d4adf1cd629e3fa7877ec95a1adfaa.tar.bz2
[llvm-objdump] --adjust-vma: Call getInstruction with adjusted address
llvm-objdump currently calls MCDisassembler::getInstruction with unadjusted address and MCInstPrinter::printInst with adjusted address. The decoded branch targets will be adjusted as expected for most targets (as the getInstruction address is insignificant) but not for SystemZ (where the getInstruction address is displayed). Specify an adjust address to fix SystemZInstPrinter output. The added test utilizes llvm/utils/update_test_body.py to make updates easier and additionally checks that we don't adjust SHN_ABS symbol addresses. Pull Request: https://github.com/llvm/llvm-project/pull/140471
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 7a778da..99bb41f 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2323,7 +2323,7 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj,
// provided
MCInst Inst;
ArrayRef<uint8_t> ThisBytes = Bytes.slice(Index);
- uint64_t ThisAddr = SectionAddr + Index;
+ uint64_t ThisAddr = SectionAddr + Index + VMAAdjustment;
bool Disassembled = DT->DisAsm->getInstruction(
Inst, Size, ThisBytes, ThisAddr, CommentStream);
if (Size == 0)