Index: lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp =================================================================== --- lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp +++ lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp @@ -980,6 +980,15 @@ insn->opcode == 0xE3) attrMask ^= ATTR_ADSIZE; + /* + * CALL 64-bit mode hack to ignore opcode size prefix when disassembling + * and consume all 4 bytes of the immediate instead; + * NOTE: intel spec states CALL rel16 is N.S. in 64-bit mode + */ + if (insn->mode == MODE_64BIT && insn->opcodeType == ONEBYTE && + insn->opcode == 0xE8 && isPrefixAtLocation(insn, 0x66, insn->necessaryPrefixLocation)) + attrMask ^= ATTR_OPSIZE; + if (getIDWithAttrMask(&instructionID, insn, attrMask)) return -1; Index: test/MC/Disassembler/X86/x86-64.txt =================================================================== --- test/MC/Disassembler/X86/x86-64.txt +++ test/MC/Disassembler/X86/x86-64.txt @@ -301,3 +301,9 @@ # CHECK: movq %rax, 1515870810 0x67, 0x48 0xa3 0x5a 0x5a 0x5a 0x5a + +# CHECK: callq -32769 +0x66 0xe8 0xff 0x7f 0xff 0xff + +# CHECK: callq -32769 +0x66 0x66 0x48 0xe8 0xff 0x7f 0xff 0xff