aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index e9cd34e..4514f3c 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -735,9 +735,15 @@ public:
unsigned Column = OS.tell() - Start;
OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
- if (MI)
- IP.printInst(MI, Address.Address, "", STI, OS);
- else
+ if (MI) {
+ // See MCInstPrinter::printInst. On targets where a PC relative immediate
+ // is relative to the next instruction and the length of a MCInst is
+ // difficult to measure (x86), this is the address of the next
+ // instruction.
+ uint64_t Addr =
+ Address.Address + (STI.getTargetTriple().isX86() ? Bytes.size() : 0);
+ IP.printInst(MI, Addr, "", STI, OS);
+ } else
OS << "\t<unknown>";
}
};