@@ -81,7 +81,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
8181 unsigned Kind = Fixup.getTargetKind ();
8282 if (Kind >= FirstLiteralRelocationKind)
8383 return Kind - FirstLiteralRelocationKind;
84- MCSymbolRefExpr::VariantKind Modifier = Target.getAccessVariant ();
84+ MCSymbolRefExpr::VariantKind Specifier = Target.getAccessVariant ();
8585 auto CheckFDPIC = [&](uint32_t Type) {
8686 if (getOSABI () != ELF::ELFOSABI_ARM_FDPIC)
8787 Ctx.reportError (Fixup.getLoc (),
@@ -91,13 +91,31 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
9191 return Type;
9292 };
9393
94+ switch (Specifier) {
95+ case MCSymbolRefExpr::VK_GOTTPOFF:
96+ case MCSymbolRefExpr::VK_GOTTPOFF_FDPIC:
97+ case MCSymbolRefExpr::VK_TLSCALL:
98+ case MCSymbolRefExpr::VK_TLSDESC:
99+ case MCSymbolRefExpr::VK_TLSGD:
100+ case MCSymbolRefExpr::VK_TLSGD_FDPIC:
101+ case MCSymbolRefExpr::VK_TLSLDM:
102+ case MCSymbolRefExpr::VK_TLSLDM_FDPIC:
103+ case MCSymbolRefExpr::VK_ARM_TLSLDO:
104+ case MCSymbolRefExpr::VK_TPOFF:
105+ if (auto *S = Target.getSymA ())
106+ cast<MCSymbolELF>(S->getSymbol ()).setType (ELF::STT_TLS);
107+ break ;
108+ default :
109+ break ;
110+ }
111+
94112 if (IsPCRel) {
95113 switch (Fixup.getTargetKind ()) {
96114 default :
97115 Ctx.reportError (Fixup.getLoc (), " unsupported relocation type" );
98116 return ELF::R_ARM_NONE;
99117 case FK_Data_4:
100- switch (Modifier ) {
118+ switch (Specifier ) {
101119 default :
102120 Ctx.reportError (Fixup.getLoc (),
103121 " invalid fixup for 4-byte pc-relative data relocation" );
@@ -120,7 +138,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
120138 }
121139 case ARM::fixup_arm_blx:
122140 case ARM::fixup_arm_uncondbl:
123- switch (Modifier ) {
141+ switch (Specifier ) {
124142 case MCSymbolRefExpr::VK_PLT:
125143 return ELF::R_ARM_CALL;
126144 case MCSymbolRefExpr::VK_TLSCALL:
@@ -158,7 +176,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
158176 return ELF::R_ARM_THM_JUMP8;
159177 case ARM::fixup_arm_thumb_bl:
160178 case ARM::fixup_arm_thumb_blx:
161- switch (Modifier ) {
179+ switch (Specifier ) {
162180 case MCSymbolRefExpr::VK_TLSCALL:
163181 return ELF::R_ARM_THM_TLS_CALL;
164182 default :
@@ -189,7 +207,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
189207 Ctx.reportError (Fixup.getLoc (), " unsupported relocation type" );
190208 return ELF::R_ARM_NONE;
191209 case FK_Data_1:
192- switch (Modifier ) {
210+ switch (Specifier ) {
193211 default :
194212 Ctx.reportError (Fixup.getLoc (),
195213 " invalid fixup for 1-byte data relocation" );
@@ -198,7 +216,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
198216 return ELF::R_ARM_ABS8;
199217 }
200218 case FK_Data_2:
201- switch (Modifier ) {
219+ switch (Specifier ) {
202220 default :
203221 Ctx.reportError (Fixup.getLoc (),
204222 " invalid fixup for 2-byte data relocation" );
@@ -207,7 +225,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
207225 return ELF::R_ARM_ABS16;
208226 }
209227 case FK_Data_4:
210- switch (Modifier ) {
228+ switch (Specifier ) {
211229 default :
212230 Ctx.reportError (Fixup.getLoc (),
213231 " invalid fixup for 4-byte data relocation" );
@@ -263,7 +281,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
263281 case ARM::fixup_arm_uncondbranch:
264282 return ELF::R_ARM_JUMP24;
265283 case ARM::fixup_arm_movt_hi16:
266- switch (Modifier ) {
284+ switch (Specifier ) {
267285 default :
268286 Ctx.reportError (Fixup.getLoc (), " invalid fixup for ARM MOVT instruction" );
269287 return ELF::R_ARM_NONE;
@@ -273,7 +291,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
273291 return ELF::R_ARM_MOVT_BREL;
274292 }
275293 case ARM::fixup_arm_movw_lo16:
276- switch (Modifier ) {
294+ switch (Specifier ) {
277295 default :
278296 Ctx.reportError (Fixup.getLoc (), " invalid fixup for ARM MOVW instruction" );
279297 return ELF::R_ARM_NONE;
@@ -283,7 +301,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
283301 return ELF::R_ARM_MOVW_BREL_NC;
284302 }
285303 case ARM::fixup_t2_movt_hi16:
286- switch (Modifier ) {
304+ switch (Specifier ) {
287305 default :
288306 Ctx.reportError (Fixup.getLoc (),
289307 " invalid fixup for Thumb MOVT instruction" );
@@ -294,7 +312,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
294312 return ELF::R_ARM_THM_MOVT_BREL;
295313 }
296314 case ARM::fixup_t2_movw_lo16:
297- switch (Modifier ) {
315+ switch (Specifier ) {
298316 default :
299317 Ctx.reportError (Fixup.getLoc (),
300318 " invalid fixup for Thumb MOVW instruction" );
0 commit comments