[PATCH] [X86] Fix PR23271 - RIP-relative decoding bug in disassembler.

Matthew Barney m4b.github.io at gmail.com
Wed May 13 16:27:12 PDT 2015


Besides inline comments, this looks good to me, as typical uses of RIP relative addressing seem to disassemble correctly now.


REPOSITORY
  rL LLVM

================
Comment at: test/MC/Disassembler/X86/x86-64.txt:314
@@ +313,3 @@
+# Try all combinations of EVEX.x and REX.b:
+# CHECK: vaddps	287453952(%rip), %zmm20, %zmm15
+0x62 0x11 0x5c 0x40 0x58 0x3d 0x00 0x33 0x22 0x11
----------------
I'm getting a #UD on this instruction.

Well, technically on: `62 11 5c 40 58 3d ff 7f ff ff`, or `vaddps -32769(%rip), %zmm20, %zmm15`

I've attached both LLDB and GDB's output (LLDB doesn't use this patch yet, so it doesn't disassemble past the instruction).

Also GDB disassembles it differently from this patch, as it says the RIP relative immediate is -8001, but by my count it should be -32769 (which llvm-mc disassembles it to using this patch).

**Note**: I monkey-patched a C binary with the instruction, so it's not a proper compiled object, but it should at least execute/segfault; but I get an illegal instruction error on that exact instruction, so I think it's not the patching that's the problem.

Unfortunately I can't seem to find the source or a binary download for the xed program on Intel's website or anywhere, otherwise I'd try to get a "second opinion".  Hopefully something else is going on, otherwise we might actually all have disassembler bugs to repair :)

{F511211}

http://reviews.llvm.org/D9110

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list