@@ -52,9 +52,6 @@ AArch64ELFObjectWriter::AArch64ELFObjectWriter(uint8_t OSABI, bool IsILP32)
5252
5353#define R_CLS (rtype ) \
5454 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 " )"
5855
5956// assumes IsILP32 is true
6057static bool isNonILP32reloc (const MCFixup &Fixup,
@@ -63,40 +60,19 @@ static bool isNonILP32reloc(const MCFixup &Fixup,
6360 return false ;
6461 switch (RefKind) {
6562 case AArch64MCExpr::VK_ABS_G3:
66- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G3));
67- return true ;
6863 case AArch64MCExpr::VK_ABS_G2:
69- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G2));
70- return true ;
7164 case AArch64MCExpr::VK_ABS_G2_S:
72- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_SABS_G2));
73- return true ;
7465 case AArch64MCExpr::VK_ABS_G2_NC:
75- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G2_NC));
76- return true ;
7766 case AArch64MCExpr::VK_ABS_G1_S:
78- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_SABS_G1));
79- return true ;
8067 case AArch64MCExpr::VK_ABS_G1_NC:
81- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (MOVW_UABS_G1_NC));
82- return true ;
8368 case AArch64MCExpr::VK_DTPREL_G2:
84- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLD_MOVW_DTPREL_G2));
85- return true ;
8669 case AArch64MCExpr::VK_DTPREL_G1_NC:
87- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLD_MOVW_DTPREL_G1_NC));
88- return true ;
8970 case AArch64MCExpr::VK_TPREL_G2:
90- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLE_MOVW_TPREL_G2));
91- return true ;
9271 case AArch64MCExpr::VK_TPREL_G1_NC:
93- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSLE_MOVW_TPREL_G1_NC));
94- return true ;
9572 case AArch64MCExpr::VK_GOTTPREL_G1:
96- Ctx.reportError (Fixup.getLoc (), BAD_ILP32_MOV (TLSIE_MOVW_GOTTPREL_G1));
97- return true ;
9873 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" );
10076 return true ;
10177 default :
10278 return false ;
@@ -147,18 +123,16 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
147123 }
148124 case FK_Data_8:
149125 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" );
153128 return ELF::R_AARCH64_NONE;
154129 }
155130 return ELF::R_AARCH64_PREL64;
156131 case AArch64::fixup_aarch64_pcrel_adr_imm21:
157132 if (SymLoc == AArch64MCExpr::VK_GOT_AUTH) {
158133 if (IsILP32) {
159134 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" );
162136 return ELF::R_AARCH64_NONE;
163137 }
164138 return ELF::R_AARCH64_AUTH_GOT_ADR_PREL_LO21;
@@ -184,8 +158,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
184158 if (SymLoc == AArch64MCExpr::VK_GOT_AUTH && !IsNC) {
185159 if (IsILP32) {
186160 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" );
189162 return ELF::R_AARCH64_NONE;
190163 }
191164 return ELF::R_AARCH64_AUTH_ADR_GOT_PAGE;
@@ -197,8 +170,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
197170 if (SymLoc == AArch64MCExpr::VK_TLSDESC_AUTH && !IsNC) {
198171 if (IsILP32) {
199172 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" );
202174 return ELF::R_AARCH64_NONE;
203175 }
204176 return ELF::R_AARCH64_AUTH_TLSDESC_ADR_PAGE21;
@@ -218,8 +190,7 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
218190 if (SymLoc == AArch64MCExpr::VK_GOT_AUTH) {
219191 if (IsILP32) {
220192 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" );
223194 return ELF::R_AARCH64_NONE;
224195 }
225196 return ELF::R_AARCH64_AUTH_GOT_LD_PREL19;
@@ -257,16 +228,16 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
257228 ? ELF::R_AARCH64_GOTPCREL32
258229 : R_CLS (ABS32);
259230 case FK_Data_8: {
260- bool IsAuth = (RefKind == AArch64MCExpr::VK_AUTH ||
261- RefKind == AArch64MCExpr::VK_AUTHADDR);
262231 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" );
267235 return ELF::R_AARCH64_NONE;
268236 }
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;
270241 }
271242 case AArch64::fixup_aarch64_add_imm12:
272243 if (RefKind == AArch64MCExpr::VK_DTPREL_HI12)
@@ -286,17 +257,15 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
286257 if (RefKind == AArch64MCExpr::VK_TLSDESC_AUTH_LO12) {
287258 if (IsILP32) {
288259 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" );
291261 return ELF::R_AARCH64_NONE;
292262 }
293263 return ELF::R_AARCH64_AUTH_TLSDESC_ADD_LO12;
294264 }
295265 if (RefKind == AArch64MCExpr::VK_GOT_AUTH_LO12 && IsNC) {
296266 if (IsILP32) {
297267 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" );
300269 return ELF::R_AARCH64_NONE;
301270 }
302271 return ELF::R_AARCH64_AUTH_GOT_ADD_LO12_NC;
@@ -351,38 +320,31 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
351320 if (SymLoc == AArch64MCExpr::VK_GOT && IsNC) {
352321 if (IsILP32)
353322 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" );
357325 return ELF::R_AARCH64_NONE;
358326 }
359327 if (SymLoc == AArch64MCExpr::VK_GOT && !IsNC) {
360328 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" );
369332 }
370333 return ELF::R_AARCH64_NONE;
371334 }
372335 if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
373336 if (IsILP32)
374337 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" );
378340 return ELF::R_AARCH64_NONE;
379341 }
380342 if (SymLoc == AArch64MCExpr::VK_TLSDESC && !IsNC) {
381343 if (IsILP32)
382344 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 " );
386348 return ELF::R_AARCH64_NONE;
387349 }
388350
@@ -405,11 +367,9 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
405367 return (IsAuth ? ELF::R_AARCH64_AUTH_LD64_GOT_LO12_NC
406368 : ELF::R_AARCH64_LD64_GOT_LO12_NC);
407369 }
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" );
413373 return ELF::R_AARCH64_NONE;
414374 }
415375 if (SymLoc == AArch64MCExpr::VK_DTPREL && !IsNC)
@@ -423,25 +383,25 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
423383 if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
424384 if (!IsILP32)
425385 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 " );
429389 return ELF::R_AARCH64_NONE;
430390 }
431391 if (SymLoc == AArch64MCExpr::VK_TLSDESC) {
432392 if (!IsILP32)
433393 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 " );
437397 return ELF::R_AARCH64_NONE;
438398 }
439399 if (SymLoc == AArch64MCExpr::VK_TLSDESC_AUTH) {
440400 if (!IsILP32)
441401 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 " );
445405 return ELF::R_AARCH64_NONE;
446406 }
447407 Ctx.reportError (Fixup.getLoc (),
0 commit comments