[llvm] r200447 - ARM: support TLS descriptor relocations
Saleem Abdulrasool
compnerd at compnerd.org
Wed Jan 29 20:02:38 PST 2014
Author: compnerd
Date: Wed Jan 29 22:02:38 2014
New Revision: 200447
URL: http://llvm.org/viewvc/llvm-project?rev=200447&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/MC/MCExpr.h
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
llvm/trunk/test/MC/ARM/symbol-variants.s
Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=200447&r1=200446&r2=200447&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Wed Jan 29 22:02:38 2014
@@ -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 at l
VK_PPC_HI, // symbol at h
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=200447&r1=200446&r2=200447&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Wed Jan 29 22:02:38 2014
@@ -186,6 +186,7 @@ StringRef MCSymbolRefExpr::getVariantKin
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(S
.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);
}
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp?rev=200447&r1=200446&r2=200447&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp Wed Jan 29 22:02:38 2014
@@ -266,6 +266,9 @@ unsigned ARMELFObjectWriter::GetRelocTyp
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:
Modified: llvm/trunk/test/MC/ARM/symbol-variants.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/symbol-variants.s?rev=200447&r1=200446&r2=200447&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/symbol-variants.s (original)
+++ llvm/trunk/test/MC/ARM/symbol-variants.s Wed Jan 29 22:02:38 2014
@@ -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
+
More information about the llvm-commits
mailing list