@@ -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;
@@ -260,10 +231,9 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
260231 bool IsAuth = (RefKind == AArch64MCExpr::VK_AUTH ||
261232 RefKind == AArch64MCExpr::VK_AUTHADDR);
262233 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 (' )' ));
234+ Ctx.reportError (
235+ Fixup.getLoc (),
236+ " 8 byte absolute data relocation is not supported in ILP32" );
267237 return ELF::R_AARCH64_NONE;
268238 }
269239 return (IsAuth ? ELF::R_AARCH64_AUTH_ABS64 : ELF::R_AARCH64_ABS64);
@@ -286,17 +256,15 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
286256 if (RefKind == AArch64MCExpr::VK_TLSDESC_AUTH_LO12) {
287257 if (IsILP32) {
288258 Ctx.reportError (Fixup.getLoc (),
289- " ILP32 ADD AUTH relocation not supported "
290- " (LP64 eqv: AUTH_TLSDESC_ADD_LO12)" );
259+ " ADD AUTH relocation is not supported in ILP32" );
291260 return ELF::R_AARCH64_NONE;
292261 }
293262 return ELF::R_AARCH64_AUTH_TLSDESC_ADD_LO12;
294263 }
295264 if (RefKind == AArch64MCExpr::VK_GOT_AUTH_LO12 && IsNC) {
296265 if (IsILP32) {
297266 Ctx.reportError (Fixup.getLoc (),
298- " ILP32 ADD AUTH relocation not supported "
299- " (LP64 eqv: AUTH_GOT_ADD_LO12_NC)" );
267+ " ADD AUTH relocation is not supported in ILP32" );
300268 return ELF::R_AARCH64_NONE;
301269 }
302270 return ELF::R_AARCH64_AUTH_GOT_ADD_LO12_NC;
@@ -351,38 +319,31 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
351319 if (SymLoc == AArch64MCExpr::VK_GOT && IsNC) {
352320 if (IsILP32)
353321 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" );
322+ Ctx.reportError (Fixup.getLoc (), " 4 byte unchecked GOT load/store "
323+ " relocation is not supported in LP64" );
357324 return ELF::R_AARCH64_NONE;
358325 }
359326 if (SymLoc == AArch64MCExpr::VK_GOT && !IsNC) {
360327 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)" );
328+ Ctx.reportError (
329+ Fixup.getLoc (),
330+ " 4 byte checked GOT load/store relocation is not supported" );
369331 }
370332 return ELF::R_AARCH64_NONE;
371333 }
372334 if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
373335 if (IsILP32)
374336 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)" );
337+ Ctx.reportError (Fixup.getLoc (), " 32-bit load/store "
338+ " relocation is not supported in LP64" );
378339 return ELF::R_AARCH64_NONE;
379340 }
380341 if (SymLoc == AArch64MCExpr::VK_TLSDESC && !IsNC) {
381342 if (IsILP32)
382343 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) " );
344+ Ctx.reportError (
345+ Fixup. getLoc (),
346+ " 4 byte TLSDESC load/store relocation is not supported in LP64 " );
386347 return ELF::R_AARCH64_NONE;
387348 }
388349
@@ -405,11 +366,9 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
405366 return (IsAuth ? ELF::R_AARCH64_AUTH_LD64_GOT_LO12_NC
406367 : ELF::R_AARCH64_LD64_GOT_LO12_NC);
407368 }
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 (' )' ));
369+ Ctx.reportError (
370+ Fixup.getLoc (),
371+ " 64-bit load/store relocation is not supported in ILP32" );
413372 return ELF::R_AARCH64_NONE;
414373 }
415374 if (SymLoc == AArch64MCExpr::VK_DTPREL && !IsNC)
@@ -423,25 +382,25 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
423382 if (SymLoc == AArch64MCExpr::VK_GOTTPREL && IsNC) {
424383 if (!IsILP32)
425384 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) " );
385+ Ctx.reportError (
386+ Fixup. getLoc (),
387+ " 64-bit load/store relocation is not supported in ILP32 " );
429388 return ELF::R_AARCH64_NONE;
430389 }
431390 if (SymLoc == AArch64MCExpr::VK_TLSDESC) {
432391 if (!IsILP32)
433392 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) " );
393+ Ctx.reportError (
394+ Fixup. getLoc (),
395+ " 64-bit load/store relocation is not supported in ILP32 " );
437396 return ELF::R_AARCH64_NONE;
438397 }
439398 if (SymLoc == AArch64MCExpr::VK_TLSDESC_AUTH) {
440399 if (!IsILP32)
441400 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) " );
401+ Ctx.reportError (
402+ Fixup. getLoc (),
403+ " 64-bit load/store AUTH relocation is not supported in ILP32 " );
445404 return ELF::R_AARCH64_NONE;
446405 }
447406 Ctx.reportError (Fixup.getLoc (),
0 commit comments