[llvm] da57609 - [PAC][MC][AArch64] Fix error message for AUTH_ABS64 reloc with ILP32 (#89563)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 01:34:01 PDT 2024
Author: Daniil Kovalev
Date: 2024-04-23T11:33:57+03:00
New Revision: da57609947f254fb13f1556d4d29c7a0f9a23160
URL: https://github.com/llvm/llvm-project/commit/da57609947f254fb13f1556d4d29c7a0f9a23160
DIFF: https://github.com/llvm/llvm-project/commit/da57609947f254fb13f1556d4d29c7a0f9a23160.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
llvm/test/MC/AArch64/ilp32-diagnostics.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
index 6e074b6a63c41d..abbf20257edcc0 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
@@ -211,18 +211,18 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
Target.getAccessVariant() == MCSymbolRefExpr::VK_GOTPCREL)
? ELF::R_AARCH64_GOTPCREL32
: R_CLS(ABS32);
- case FK_Data_8:
+ case FK_Data_8: {
+ bool IsAuth = (RefKind == AArch64MCExpr::VK_AUTH ||
+ RefKind == AArch64MCExpr::VK_AUTHADDR);
if (IsILP32) {
Ctx.reportError(Fixup.getLoc(),
- "ILP32 8 byte absolute data "
- "relocation not supported (LP64 eqv: ABS64)");
+ Twine("ILP32 8 byte absolute data "
+ "relocation not supported (LP64 eqv: ") +
+ (IsAuth ? "AUTH_ABS64" : "ABS64") + Twine(')'));
return ELF::R_AARCH64_NONE;
- } else {
- if (RefKind == AArch64MCExpr::VK_AUTH ||
- RefKind == AArch64MCExpr::VK_AUTHADDR)
- return ELF::R_AARCH64_AUTH_ABS64;
- return ELF::R_AARCH64_ABS64;
}
+ return (IsAuth ? ELF::R_AARCH64_AUTH_ABS64 : ELF::R_AARCH64_ABS64);
+ }
case AArch64::fixup_aarch64_add_imm12:
if (RefKind == AArch64MCExpr::VK_DTPREL_HI12)
return R_CLS(TLSLD_ADD_DTPREL_HI12);
diff --git a/llvm/test/MC/AArch64/ilp32-diagnostics.s b/llvm/test/MC/AArch64/ilp32-diagnostics.s
index 65c9e4ea5a1c56..4ca15f160418da 100644
--- a/llvm/test/MC/AArch64/ilp32-diagnostics.s
+++ b/llvm/test/MC/AArch64/ilp32-diagnostics.s
@@ -8,6 +8,14 @@
.xword sym+16
// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: ABS64)
+// CHECK-ERROR: ^
+
+ .xword sym at AUTH(da,42)
+// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64)
+// CHECK-ERROR: ^
+
+ .xword sym at AUTH(da,42,addr)
+// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64)
// CHECK-ERROR: ^
movz x7, #:abs_g3:some_label
More information about the llvm-commits
mailing list