[llvm] AArch64: Do not use report_fatal_error for pauth reloc errors (PR #145277)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 08:35:22 PDT 2025


================
@@ -2254,15 +2254,19 @@ AArch64AsmPrinter::lowerConstantPtrAuth(const ConstantPtrAuth &CPA) {
   uint64_t KeyID = CPA.getKey()->getZExtValue();
   // We later rely on valid KeyID value in AArch64PACKeyIDToString call from
   // AArch64AuthMCExpr::printImpl, so fail fast.
-  if (KeyID > AArch64PACKey::LAST)
-    report_fatal_error("AArch64 PAC Key ID '" + Twine(KeyID) +
-                       "' out of range [0, " +
-                       Twine((unsigned)AArch64PACKey::LAST) + "]");
+  if (KeyID > AArch64PACKey::LAST) {
+    CPA.getContext().emitError("AArch64 PAC Key ID '" + Twine(KeyID) +
----------------
kovdan01 wrote:

A comment above says that we fail fast here because we expect valid `KeyID` when calling `AArch64PACKeyIDToString` from `AArch64AuthMCExpr::printImpl` (there is an unreachable statement for invalid key values there, and we should treat unreachable as UB if I'm not missing smth). Is this comment not relevant and can we guarantee that we do not call `AArch64PACKeyIDToString` with invalid key value? If so, the comment should probably be deleted.


https://github.com/llvm/llvm-project/pull/145277


More information about the llvm-commits mailing list