From e0b87032f5ac8134b7585bdc4a0f2c77158b962d Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sat, 4 Jun 2011 17:38:07 +0000 Subject: [PATCH] Add support for @GOTPTOFF in i386 mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132643 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/ELFObjectWriter.cpp | 3 +++ test/MC/ELF/relocation-386.s | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 6b81fc97d98..86344d1ad59 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -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; diff --git a/test/MC/ELF/relocation-386.s b/test/MC/ELF/relocation-386.s index f7b20b56ba5..25f3450d44d 100644 --- a/test/MC/ELF/relocation-386.s +++ b/test/MC/ELF/relocation-386.s @@ -153,6 +153,13 @@ // 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: