[LLVMbugs] [Bug 23986] New: RIP-relative memory references

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 29 12:08:35 PDT 2015


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: unassignedbugs at nondot.org
          Reporter: david.l.kreitzer at intel.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150629/a64cd659/attachment.html>


More information about the llvm-bugs mailing list