Fix a bug in the x86 disassembler's symbolic disassembly support for Jcc-Jump
authorKevin Enderby <enderby@apple.com>
Tue, 24 Jul 2012 21:40:01 +0000 (21:40 +0000)
committerKevin Enderby <enderby@apple.com>
Tue, 24 Jul 2012 21:40:01 +0000 (21:40 +0000)
if Condition Is Met instuctions that was not correctly determining the target
instruction.

So for a jne rel32 instruction:

% cat x.s
.byte 0x0f, 0x85, 0x09, 0x00, 0x00, 0x00
% as x.s

it was incorrectly deterining the target:

% otool -q -tv a.out
a.out:
(__TEXT,__text) section
0000000000000000 jne 0xd

and with the fix it gets this correct as:

% otool -q -tv a.out
a.out:
(__TEXT,__text) section
0000000000000000 jne 0xf

rdar://11505997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160694 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/Disassembler/X86Disassembler.cpp

index 4bbfe95eb43f7cd772fb6b1d8770bcc2bf18776d..e936b5210739a5bae6d20cd2e6e920ff99c6814f 100644 (file)
@@ -327,7 +327,7 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
   if (type == TYPE_RELv) {
     isBranch = true;
     pcrel = insn.startLocation +
-            insn.displacementOffset + insn.displacementSize;
+            insn.immediateOffset + insn.immediateSize;
     switch (insn.displacementSize) {
     default:
       break;