ARM: support TLS descriptor relocations

Add support for tlsdesc relocations which are part of the ABI, marked as
experimental.  These relocations permit the linker to perform TLS reference
optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200447 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool 2014-01-30 04:02:38 +00:00
parent 9629ad3005
commit 4747d6b0a5
4 changed files with 13 additions and 0 deletions

View File

@ -167,6 +167,7 @@ public:
VK_ARM_PREL31,
VK_ARM_TLSLDO, // symbol(tlsldo)
VK_ARM_TLSCALL, // symbol(tlscall)
VK_ARM_TLSDESC, // symbol(tlsdesc)
VK_PPC_LO, // symbol@l
VK_PPC_HI, // symbol@h

View File

@ -186,6 +186,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
case VK_ARM_PREL31: return "prel31";
case VK_ARM_TLSLDO: return "tlsldo";
case VK_ARM_TLSCALL: return "tlscall";
case VK_ARM_TLSDESC: return "tlsdesc";
case VK_PPC_LO: return "l";
case VK_PPC_HI: return "h";
case VK_PPC_HA: return "ha";
@ -411,6 +412,8 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("tlsldo", VK_ARM_TLSLDO)
.Case("TLSCALL", VK_ARM_TLSCALL)
.Case("tlscall", VK_ARM_TLSCALL)
.Case("TLSDESC", VK_ARM_TLSDESC)
.Case("tlsdesc", VK_ARM_TLSDESC)
.Default(VK_Invalid);
}

View File

@ -266,6 +266,9 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
case MCSymbolRefExpr::VK_ARM_TLSCALL:
Type = ELF::R_ARM_TLS_CALL;
break;
case MCSymbolRefExpr::VK_ARM_TLSDESC:
Type = ELF::R_ARM_TLS_GOTDESC;
break;
}
break;
case ARM::fixup_arm_ldst_pcrel_12:

View File

@ -77,3 +77,9 @@ bl f05(plt)
@ CHECK: 88 R_ARM_TLS_CALL f22
@ CHECK: 92 R_ARM_TLS_CALL f23
@ tlsdesc
.word f24(TLSDESC)
.word f25(tlsdesc)
@ CHECK: 96 R_ARM_TLS_GOTDESC f24
@ CHECK: 100 R_ARM_TLS_GOTDESC f25