@@ -52,9 +52,6 @@ AArch64ELFObjectWriter::AArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)
52
52
53
53
#define R_CLS (rtype ) \
54
54
IsILP32 ? ELF::R_AARCH64_P32_##rtype : ELF::R_AARCH64_##rtype
55
- #define BAD_ILP32_MOV (lp64rtype ) \
56
- " ILP32 absolute MOV relocation not " \
57
- " supported (LP64 eqv: " #lp64rtype " )"
58
55
59
56
// assumes IsILP32 is true
60
57
static bool isNonILP32reloc (const MCFixup &Fixup,
@@ -63,40 +60,19 @@ static bool isNonILP32reloc(const MCFixup &Fixup,
63
60
return false ;
64
61
switch (RefKind) {
65
62
case AArch64MCExpr::VK_ABS_G3:
66
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G3));
67
- return true ;
68
63
case AArch64MCExpr::VK_ABS_G2:
69
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G2));
70
- return true ;
71
64
case AArch64MCExpr::VK_ABS_G2_S:
72
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_SABS_G2));
73
- return true ;
74
65
case AArch64MCExpr::VK_ABS_G2_NC:
75
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G2_NC));
76
- return true ;
77
66
case AArch64MCExpr::VK_ABS_G1_S:
78
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_SABS_G1));
79
- return true ;
80
67
case AArch64MCExpr::VK_ABS_G1_NC:
81
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G1_NC));
82
- return true ;
83
68
case AArch64MCExpr::VK_DTPREL_G2:
84
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLD_MOVW_DTPREL_G2));
85
- return true ;
86
69
case AArch64MCExpr::VK_DTPREL_G1_NC:
87
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLD_MOVW_DTPREL_G1_NC));
88
- return true ;
89
70
case AArch64MCExpr::VK_TPREL_G2:
90
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLE_MOVW_TPREL_G2));
91
- return true ;
92
71
case AArch64MCExpr::VK_TPREL_G1_NC:
93
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLE_MOVW_TPREL_G1_NC));
94
- return true ;
95
72
case AArch64MCExpr::VK_GOTTPREL_G1:
96
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSIE_MOVW_GOTTPREL_G1));
97
- return true ;
98
73
case AArch64MCExpr::VK_GOTTPREL_G0_NC:
99
- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSIE_MOVW_GOTTPREL_G0_NC));
74
+ Ctx.reportError (Fixup.getLoc (),
75
+ " absolute MOV relocation is not supported in ILP32" );
100
76
return true ;
101
77
default :
102
78
return false ;
@@ -147,18 +123,16 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
147
123
}
148
124
case FK_Data_8:
149
125
if (IsILP32) {
150
- Ctx.reportError (Fixup.getLoc (),
151
- " ILP32 8 byte PC relative data "
152
- " relocation not supported (LP64 eqv: PREL64)" );
126
+ Ctx.reportError (Fixup.getLoc (), " 8 byte PC relative data "
127
+ " relocation is not supported in ILP32" );
153
128
return ELF::R_AARCH64_NONE;
154
129
}
155
130
return ELF::R_AARCH64_PREL64;
156
131
case AArch64::fixup_aarch64_pcrel_adr_imm21:
157
132
if (SymLoc == AArch64MCExpr::VK_GOT_AUTH) {
158
133
if (IsILP32) {
159
134
Ctx.reportError (Fixup.getLoc (),
160
- " ILP32 ADR AUTH relocation not supported "
161
- " (LP64 eqv: AUTH_GOT_ADR_PREL_LO21)" );
135
+ " ADR AUTH relocation is not supported in ILP32" );
162
136
return ELF::R_AARCH64_NONE;
163
137
}
164
138
return ELF::R_AARCH64_AUTH_GOT_ADR_PREL_LO21;
@@ -184,8 +158,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
184
158
if (SymLoc == AArch64MCExpr::VK_GOT_AUTH && !IsNC) {
185
159
if (IsILP32) {
186
160
Ctx.reportError (Fixup.getLoc (),
187
- " ILP32 ADRP AUTH relocation not supported "
188
- " (LP64 eqv: AUTH_ADR_GOT_PAGE)" );
161
+ " ADRP AUTH relocation is not supported in ILP32" );
189
162
return ELF::R_AARCH64_NONE;
190
163
}
191
164
return ELF::R_AARCH64_AUTH_ADR_GOT_PAGE;
@@ -197,8 +170,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
197
170
if (SymLoc == AArch64MCExpr::VK_TLSDESC_AUTH && !IsNC) {
198
171
if (IsILP32) {
199
172
Ctx.reportError (Fixup.getLoc (),
200
- " ILP32 ADRP AUTH relocation not supported "
201
- " (LP64 eqv: AUTH_TLSDESC_ADR_PAGE21)" );
173
+ " ADRP AUTH relocation is not supported in ILP32" );
202
174
return ELF::R_AARCH64_NONE;
203
175
}
204
176
return ELF::R_AARCH64_AUTH_TLSDESC_ADR_PAGE21;
@@ -218,8 +190,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
218
190
if (SymLoc == AArch64MCExpr::VK_GOT_AUTH) {
219
191
if (IsILP32) {
220
192
Ctx.reportError (Fixup.getLoc (),
221
- " ILP32 LDR AUTH relocation not supported "
222
- " (LP64 eqv: AUTH_GOT_LD_PREL19)" );
193
+ " LDR AUTH relocation is not supported in ILP32" );
223
194
return ELF::R_AARCH64_NONE;
224
195
}
225
196
return ELF::R_AARCH64_AUTH_GOT_LD_PREL19;
@@ -257,16 +228,16 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
257
228
? ELF::R_AARCH64_GOTPCREL32
258
229
: R_CLS (ABS32);
259
230
case FK_Data_8: {
260
- bool IsAuth = (RefKind == AArch64MCExpr::VK_AUTH ||
261
- RefKind == AArch64MCExpr::VK_AUTHADDR);
262
231
if (IsILP32) {
263
- Ctx.reportError (Fixup.getLoc (),
264
- Twine (" ILP32 8 byte absolute data "
265
- " relocation not supported (LP64 eqv: " ) +
266
- (IsAuth ? " AUTH_ABS64" : " ABS64" ) + Twine (' )' ));
232
+ Ctx.reportError (
233
+ Fixup.getLoc (),
234
+ " 8 byte absolute data relocation is not supported in ILP32" );
267
235
return ELF::R_AARCH64_NONE;
268
236
}
269
- return (IsAuth ? ELF::R_AARCH64_AUTH_ABS64 : ELF::R_AARCH64_ABS64);
237
+ if (RefKind == AArch64MCExpr::VK_AUTH ||
238
+ RefKind == AArch64MCExpr::VK_AUTHADDR)
239
+ return ELF::R_AARCH64_AUTH_ABS64;
240
+ return ELF::R_AARCH64_ABS64;
270
241
}
271
242
case AArch64::fixup_aarch64_add_imm12:
272
243
if (RefKind == AArch64MCExpr::VK_DTPREL_HI12)
@@ -286,17 +257,15 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
286
257
if (RefKind == AArch64MCExpr::VK_TLSDESC_AUTH_LO12) {
287
258
if (IsILP32) {
288
259
Ctx.reportError (Fixup.getLoc (),
289
- " ILP32 ADD AUTH relocation not supported "
290
- " (LP64 eqv: AUTH_TLSDESC_ADD_LO12)" );
260
+ " ADD AUTH relocation is not supported in ILP32" );
291
261
return ELF::R_AARCH64_NONE;
292
262
}
293
263
return ELF::R_AARCH64_AUTH_TLSDESC_ADD_LO12;
294
264
}
295
265
if (RefKind == AArch64MCExpr::VK_GOT_AUTH_LO12 && IsNC) {
296
266
if (IsILP32) {
297
267
Ctx.reportError (Fixup.getLoc (),
298
- " ILP32 ADD AUTH relocation not supported "
299
- " (LP64 eqv: AUTH_GOT_ADD_LO12_NC)" );
268
+ " ADD AUTH relocation is not supported in ILP32" );
300
269
return ELF::R_AARCH64_NONE;
301
270
}
302
271
return ELF::R_AARCH64_AUTH_GOT_ADD_LO12_NC;
@@ -351,38 +320,31 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
351
320
if (SymLoc == AArch64MCExpr::VK_GOT && IsNC) {
352
321
if (IsILP32)
353
322
return ELF::R_AARCH64_P32_LD32_GOT_LO12_NC;
354
- Ctx.reportError (Fixup.getLoc (),
355
- " LP64 4 byte unchecked GOT load/store relocation "
356
- " not supported (ILP32 eqv: LD32_GOT_LO12_NC" );
323
+ Ctx.reportError (Fixup.getLoc (), " 4 byte unchecked GOT load/store "
324
+ " relocation is not supported in LP64" );
357
325
return ELF::R_AARCH64_NONE;
358
326
}
359
327
if (SymLoc == AArch64MCExpr::VK_GOT && !IsNC) {
360
328
if (IsILP32) {
361
- Ctx.reportError (Fixup.getLoc (),
362
- " ILP32 4 byte checked GOT load/store relocation "
363
- " not supported (unchecked eqv: LD32_GOT_LO12_NC)" );
364
- } else {
365
- Ctx.reportError (Fixup.getLoc (),
366
- " LP64 4 byte checked GOT load/store relocation "
367
- " not supported (unchecked/ILP32 eqv: "
368
- " LD32_GOT_LO12_NC)" );
329
+ Ctx.reportError (
330
+ Fixup.getLoc (),
331
+ " 4 byte checked GOT load/store relocation is not supported" );
369
332
}
370
333
return ELF::R_AARCH64_NONE;
371
334
}
372
335
if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
373
336
if (IsILP32)
374
337
return ELF::R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC;
375
- Ctx.reportError (Fixup.getLoc (), " LP64 32-bit load/store "
376
- " relocation not supported (ILP32 eqv: "
377
- " TLSIE_LD32_GOTTPREL_LO12_NC)" );
338
+ Ctx.reportError (Fixup.getLoc (), " 32-bit load/store "
339
+ " relocation is not supported in LP64" );
378
340
return ELF::R_AARCH64_NONE;
379
341
}
380
342
if (SymLoc == AArch64MCExpr::VK_TLSDESC && !IsNC) {
381
343
if (IsILP32)
382
344
return ELF::R_AARCH64_P32_TLSDESC_LD32_LO12;
383
- Ctx.reportError (Fixup. getLoc (),
384
- " LP64 4 byte TLSDESC load/store relocation "
385
- " not supported (ILP32 eqv: TLSDESC_LD64_LO12) " );
345
+ Ctx.reportError (
346
+ Fixup. getLoc (),
347
+ " 4 byte TLSDESC load/store relocation is not supported in LP64 " );
386
348
return ELF::R_AARCH64_NONE;
387
349
}
388
350
@@ -405,11 +367,9 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
405
367
return (IsAuth ? ELF::R_AARCH64_AUTH_LD64_GOT_LO12_NC
406
368
: ELF::R_AARCH64_LD64_GOT_LO12_NC);
407
369
}
408
- Ctx.reportError (Fixup.getLoc (),
409
- Twine (" ILP32 64-bit load/store "
410
- " relocation not supported (LP64 eqv: " ) +
411
- (IsAuth ? " AUTH_GOT_LO12_NC" : " LD64_GOT_LO12_NC" ) +
412
- Twine (' )' ));
370
+ Ctx.reportError (
371
+ Fixup.getLoc (),
372
+ " 64-bit load/store relocation is not supported in ILP32" );
413
373
return ELF::R_AARCH64_NONE;
414
374
}
415
375
if (SymLoc == AArch64MCExpr::VK_DTPREL && !IsNC)
@@ -423,25 +383,25 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
423
383
if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
424
384
if (!IsILP32)
425
385
return ELF::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC;
426
- Ctx.reportError (Fixup. getLoc (), " ILP32 64-bit load/store "
427
- " relocation not supported (LP64 eqv: "
428
- " TLSIE_LD64_GOTTPREL_LO12_NC) " );
386
+ Ctx.reportError (
387
+ Fixup. getLoc (),
388
+ " 64-bit load/store relocation is not supported in ILP32 " );
429
389
return ELF::R_AARCH64_NONE;
430
390
}
431
391
if (SymLoc == AArch64MCExpr::VK_TLSDESC) {
432
392
if (!IsILP32)
433
393
return ELF::R_AARCH64_TLSDESC_LD64_LO12;
434
- Ctx.reportError (Fixup. getLoc (), " ILP32 64-bit load/store "
435
- " relocation not supported (LP64 eqv: "
436
- " TLSDESC_LD64_LO12) " );
394
+ Ctx.reportError (
395
+ Fixup. getLoc (),
396
+ " 64-bit load/store relocation is not supported in ILP32 " );
437
397
return ELF::R_AARCH64_NONE;
438
398
}
439
399
if (SymLoc == AArch64MCExpr::VK_TLSDESC_AUTH) {
440
400
if (!IsILP32)
441
401
return ELF::R_AARCH64_AUTH_TLSDESC_LD64_LO12;
442
- Ctx.reportError (Fixup. getLoc (), " ILP32 64-bit load/store AUTH "
443
- " relocation not supported (LP64 eqv: "
444
- " AUTH_TLSDESC_LD64_LO12) " );
402
+ Ctx.reportError (
403
+ Fixup. getLoc (),
404
+ " 64-bit load/store AUTH relocation is not supported in ILP32 " );
445
405
return ELF::R_AARCH64_NONE;
446
406
}
447
407
Ctx.reportError (Fixup.getLoc (),
0 commit comments