aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-10-28 15:02:40 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-10-28 15:02:40 +0000
commitb4d1721eff7b43577e5f2e53f885973fb6c43683 (patch)
treeff61252d1d9671dea723f79a182418e5ae6f84bf
parent0cf15d61b7e3bf53f5a99f58ada37b93bc039559 (diff)
downloadexternal_llvm-b4d1721eff7b43577e5f2e53f885973fb6c43683.zip
external_llvm-b4d1721eff7b43577e5f2e53f885973fb6c43683.tar.gz
external_llvm-b4d1721eff7b43577e5f2e53f885973fb6c43683.tar.bz2
Implement TLSLD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117547 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCExpr.h1
-rw-r--r--lib/MC/ELFObjectWriter.cpp4
-rw-r--r--lib/MC/MCExpr.cpp2
-rw-r--r--test/MC/ELF/relocation.s7
4 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h
index 272c7c0..51b1f83 100644
--- a/include/llvm/MC/MCExpr.h
+++ b/include/llvm/MC/MCExpr.h
@@ -137,6 +137,7 @@ public:
VK_GOTNTPOFF,
VK_PLT,
VK_TLSGD,
+ VK_TLSLD,
VK_TLSLDM,
VK_TPOFF,
VK_DTPOFF,
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 5cffef0..35f3f10 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -93,6 +93,7 @@ static bool RelocNeedsGOT(MCSymbolRefExpr::VariantKind Variant) {
case MCSymbolRefExpr::VK_GOTNTPOFF:
case MCSymbolRefExpr::VK_TLSLDM:
case MCSymbolRefExpr::VK_DTPOFF:
+ case MCSymbolRefExpr::VK_TLSLD:
return true;
}
}
@@ -701,6 +702,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
case MCSymbolRefExpr::VK_TLSGD:
Type = ELF::R_X86_64_TLSGD;
break;
+ case MCSymbolRefExpr::VK_TLSLD:
+ Type = ELF::R_X86_64_TLSLD;
+ break;
}
} else {
switch ((unsigned)Fixup.getKind()) {
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp
index 5780ba9..e3ef6de 100644
--- a/lib/MC/MCExpr.cpp
+++ b/lib/MC/MCExpr.cpp
@@ -178,6 +178,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
case VK_GOTNTPOFF: return "GOTNTPOFF";
case VK_PLT: return "PLT";
case VK_TLSGD: return "TLSGD";
+ case VK_TLSLD: return "TLSLD";
case VK_TLSLDM: return "TLSLDM";
case VK_TPOFF: return "TPOFF";
case VK_DTPOFF: return "DTPOFF";
@@ -200,6 +201,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("GOTNTPOFF", VK_GOTNTPOFF)
.Case("PLT", VK_PLT)
.Case("TLSGD", VK_TLSGD)
+ .Case("TLSLD", VK_TLSLD)
.Case("TLSLDM", VK_TLSLDM)
.Case("TPOFF", VK_TPOFF)
.Case("DTPOFF", VK_DTPOFF)
diff --git a/test/MC/ELF/relocation.s b/test/MC/ELF/relocation.s
index 128fbfa..546d89c 100644
--- a/test/MC/ELF/relocation.s
+++ b/test/MC/ELF/relocation.s
@@ -12,6 +12,7 @@ bar:
leaq foo@GOTTPOFF(%rip), %rax # R_X86_64_GOTTPOFF
leaq foo@TLSGD(%rip), %rax # R_X86_64_TLSGD
leaq foo@TPOFF(%rax), %rax # R_X86_64_TPOFF32
+ leaq foo@TLSLD(%rip), %rdi # R_X86_64_TLSLD
// CHECK: # Section 0x00000001
// CHECK: (('sh_name', 0x00000001) # '.text'
@@ -76,3 +77,9 @@ bar:
// CHECK-NEXT: ('r_sym', 0x00000006)
// CHECK-NEXT: ('r_type', 0x00000017)
// CHECK-NEXT: ('r_addend', 0x00000000)
+
+// CHECK: # Relocation 0x00000009
+// CHECK-NEXT: (('r_offset', 0x00000042)
+// CHECK-NEXT: ('r_sym', 0x00000006)
+// CHECK-NEXT: ('r_type', 0x00000014)
+// CHECK-NEXT: ('r_addend', 0xfffffffc)