@@ -81,7 +81,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
81
81
unsigned Kind = Fixup.getTargetKind ();
82
82
if (Kind >= FirstLiteralRelocationKind)
83
83
return Kind - FirstLiteralRelocationKind;
84
- MCSymbolRefExpr::VariantKind Modifier = Target.getAccessVariant ();
84
+ MCSymbolRefExpr::VariantKind Specifier = Target.getAccessVariant ();
85
85
auto CheckFDPIC = [&](uint32_t Type) {
86
86
if (getOSABI () != ELF::ELFOSABI_ARM_FDPIC)
87
87
Ctx.reportError (Fixup.getLoc (),
@@ -91,13 +91,31 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
91
91
return Type;
92
92
};
93
93
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
+
94
112
if (IsPCRel) {
95
113
switch (Fixup.getTargetKind ()) {
96
114
default :
97
115
Ctx.reportError (Fixup.getLoc (), " unsupported relocation type" );
98
116
return ELF::R_ARM_NONE;
99
117
case FK_Data_4:
100
- switch (Modifier ) {
118
+ switch (Specifier ) {
101
119
default :
102
120
Ctx.reportError (Fixup.getLoc (),
103
121
" invalid fixup for 4-byte pc-relative data relocation" );
@@ -120,7 +138,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
120
138
}
121
139
case ARM::fixup_arm_blx:
122
140
case ARM::fixup_arm_uncondbl:
123
- switch (Modifier ) {
141
+ switch (Specifier ) {
124
142
case MCSymbolRefExpr::VK_PLT:
125
143
return ELF::R_ARM_CALL;
126
144
case MCSymbolRefExpr::VK_TLSCALL:
@@ -158,7 +176,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
158
176
return ELF::R_ARM_THM_JUMP8;
159
177
case ARM::fixup_arm_thumb_bl:
160
178
case ARM::fixup_arm_thumb_blx:
161
- switch (Modifier ) {
179
+ switch (Specifier ) {
162
180
case MCSymbolRefExpr::VK_TLSCALL:
163
181
return ELF::R_ARM_THM_TLS_CALL;
164
182
default :
@@ -189,7 +207,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
189
207
Ctx.reportError (Fixup.getLoc (), " unsupported relocation type" );
190
208
return ELF::R_ARM_NONE;
191
209
case FK_Data_1:
192
- switch (Modifier ) {
210
+ switch (Specifier ) {
193
211
default :
194
212
Ctx.reportError (Fixup.getLoc (),
195
213
" invalid fixup for 1-byte data relocation" );
@@ -198,7 +216,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
198
216
return ELF::R_ARM_ABS8;
199
217
}
200
218
case FK_Data_2:
201
- switch (Modifier ) {
219
+ switch (Specifier ) {
202
220
default :
203
221
Ctx.reportError (Fixup.getLoc (),
204
222
" invalid fixup for 2-byte data relocation" );
@@ -207,7 +225,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
207
225
return ELF::R_ARM_ABS16;
208
226
}
209
227
case FK_Data_4:
210
- switch (Modifier ) {
228
+ switch (Specifier ) {
211
229
default :
212
230
Ctx.reportError (Fixup.getLoc (),
213
231
" invalid fixup for 4-byte data relocation" );
@@ -263,7 +281,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
263
281
case ARM::fixup_arm_uncondbranch:
264
282
return ELF::R_ARM_JUMP24;
265
283
case ARM::fixup_arm_movt_hi16:
266
- switch (Modifier ) {
284
+ switch (Specifier ) {
267
285
default :
268
286
Ctx.reportError (Fixup.getLoc (), " invalid fixup for ARM MOVT instruction" );
269
287
return ELF::R_ARM_NONE;
@@ -273,7 +291,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
273
291
return ELF::R_ARM_MOVT_BREL;
274
292
}
275
293
case ARM::fixup_arm_movw_lo16:
276
- switch (Modifier ) {
294
+ switch (Specifier ) {
277
295
default :
278
296
Ctx.reportError (Fixup.getLoc (), " invalid fixup for ARM MOVW instruction" );
279
297
return ELF::R_ARM_NONE;
@@ -283,7 +301,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
283
301
return ELF::R_ARM_MOVW_BREL_NC;
284
302
}
285
303
case ARM::fixup_t2_movt_hi16:
286
- switch (Modifier ) {
304
+ switch (Specifier ) {
287
305
default :
288
306
Ctx.reportError (Fixup.getLoc (),
289
307
" invalid fixup for Thumb MOVT instruction" );
@@ -294,7 +312,7 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
294
312
return ELF::R_ARM_THM_MOVT_BREL;
295
313
}
296
314
case ARM::fixup_t2_movw_lo16:
297
- switch (Modifier ) {
315
+ switch (Specifier ) {
298
316
default :
299
317
Ctx.reportError (Fixup.getLoc (),
300
318
" invalid fixup for Thumb MOVW instruction" );
0 commit comments