Add support for @GOTPTOFF in i386 mode.
authorNick Lewycky <nicholas@mxc.ca>
Sat, 4 Jun 2011 17:38:07 +0000 (17:38 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 4 Jun 2011 17:38:07 +0000 (17:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132643 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp
test/MC/ELF/relocation-386.s

index 6b81fc97d98f67c2fbdee0fc3a9f47cb8b61bd9f..86344d1ad5990e3490f2412c096c528dfea9d047 100644 (file)
@@ -1720,6 +1720,9 @@ unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
         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;
index f7b20b56ba532f96ed1c860e8a0b8c31a4b9f2cd..25f3450d44d9a2fcdab1cc60baba1a9e0def5bf6 100644 (file)
 // CHECK-NEXT:  ('r_sym',
 // CHECK-NEXT:  ('r_type', 0x00000001)
 // CHECK-NEXT: ),
+// Relocation 24 (foo@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 @@ bar2:
         movl zed@TPOFF(%eax), %eax
         movl zed@DTPOFF(%eax), %eax
         pushl $bar
+        addl foo@GOTTPOFF(%edx), %eax
 
         .section        zedsec,"awT",@progbits
 zed: