Implement TLSLDM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-10-28 14:37:09 +00:00
parent a0a2f8734c
commit a264f72d3f
4 changed files with 14 additions and 0 deletions

View File

@ -137,6 +137,7 @@ public:
VK_GOTNTPOFF, VK_GOTNTPOFF,
VK_PLT, VK_PLT,
VK_TLSGD, VK_TLSGD,
VK_TLSLDM,
VK_TPOFF, VK_TPOFF,
VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the asm file) 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) 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_INDNTPOFF:
case MCSymbolRefExpr::VK_NTPOFF: case MCSymbolRefExpr::VK_NTPOFF:
case MCSymbolRefExpr::VK_GOTNTPOFF: case MCSymbolRefExpr::VK_GOTNTPOFF:
case MCSymbolRefExpr::VK_TLSLDM:
return true; return true;
} }
} }
@ -784,6 +785,9 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
case MCSymbolRefExpr::VK_GOTNTPOFF: case MCSymbolRefExpr::VK_GOTNTPOFF:
Type = ELF::R_386_TLS_GOTIE; Type = ELF::R_386_TLS_GOTIE;
break; break;
case MCSymbolRefExpr::VK_TLSLDM:
Type = ELF::R_386_TLS_LDM;
break;
} }
break; break;
case FK_Data_2: Type = ELF::R_386_16; 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_GOTNTPOFF: return "GOTNTPOFF";
case VK_PLT: return "PLT"; case VK_PLT: return "PLT";
case VK_TLSGD: return "TLSGD"; case VK_TLSGD: return "TLSGD";
case VK_TLSLDM: return "TLSLDM";
case VK_TPOFF: return "TPOFF"; case VK_TPOFF: return "TPOFF";
case VK_ARM_HI16: return ":upper16:"; case VK_ARM_HI16: return ":upper16:";
case VK_ARM_LO16: return ":lower16:"; case VK_ARM_LO16: return ":lower16:";
@ -198,6 +199,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("GOTNTPOFF", VK_GOTNTPOFF) .Case("GOTNTPOFF", VK_GOTNTPOFF)
.Case("PLT", VK_PLT) .Case("PLT", VK_PLT)
.Case("TLSGD", VK_TLSGD) .Case("TLSGD", VK_TLSGD)
.Case("TLSLDM", VK_TLSLDM)
.Case("TPOFF", VK_TPOFF) .Case("TPOFF", VK_TPOFF)
.Case("TLVP", VK_TLVP) .Case("TLVP", VK_TLVP)
.Default(VK_Invalid); .Default(VK_Invalid);

View File

@ -85,6 +85,12 @@
// CHECK-NEXT: ('r_type', 0x00000010) // CHECK-NEXT: ('r_type', 0x00000010)
// CHECK-NEXT: ), // 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 .text
bar: bar:
leal .Lfoo@GOTOFF(%ebx), %eax leal .Lfoo@GOTOFF(%ebx), %eax
@ -106,6 +112,7 @@ bar2:
movl foo@INDNTPOFF, %ecx movl foo@INDNTPOFF, %ecx
addl foo@NTPOFF(%eax), %eax addl foo@NTPOFF(%eax), %eax
addl foo@GOTNTPOFF(%ebx), %ecx addl foo@GOTNTPOFF(%ebx), %ecx
leal foo@TLSLDM(%ebx), %eax
.section .rodata.str1.16,"aMS",@progbits,1 .section .rodata.str1.16,"aMS",@progbits,1
.Lfoo: .Lfoo: