Implement TLSLDM.

llvm-svn: 117544
This commit is contained in:
Rafael Espindola 2010-10-28 14:37:09 +00:00
parent b3b49bbc39
commit 6f23eb380d
4 changed files with 14 additions and 0 deletions

View File

@ -137,6 +137,7 @@ public:
VK_GOTNTPOFF,
VK_PLT,
VK_TLSGD,
VK_TLSLDM,
VK_TPOFF,
VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the asm file)
VK_ARM_LO16, // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the asm file)

View File

@ -91,6 +91,7 @@ static bool RelocNeedsGOT(MCSymbolRefExpr::VariantKind Variant) {
case MCSymbolRefExpr::VK_INDNTPOFF:
case MCSymbolRefExpr::VK_NTPOFF:
case MCSymbolRefExpr::VK_GOTNTPOFF:
case MCSymbolRefExpr::VK_TLSLDM:
return true;
}
}
@ -784,6 +785,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
case MCSymbolRefExpr::VK_GOTNTPOFF:
Type = ELF::R_386_TLS_GOTIE;
break;
case MCSymbolRefExpr::VK_TLSLDM:
Type = ELF::R_386_TLS_LDM;
break;
}
break;
case FK_Data_2: Type = ELF::R_386_16; break;

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_TLSLDM: return "TLSLDM";
case VK_TPOFF: return "TPOFF";
case VK_ARM_HI16: return ":upper16:";
case VK_ARM_LO16: return ":lower16:";
@ -198,6 +199,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("GOTNTPOFF", VK_GOTNTPOFF)
.Case("PLT", VK_PLT)
.Case("TLSGD", VK_TLSGD)
.Case("TLSLDM", VK_TLSLDM)
.Case("TPOFF", VK_TPOFF)
.Case("TLVP", VK_TLVP)
.Default(VK_Invalid);

View File

@ -85,6 +85,12 @@
// CHECK-NEXT: ('r_type', 0x00000010)
// CHECK-NEXT: ),
// Relocation 10 (foo@TLSLDM) is of type R_386_TLS_LDM
// CHECK-NEXT: # Relocation 0x0000000a
// CHECK-NEXT: (('r_offset', 0x0000003d)
// CHECK-NEXT: ('r_sym', 0x0000000b)
// CHECK-NEXT: ('r_type', 0x00000013)
// CHECK-NEXT: ),
.text
bar:
leal .Lfoo@GOTOFF(%ebx), %eax
@ -106,6 +112,7 @@ bar2:
movl foo@INDNTPOFF, %ecx
addl foo@NTPOFF(%eax), %eax
addl foo@GOTNTPOFF(%ebx), %ecx
leal foo@TLSLDM(%ebx), %eax
.section .rodata.str1.16,"aMS",@progbits,1
.Lfoo: