Skip to content

Commit 7dfa4cf

Browse files
author
git apple-llvm automerger
committed
Merge commit '74995a6c04df' from llvm.org/main into next
2 parents 195e6c4 + 74995a6 commit 7dfa4cf

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,15 +2367,19 @@ AArch64AsmPrinter::lowerConstantPtrAuth(const ConstantPtrAuth &CPA) {
23672367
uint64_t KeyID = CPA.getKey()->getZExtValue();
23682368
// We later rely on valid KeyID value in AArch64PACKeyIDToString call from
23692369
// AArch64AuthMCExpr::printImpl, so fail fast.
2370-
if (KeyID > AArch64PACKey::LAST)
2371-
report_fatal_error("AArch64 PAC Key ID '" + Twine(KeyID) +
2372-
"' out of range [0, " +
2373-
Twine((unsigned)AArch64PACKey::LAST) + "]");
2370+
if (KeyID > AArch64PACKey::LAST) {
2371+
CPA.getContext().emitError("AArch64 PAC Key ID '" + Twine(KeyID) +
2372+
"' out of range [0, " +
2373+
Twine((unsigned)AArch64PACKey::LAST) + "]");
2374+
KeyID = 0;
2375+
}
23742376

23752377
uint64_t Disc = CPA.getDiscriminator()->getZExtValue();
2376-
if (!isUInt<16>(Disc))
2377-
report_fatal_error("AArch64 PAC Discriminator '" + Twine(Disc) +
2378-
"' out of range [0, 0xFFFF]");
2378+
if (!isUInt<16>(Disc)) {
2379+
CPA.getContext().emitError("AArch64 PAC Discriminator '" + Twine(Disc) +
2380+
"' out of range [0, 0xFFFF]");
2381+
Disc = 0;
2382+
}
23792383

23802384
// Finally build the complete @AUTH expr.
23812385
return AArch64AuthMCExpr::create(Sym, Disc, AArch64PACKey::ID(KeyID),

llvm/test/CodeGen/AArch64/ptrauth-reloc.ll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,38 +139,39 @@
139139

140140
;--- err-key.ll
141141

142-
; RUN: not --crash llc < err-key.ll -mtriple arm64e-apple-darwin 2>&1 \
142+
; RUN: not llc < err-key.ll -mtriple arm64e-apple-darwin 2>&1 \
143143
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY
144-
; RUN: not --crash llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \
144+
; RUN: not llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \
145145
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY
146146

147-
; RUN: not --crash llc < err-key.ll -mtriple arm64e-apple-darwin \
147+
; RUN: not llc < err-key.ll -mtriple arm64e-apple-darwin \
148148
; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \
149149
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY
150-
; RUN: not --crash llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth \
150+
; RUN: not llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth \
151151
; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \
152152
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY
153153

154-
; CHECK-ERR-KEY: LLVM ERROR: AArch64 PAC Key ID '4' out of range [0, 3]
154+
; CHECK-ERR-KEY: error: AArch64 PAC Key ID '4' out of range [0, 3]
155+
155156

156157
@g = external global i32
157158
@g.ref.4.0 = constant ptr ptrauth (ptr @g, i32 4, i64 0)
158159

159160
;--- err-disc.ll
160161

161-
; RUN: not --crash llc < err-disc.ll -mtriple arm64e-apple-darwin 2>&1 \
162+
; RUN: not llc < err-disc.ll -mtriple arm64e-apple-darwin 2>&1 \
162163
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC
163-
; RUN: not --crash llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \
164+
; RUN: not llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \
164165
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC
165166

166-
; RUN: not --crash llc < err-disc.ll -mtriple arm64e-apple-darwin \
167+
; RUN: not llc < err-disc.ll -mtriple arm64e-apple-darwin \
167168
; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \
168169
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC
169-
; RUN: not --crash llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth \
170+
; RUN: not llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth \
170171
; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \
171172
; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC
172173

173-
; CHECK-ERR-DISC: LLVM ERROR: AArch64 PAC Discriminator '65536' out of range [0, 0xFFFF]
174+
; CHECK-ERR-DISC: error: AArch64 PAC Discriminator '65536' out of range [0, 0xFFFF]
174175

175176
@g = external global i32
176177
@g.ref.ia.65536 = constant ptr ptrauth (ptr @g, i32 0, i64 65536)

0 commit comments

Comments
 (0)