https://llvm.org/bugs/show_bug.cgi?id=23986

            Bug ID: 23986
           Summary: RIP-relative memory references
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

llvm-mc is encoding some RIP-relative instructions incorrectly by failing to
relax arith imm8 instruction forms.  For example:

------------- t.s -----------------
bar:
        .section imul
        imul $foo, bar(%rip),  %bx
        imul $foo, bar(%rip),  %ebx
        imul $foo, bar(%rip),  %rbx
-----------------------------------

This is the current behavior.  Note that in each case, $foo is encoded as an
8-bit immediate even though it is not guaranteed to fit in 8 bits.

bash-4.3$ llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu t.s -o t.o
bash-4.3$ objdump -d --section=imul t.o

t.o:     file format elf64-x86-64


Disassembly of section imul:

0000000000000000 <imul>:
   0:   66 6b 1d 00 00 00 00    imul   $0x0,0x0(%rip),%bx        # 8 <imul+0x8>
   7:   00 
   8:   6b 1d 00 00 00 00 00    imul   $0x0,0x0(%rip),%ebx        # f
<imul+0xf>
   f:   48 6b 1d 00 00 00 00    imul   $0x0,0x0(%rip),%rbx        # 17
<bar+0x17>
  16:   00

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to