diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-28 14:37:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-10-28 14:37:09 +0000 |
commit | a264f72d3fb9dec1427480fcf17ef3c746ea723a (patch) | |
tree | eb540f5b3c9ecb9be95e408e2a69a9e36bff759f | |
parent | a0a2f8734cdfc19d44201b791a969bcdda96bb70 (diff) |
Implement TLSLDM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117544 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCExpr.h | 1 | ||||
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 4 | ||||
-rw-r--r-- | lib/MC/MCExpr.cpp | 2 | ||||
-rw-r--r-- | test/MC/ELF/relocation-386.s | 7 |
4 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index 4fe1b37aea..e1f27f156c 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_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) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index fda8ac47c3..2200502285 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -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; diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index 39ac1ac772..6ee2520e69 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_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); diff --git a/test/MC/ELF/relocation-386.s b/test/MC/ELF/relocation-386.s index 8a1ff6e5c5..9fb0befb03 100644 --- a/test/MC/ELF/relocation-386.s +++ b/test/MC/ELF/relocation-386.s @@ -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: |