2
2
3
3
// Test that features requiring FEAT_PAuth fail early if the requirement is not met:
4
4
//
5
- // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pauthabi 2>&1 | FileCheck %s --check-prefix=FAIL
6
- // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-calls 2>&1 | FileCheck %s --check-prefix=FAIL
7
- // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-returns 2>&1 | FileCheck %s --check-prefix=FAIL
8
- // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-objc-isa 2>&1 | FileCheck %s --check-prefix=FAIL
5
+ // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pauthabi 2>&1 \
6
+ // RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,FAIL-CALLS,FAIL-RETURNS,NO-UNEXPECTED
7
+ // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-intrinsics 2>&1 \
8
+ // RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,NO-UNEXPECTED
9
+ // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-calls 2>&1 \
10
+ // RUN: | FileCheck %s --check-prefixes=FAIL-CALLS,NO-UNEXPECTED
11
+ // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-returns 2>&1 \
12
+ // RUN: | FileCheck %s --check-prefixes=FAIL-RETURNS,NO-UNEXPECTED
13
+ // RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-objc-isa 2>&1 \
14
+ // RUN: | FileCheck %s --check-prefixes=FAIL-OBJC-ISA,NO-UNEXPECTED
9
15
//
10
16
// Test that no errors and warnings are generated if FEAT_PAUTH is supported:
11
17
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=apple-a12 -mbranch-protection=pauthabi 2>&1 \
17
23
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -march=armv8.2-a+pauth -mbranch-protection=pauthabi 2>&1 \
18
24
// RUN: | FileCheck %s --check-prefix=PAUTH --implicit-check-not=error --implicit-check-not=warning
19
25
//
20
- // Test a few combinations of options that should not generate warnings (technically, prefix is CHECK):
26
+ // Test a few combinations of options that should not generate warnings (technically, the prefix is CHECK):
21
27
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -march=armv8.3-a -fptrauth-returns 2>&1 \
22
- // RUN: | FileCheck %s --allow-unused-prefixes --implicit- check-not=error --implicit-check-not=warning
28
+ // RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
23
29
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -march=armv8.3-a -fptrauth-objc-isa 2>&1 \
24
- // RUN: | FileCheck %s --allow-unused-prefixes --implicit- check-not=error --implicit-check-not=warning
30
+ // RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
25
31
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -march=armv8.3-a -fptrauth-init-fini -fptrauth-calls 2>&1 \
26
- // RUN: | FileCheck %s --allow-unused-prefixes --implicit- check-not=error --implicit-check-not=warning
32
+ // RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
27
33
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -march=armv8.3-a -fptrauth-init-fini -mbranch-protection=pauthabi 2>&1 \
28
- // RUN: | FileCheck %s --allow-unused-prefixes --implicit- check-not=error --implicit-check-not=warning
34
+ // RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
29
35
30
36
// Test that the following options are still gated on -fptrauth-calls.
31
37
// If they are not, in assertion builds they would usually fail at asm printing time:
32
38
//
33
39
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-init-fini 2>&1 \
34
- // RUN: | FileCheck %s --check-prefix=WARN -DOPTION=-fptrauth-init-fini
40
+ // RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-init-fini
35
41
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-function-pointer-type-discrimination 2>&1 \
36
- // RUN: | FileCheck %s --check-prefix=WARN -DOPTION=-fptrauth-function-pointer-type-discrimination
42
+ // RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-function-pointer-type-discrimination
37
43
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-address-discrimination 2>&1 \
38
- // RUN: | FileCheck %s --check-prefix=WARN -DOPTION=-fptrauth-vtable-pointer-address-discrimination
44
+ // RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-vtable-pointer-address-discrimination
39
45
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-type-discrimination 2>&1 \
40
- // RUN: | FileCheck %s --check-prefix=WARN -DOPTION=-fptrauth-vtable-pointer-type-discrimination
46
+ // RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-vtable-pointer-type-discrimination
41
47
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-block-descriptor-pointers -fblocks -DBLOCKS 2>&1 \
42
- // RUN: | FileCheck %s --check-prefix=WARN -DOPTION=-fptrauth-block-descriptor-pointers
48
+ // RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-block-descriptor-pointers
43
49
44
50
// Test that v8.2-compatible code is generated, if possible:
45
51
//
46
- // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -msign-return-address=all 2>&1 | FileCheck %s --check-prefix=COMPAT
47
- // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret 2>&1 | FileCheck %s --check-prefix=COMPAT
48
- // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret+b-key 2>&1 | FileCheck %s --check-prefix=COMPAT
52
+ // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -msign-return-address=all 2>&1 \
53
+ // RUN: | FileCheck %s --check-prefix=COMPAT
54
+ // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret 2>&1 \
55
+ // RUN: | FileCheck %s --check-prefix=COMPAT
56
+ // RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret+b-key 2>&1 \
57
+ // RUN: | FileCheck %s --check-prefix=COMPAT
49
58
50
59
// arm64e has ptrauth enabled and assumes modern enough CPU by default:
51
60
//
52
- // RUN: %clang %s -S -o - -target arm64e-apple-ios 2>&1 | FileCheck %s --check-prefix=PAUTH
53
- // RUN: not %clang %s -S -o - -target arm64e-apple-ios -mcpu=cortex-a72 2>&1 | FileCheck %s --check-prefix=FAIL
61
+ // RUN: %clang %s -S -o - -target arm64e-apple-ios 2>&1 \
62
+ // RUN: | FileCheck %s --check-prefix=PAUTH
63
+ // RUN: not %clang %s -S -o - -target arm64e-apple-ios -mcpu=cortex-a72 2>&1 \
64
+ // RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,FAIL-CALLS,FAIL-RETURNS,FAIL-OBJC-ISA,NO-UNEXPECTED
54
65
55
66
volatile int counter;
56
67
57
68
void ext (void );
58
69
59
70
// Basically check the code generated for `caller`, other functions and classes
60
- // are provided just to ensure that assertion-enabled builds do not crash when
71
+ // are provided just to check that assertion-enabled builds do not crash when
61
72
// generating code for constructors, vtable, etc.
62
73
63
74
extern " C" int caller (void ) {
@@ -103,11 +114,13 @@ extern "C" void *create(bool f) {
103
114
return new Derived ();
104
115
}
105
116
106
- // FIXME At now, the error message is printed twice.
107
- // Ideally, this should be fixed, but it seems rather harmless.
108
- //
109
- // FAIL-COUNT-2: error: neither FEAT_PAUTH nor -fptrauth-soft is enabled. Most of PAuth features are unavailable
110
- // WARN-COUNT-2: warning: [[OPTION]] is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified
117
+ // NO-PTRAUTH-CALLS: warning: [[OPTION]] is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified
118
+ // FAIL-INTRINSICS: error: -fptrauth-intrinsics or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
119
+ // FAIL-CALLS: error: -fptrauth-calls or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
120
+ // FAIL-RETURNS: error: -fptrauth-returns or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
121
+ // FAIL-OBJC-ISA: error: -fptrauth-objc-isa=... or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
122
+ // NO-UNEXPECTED-NOT: error:
123
+ // NO-UNEXPECTED-NOT: warning:
111
124
112
125
// COMPAT: caller:
113
126
// COMPAT: hint {{#25|#27}}
@@ -125,8 +138,8 @@ extern "C" void *create(bool f) {
125
138
// Just check that some assembler output is printed and -fptrauth-init-fini
126
139
// is disabled.
127
140
//
128
- // WARN -NOT: @AUTH
141
+ // NO-PTRAUTH-CALLS -NOT: @AUTH
129
142
//
130
- // WARN : caller:
143
+ // NO-PTRAUTH-CALLS : caller:
131
144
//
132
- // WARN -NOT: @AUTH
145
+ // NO-PTRAUTH-CALLS -NOT: @AUTH
0 commit comments