1- // Test that features requiring FEAT_PAuth fail early:
1+ // REQUIRES: aarch64-registered-target
2+
3+ // Test that features requiring FEAT_PAuth fail early if the requirement is not met:
4+ //
25// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pauthabi 2>&1 | FileCheck %s --check-prefix=FAIL
36// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-calls 2>&1 | FileCheck %s --check-prefix=FAIL
47// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-returns 2>&1 | FileCheck %s --check-prefix=FAIL
58// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-objc-isa 2>&1 | FileCheck %s --check-prefix=FAIL
69//
7- // Note: at the time of writing, the following options are gated on -fptrauth-calls:
8- // -fptrauth-init-fini
9- // -fptrauth-function-pointer-type-discrimination
10- // -fptrauth-vtable-pointer-address-discrimination
11- // -fptrauth-vtable-pointer-type-discrimination
12- // -fptrauth-block-descriptor-pointers
10+ // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=apple-a12 -mbranch-protection=pauthabi 2>&1 | FileCheck %s --check-prefix=PAUTH
11+
12+ // Test that the following options are still gated on -fptrauth-calls.
13+ // If they are not, in assertion builds they would fail at asm printing time:
14+ //
15+ // RUN: %clang -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-init-fini
16+ // RUN: %clang -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-function-pointer-type-discrimination
17+ // RUN: %clang -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-address-discrimination
18+ // RUN: %clang -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-type-discrimination
19+ // RUN: %clang -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-block-descriptor-pointers
1320
1421// Test that v8.2-compatible code is generated, if possible:
22+ //
23+ // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -msign-return-address=all 2>&1 | FileCheck %s --check-prefix=COMPAT
1524// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret 2>&1 | FileCheck %s --check-prefix=COMPAT
1625
17- // Several targets imply +pauth:
18- // RUN: %clang %s -S -o - -target arm64e-apple-ios 2>&1 | FileCheck %s --check-prefix=PAUTH
26+ // arm64e has ptrauth enabled and assumes modern enough CPU by default:
27+ //
28+ // RUN: %clang %s -S -o - -target arm64e-apple-ios 2>&1 | FileCheck %s --check-prefix=PAUTH
29+ // RUN: not %clang %s -S -o - -target arm64e-apple-ios -mcpu=cortex-a72 2>&1 | FileCheck %s --check-prefix=FAIL
1930
2031void ext (void );
2132
@@ -24,7 +35,10 @@ int f(void) {
2435 return 0 ;
2536}
2637
27- // FAIL: error: A feature is requested that needs CPU with Pointer Authentication support
38+ // FIXME At now, the error message is printed twice.
39+ // Ideally, this should be fixed, but it seems rather harmless.
40+ //
41+ // FAIL-2: error: A feature is requested that needs CPU with Pointer Authentication support
2842
2943// COMPAT: f:
3044// COMPAT: hint #25
0 commit comments