[llvm-commits] [llvm] r132643 - in /llvm/trunk: lib/MC/ELFObjectWriter.cpp test/MC/ELF/relocation-386.s

Nick Lewycky nicholas at mxc.ca
Sat Jun 4 10:38:07 PDT 2011


Author: nicholas
Date: Sat Jun  4 12:38:07 2011
New Revision: 132643

URL: http://llvm.org/viewvc/llvm-project?rev=132643&view=rev
Log:
Add support for @GOTPTOFF in i386 mode.

Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp
    llvm/trunk/test/MC/ELF/relocation-386.s

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=132643&r1=132642&r2=132643&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Sat Jun  4 12:38:07 2011
@@ -1720,6 +1720,9 @@
         case MCSymbolRefExpr::VK_DTPOFF:
           Type = ELF::R_386_TLS_LDO_32;
           break;
+        case MCSymbolRefExpr::VK_GOTTPOFF:
+          Type = ELF::R_386_TLS_IE_32;
+          break;
         }
         break;
       case FK_Data_2: Type = ELF::R_386_16; break;

Modified: llvm/trunk/test/MC/ELF/relocation-386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-386.s?rev=132643&r1=132642&r2=132643&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-386.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-386.s Sat Jun  4 12:38:07 2011
@@ -153,6 +153,13 @@
 // CHECK-NEXT:  ('r_sym',
 // CHECK-NEXT:  ('r_type', 0x00000001)
 // CHECK-NEXT: ),
+// Relocation 24 (foo at GOTTPOFF(%edx)) is of type R_386_TLS_IE_32 and uses the
+// symbol
+// CHECK-NEXT: Relocation 0x00000018
+// CHECK-NEXT: (('r_offset', 0x0000008e)
+// CHECK-NEXT:  ('r_sym', 0x0000000d)
+// CHECK-NEXT:  ('r_type', 0x00000021)
+// CHECK-NEXT: ),
 
 // Section 4 is bss
 // CHECK:      # Section 0x00000004
@@ -217,6 +224,7 @@
         movl zed at TPOFF(%eax), %eax
         movl zed at DTPOFF(%eax), %eax
         pushl $bar
+        addl foo at GOTTPOFF(%edx), %eax
 
         .section        zedsec,"awT", at progbits
 zed:





More information about the llvm-commits mailing list