Implement TLSLD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-10-28 15:02:40 +00:00
parent 0cf15d61b7
commit b4d1721eff
4 changed files with 14 additions and 0 deletions

View File

@ -137,6 +137,7 @@ public:
VK_GOTNTPOFF,
VK_PLT,
VK_TLSGD,
VK_TLSLD,
VK_TLSLDM,
VK_TPOFF,
VK_DTPOFF,

View File

@ -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()) {

View File

@ -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)

View File

@ -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)