[llvm-commits] [llvm] r122005 - in /llvm/trunk: lib/Target/X86/X86MCCodeEmitter.cpp test/MC/ELF/relocation.s

Rafael Espindola rafael.espindola at gmail.com
Thu Dec 16 14:50:01 PST 2010


Author: rafael
Date: Thu Dec 16 16:50:01 2010
New Revision: 122005

URL: http://llvm.org/viewvc/llvm-project?rev=122005&view=rev
Log:
Make pushq produce signed relocations.

Modified:
    llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
    llvm/trunk/test/MC/ELF/relocation.s

Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=122005&r1=122004&r2=122005&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu Dec 16 16:50:01 2010
@@ -996,7 +996,10 @@
                     Fixups);
     } else {
       unsigned FixupKind;
-      if (MI.getOpcode() == X86::MOV64ri32 || MI.getOpcode() == X86::MOV64mi32)
+      // FIXME: Is there a better way to know that we need a signed relocation?
+      if (MI.getOpcode() == X86::MOV64ri32 ||
+          MI.getOpcode() == X86::MOV64mi32 ||
+          MI.getOpcode() == X86::PUSH64i32)
         FixupKind = X86::reloc_signed_4byte;
       else
         FixupKind = getImmFixupKind(TSFlags);

Modified: llvm/trunk/test/MC/ELF/relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation.s?rev=122005&r1=122004&r2=122005&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation.s (original)
+++ llvm/trunk/test/MC/ELF/relocation.s Thu Dec 16 16:50:01 2010
@@ -14,6 +14,8 @@
         leaq	foo at TPOFF(%rax), %rax    # R_X86_64_TPOFF32
         leaq	foo at TLSLD(%rip), %rdi    # R_X86_64_TLSLD
         leaq	foo at DTPOFF(%rax), %rcx   # R_X86_64_DTPOFF32
+        pushq    $bar
+
 
 // CHECK:  # Section 0x00000001
 // CHECK: (('sh_name', 0x00000001) # '.text'
@@ -90,3 +92,9 @@
 // CHECK-NEXT:   ('r_sym', 0x00000006)
 // CHECK-NEXT:   ('r_type', 0x00000015)
 // CHECK-NEXT:   ('r_addend', 0x00000000)
+
+// CHECK: # Relocation 0x0000000b
+// CHECK-NEXT:  (('r_offset', 0x0000004e)
+// CHECK-NEXT:   ('r_sym', 0x00000002)
+// CHECK-NEXT:   ('r_type', 0x0000000b)
+// CHECK-NEXT:   ('r_addend', 0x00000000)





More information about the llvm-commits mailing list