|
4 | 4 | // NONE: "-cc1" |
5 | 5 | // NONE-NOT: "-fptrauth- |
6 | 6 |
|
7 | | -// RUN: %clang -### -c --target=aarch64 \ |
| 7 | +// RUN: %clang -### -c --target=aarch64-linux \ |
| 8 | +// RUN: -fno-aarch64-jump-table-hardening -faarch64-jump-table-hardening \ |
| 9 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-LINUX |
| 10 | +// ALL-LINUX: "-cc1"{{.*}} "-faarch64-jump-table-hardening" |
| 11 | + |
| 12 | +// RUN: %clang -### -c --target=arm64-darwin \ |
8 | 13 | // RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ |
9 | 14 | // RUN: -fno-ptrauth-calls -fptrauth-calls \ |
10 | 15 | // RUN: -fno-ptrauth-returns -fptrauth-returns \ |
|
13 | 18 | // RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
14 | 19 | // RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fptrauth-type-info-vtable-pointer-discrimination \ |
15 | 20 | // RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ |
16 | | -// RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ |
17 | | -// RUN: -fno-ptrauth-init-fini-address-discrimination -fptrauth-init-fini-address-discrimination \ |
18 | 21 | // RUN: -fno-aarch64-jump-table-hardening -faarch64-jump-table-hardening \ |
19 | | -// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL |
20 | | -// ALL: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-type-info-vtable-pointer-discrimination" "-fptrauth-indirect-gotos" "-fptrauth-init-fini" "-fptrauth-init-fini-address-discrimination" "-faarch64-jump-table-hardening" |
| 22 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-DARWIN |
| 23 | +// ALL-DARWIN: "-cc1"{{.*}} "-fptrauth-intrinsics" "-fptrauth-calls" "-fptrauth-returns" "-fptrauth-auth-traps" "-fptrauth-vtable-pointer-address-discrimination" "-fptrauth-vtable-pointer-type-discrimination" "-fptrauth-type-info-vtable-pointer-discrimination" "-fptrauth-indirect-gotos"{{.*}} "-faarch64-jump-table-hardening" |
21 | 24 |
|
22 | 25 | // RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
23 | 26 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
|
26 | 29 | // PAUTHABI1-SAME: "-target-abi" "pauthtest" |
27 | 30 | // PAUTHABI1-NOT: "-fptrauth-function-pointer-type-discrimination" |
28 | 31 |
|
29 | | -// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -fno-ptrauth-intrinsics \ |
30 | | -// RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ |
31 | | -// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ |
32 | | -// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fno-ptrauth-indirect-gotos \ |
33 | | -// RUN: -fno-ptrauth-init-fini -fno-ptrauth-init-fini-address-discrimination \ |
| 32 | +// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest \ |
34 | 33 | // RUN: -fno-aarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
35 | | -// RUN: %clang -### -c --target=aarch64-linux-pauthtest -fno-ptrauth-intrinsics \ |
36 | | -// RUN: -fno-ptrauth-calls -fno-ptrauth-returns -fno-ptrauth-auth-traps \ |
37 | | -// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fno-ptrauth-vtable-pointer-type-discrimination \ |
38 | | -// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fno-ptrauth-indirect-gotos \ |
39 | | -// RUN: -fno-ptrauth-init-fini -fno-ptrauth-init-fini-address-discrimination \ |
| 34 | +// RUN: %clang -### -c --target=aarch64-linux-pauthtest \ |
40 | 35 | // RUN: -fno-aarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
41 | 36 |
|
42 | 37 | //// Non-linux OS: pauthtest ABI has no effect in terms of passing ptrauth cc1 flags. |
43 | | -//// An error about unsupported ABI will be emitted later in pipeline (see ERR2 below) |
44 | | -// RUN: %clang -### -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
| 38 | +//// An error about unsupported ABI will be emitted later in pipeline (see ERR3 below) |
| 39 | +// RUN: %clang -### -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefixes=PAUTHABI2,PAUTHABI3 |
45 | 40 |
|
46 | 41 | // PAUTHABI2: "-cc1" |
47 | 42 | // PAUTHABI2-SAME: "-target-abi" "pauthtest" |
48 | | -// PAUTHABI2-NOT: "-fptrauth- |
| 43 | +// PAUTHABI3-NOT: "-fptrauth- |
49 | 44 | // PAUTHABI2-NOT: "-faarch64-jump-table-hardening" |
50 | 45 |
|
51 | 46 | //// Non-linux OS: pauthtest environment does not correspond to pauthtest ABI; aapcs is the default. |
52 | | -// RUN: %clang -### -c --target=aarch64-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI3 |
53 | | -// PAUTHABI3: "-cc1" |
54 | | -// PAUTHABI3-SAME: "-target-abi" "aapcs" |
55 | | -// PAUTHABI3-NOT: "-fptrauth- |
56 | | -// PAUTHABI3-NOT: "-faarch64-jump-table-hardening" |
57 | | - |
58 | | -// RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
| 47 | +// RUN: %clang -### -c --target=aarch64-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI4 |
| 48 | +// PAUTHABI4: "-cc1" |
| 49 | +// PAUTHABI4-SAME: "-target-abi" "aapcs" |
| 50 | +// PAUTHABI4-NOT: "-fptrauth- |
| 51 | +// PAUTHABI4-NOT: "-faarch64-jump-table-hardening" |
| 52 | + |
| 53 | +//// Non-AArch64. |
| 54 | +// RUN: not %clang -### -c --target=x86_64-linux -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
| 55 | +// RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
| 56 | +// RUN: -fptrauth-type-info-vtable-pointer-discrimination -fptrauth-indirect-gotos -fptrauth-init-fini \ |
| 57 | +// RUN: -fptrauth-init-fini-address-discrimination -faarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefixes=ERR1,ERR2 |
| 58 | +//// Non-linux and non-Darwin OS. |
| 59 | +// RUN: not %clang -### -c --target=aarch64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
59 | 60 | // RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
60 | 61 | // RUN: -fptrauth-type-info-vtable-pointer-discrimination -fptrauth-indirect-gotos -fptrauth-init-fini \ |
61 | 62 | // RUN: -fptrauth-init-fini-address-discrimination -faarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=ERR1 |
|
69 | 70 | // ERR1-NEXT: error: unsupported option '-fptrauth-indirect-gotos' for target '{{.*}}' |
70 | 71 | // ERR1-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}' |
71 | 72 | // ERR1-NEXT: error: unsupported option '-fptrauth-init-fini-address-discrimination' for target '{{.*}}' |
72 | | -// ERR1-NEXT: error: unsupported option '-faarch64-jump-table-hardening' for target '{{.*}}' |
| 73 | +// ERR2-NEXT: error: unsupported option '-faarch64-jump-table-hardening' for target '{{.*}}' |
73 | 74 |
|
74 | 75 |
|
75 | | -// RUN: not %clang -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR2 |
| 76 | +// RUN: not %clang -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR3 |
76 | 77 | //// The ABI is not specified explicitly, and for non-Linux pauthtest environment does not correspond |
77 | 78 | //// to pauthtest ABI (each OS target defines this behavior separately). Do not emit an error. |
78 | 79 | // RUN: %clang -c --target=aarch64-pauthtest %s -o /dev/null |
79 | | -// ERR2: error: unknown target ABI 'pauthtest' |
| 80 | +// ERR3: error: unknown target ABI 'pauthtest' |
80 | 81 |
|
81 | 82 | //// PAuth ABI is encoded as environment part of the triple, so don't allow to explicitly set other environments. |
82 | | -// RUN: not %clang -### -c --target=aarch64-linux-gnu -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR3 |
83 | | -// ERR3: error: unsupported option '-mabi=pauthtest' for target 'aarch64-unknown-linux-gnu' |
| 83 | +// RUN: not %clang -### -c --target=aarch64-linux-gnu -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR4 |
| 84 | +// ERR4: error: unsupported option '-mabi=pauthtest' for target 'aarch64-unknown-linux-gnu' |
84 | 85 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest -mabi=pauthtest %s |
85 | 86 |
|
86 | 87 | //// The only branch protection option compatible with PAuthABI is BTI. |
87 | 88 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
88 | | -// RUN: FileCheck %s --check-prefix=ERR4 |
| 89 | +// RUN: FileCheck %s --check-prefix=ERR5 |
89 | 90 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
90 | | -// RUN: FileCheck %s --check-prefix=ERR4 |
91 | | -// ERR4: error: unsupported option '-mbranch-protection=pac-ret' for target 'aarch64-unknown-linux-pauthtest' |
| 91 | +// RUN: FileCheck %s --check-prefix=ERR5 |
| 92 | +// ERR5: error: unsupported option '-mbranch-protection=pac-ret' for target 'aarch64-unknown-linux-pauthtest' |
92 | 93 |
|
93 | 94 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
94 | | -// RUN: FileCheck %s --check-prefix=ERR5 |
| 95 | +// RUN: FileCheck %s --check-prefix=ERR6 |
95 | 96 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
96 | | -// RUN: FileCheck %s --check-prefix=ERR5 |
97 | | -// ERR5: error: unsupported option '-mbranch-protection=gcs' for target 'aarch64-unknown-linux-pauthtest' |
| 97 | +// RUN: FileCheck %s --check-prefix=ERR6 |
| 98 | +// ERR6: error: unsupported option '-mbranch-protection=gcs' for target 'aarch64-unknown-linux-pauthtest' |
98 | 99 |
|
99 | 100 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=standard %s 2>&1 | \ |
100 | | -// RUN: FileCheck %s --check-prefix=ERR6 |
| 101 | +// RUN: FileCheck %s --check-prefix=ERR7 |
101 | 102 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=standard %s 2>&1 | \ |
102 | | -// RUN: FileCheck %s --check-prefix=ERR6 |
103 | | -// ERR6: error: unsupported option '-mbranch-protection=standard' for target 'aarch64-unknown-linux-pauthtest' |
| 103 | +// RUN: FileCheck %s --check-prefix=ERR7 |
| 104 | +// ERR7: error: unsupported option '-mbranch-protection=standard' for target 'aarch64-unknown-linux-pauthtest' |
104 | 105 |
|
105 | 106 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=all %s 2>&1 | \ |
106 | | -// RUN: FileCheck %s --check-prefix=ERR7 |
| 107 | +// RUN: FileCheck %s --check-prefix=ERR8 |
107 | 108 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=all %s 2>&1 | \ |
108 | | -// RUN: FileCheck %s --check-prefix=ERR7 |
109 | | -// ERR7: error: unsupported option '-msign-return-address=all' for target 'aarch64-unknown-linux-pauthtest' |
| 109 | +// RUN: FileCheck %s --check-prefix=ERR8 |
| 110 | +// ERR8: error: unsupported option '-msign-return-address=all' for target 'aarch64-unknown-linux-pauthtest' |
110 | 111 |
|
111 | 112 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
112 | | -// RUN: FileCheck %s --check-prefix=ERR8 |
| 113 | +// RUN: FileCheck %s --check-prefix=ERR9 |
113 | 114 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
114 | | -// RUN: FileCheck %s --check-prefix=ERR8 |
115 | | -// ERR8: error: unsupported option '-msign-return-address=non-leaf' for target 'aarch64-unknown-linux-pauthtest' |
| 115 | +// RUN: FileCheck %s --check-prefix=ERR9 |
| 116 | +// ERR9: error: unsupported option '-msign-return-address=non-leaf' for target 'aarch64-unknown-linux-pauthtest' |
116 | 117 |
|
117 | 118 | // RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=none %s |
118 | 119 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=none %s |
|
0 commit comments