Skip to content

Commit da57609

Browse files
authored
[PAC][MC][AArch64] Fix error message for AUTH_ABS64 reloc with ILP32 (#89563)
The `LP64 eqv:` should say that the equivalent is `AUTH_ABS64` rather than `ABS64` when trying to emit an AUTH absolute reloc with ILP32.
1 parent 0e44ffe commit da57609

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,18 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
211211
Target.getAccessVariant() == MCSymbolRefExpr::VK_GOTPCREL)
212212
? ELF::R_AARCH64_GOTPCREL32
213213
: R_CLS(ABS32);
214-
case FK_Data_8:
214+
case FK_Data_8: {
215+
bool IsAuth = (RefKind == AArch64MCExpr::VK_AUTH ||
216+
RefKind == AArch64MCExpr::VK_AUTHADDR);
215217
if (IsILP32) {
216218
Ctx.reportError(Fixup.getLoc(),
217-
"ILP32 8 byte absolute data "
218-
"relocation not supported (LP64 eqv: ABS64)");
219+
Twine("ILP32 8 byte absolute data "
220+
"relocation not supported (LP64 eqv: ") +
221+
(IsAuth ? "AUTH_ABS64" : "ABS64") + Twine(')'));
219222
return ELF::R_AARCH64_NONE;
220-
} else {
221-
if (RefKind == AArch64MCExpr::VK_AUTH ||
222-
RefKind == AArch64MCExpr::VK_AUTHADDR)
223-
return ELF::R_AARCH64_AUTH_ABS64;
224-
return ELF::R_AARCH64_ABS64;
225223
}
224+
return (IsAuth ? ELF::R_AARCH64_AUTH_ABS64 : ELF::R_AARCH64_ABS64);
225+
}
226226
case AArch64::fixup_aarch64_add_imm12:
227227
if (RefKind == AArch64MCExpr::VK_DTPREL_HI12)
228228
return R_CLS(TLSLD_ADD_DTPREL_HI12);

llvm/test/MC/AArch64/ilp32-diagnostics.s

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
.xword sym+16
1010
// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: ABS64)
11+
// CHECK-ERROR: ^
12+
13+
.xword sym@AUTH(da,42)
14+
// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64)
15+
// CHECK-ERROR: ^
16+
17+
.xword sym@AUTH(da,42,addr)
18+
// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64)
1119
// CHECK-ERROR: ^
1220

1321
movz x7, #:abs_g3:some_label

0 commit comments

Comments
 (0)