|
4 | 4 | // NONE: "-cc1" |
5 | 5 | // NONE-NOT: "-fptrauth- |
6 | 6 |
|
7 | | -// RUN: %clang -### -c --target=aarch64 \ |
| 7 | +//// -fptauth-* driver flags on Linux are only supported with pauthtest ABI. |
| 8 | +// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest \ |
8 | 9 | // RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ |
9 | 10 | // RUN: -fno-ptrauth-calls -fptrauth-calls \ |
10 | 11 | // RUN: -fno-ptrauth-returns -fptrauth-returns \ |
|
15 | 16 | // RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ |
16 | 17 | // RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ |
17 | 18 | // RUN: -fno-ptrauth-init-fini-address-discrimination -fptrauth-init-fini-address-discrimination \ |
| 19 | +// RUN: -fno-ptrauth-elf-got -fptrauth-elf-got \ |
18 | 20 | // 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" |
| 21 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-LINUX-PAUTHABI |
| 22 | +// RUN: %clang -### -c --target=aarch64-linux-pauthtest \ |
| 23 | +// RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ |
| 24 | +// RUN: -fno-ptrauth-calls -fptrauth-calls \ |
| 25 | +// RUN: -fno-ptrauth-returns -fptrauth-returns \ |
| 26 | +// RUN: -fno-ptrauth-auth-traps -fptrauth-auth-traps \ |
| 27 | +// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-address-discrimination \ |
| 28 | +// RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
| 29 | +// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fptrauth-type-info-vtable-pointer-discrimination \ |
| 30 | +// RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ |
| 31 | +// RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \ |
| 32 | +// RUN: -fno-ptrauth-init-fini-address-discrimination -fptrauth-init-fini-address-discrimination \ |
| 33 | +// RUN: -fno-ptrauth-elf-got -fptrauth-elf-got \ |
| 34 | +// RUN: -fno-aarch64-jump-table-hardening -faarch64-jump-table-hardening \ |
| 35 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-LINUX-PAUTHABI |
| 36 | +// ALL-LINUX-PAUTHABI: "-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" "-fptrauth-elf-got"{{.*}} "-faarch64-jump-table-hardening" |
| 37 | + |
| 38 | +// RUN: %clang -### -c --target=aarch64-linux \ |
| 39 | +// RUN: -fno-aarch64-jump-table-hardening -faarch64-jump-table-hardening \ |
| 40 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-LINUX |
| 41 | +// ALL-LINUX: "-cc1"{{.*}} "-faarch64-jump-table-hardening" |
| 42 | + |
| 43 | +//// Some -fptrauth-* flags are supported for ARM64 Darwin. |
| 44 | +// RUN: %clang -### -c --target=arm64-darwin \ |
| 45 | +// RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \ |
| 46 | +// RUN: -fno-ptrauth-calls -fptrauth-calls \ |
| 47 | +// RUN: -fno-ptrauth-returns -fptrauth-returns \ |
| 48 | +// RUN: -fno-ptrauth-auth-traps -fptrauth-auth-traps \ |
| 49 | +// RUN: -fno-ptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-address-discrimination \ |
| 50 | +// RUN: -fno-ptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
| 51 | +// RUN: -fno-ptrauth-type-info-vtable-pointer-discrimination -fptrauth-type-info-vtable-pointer-discrimination \ |
| 52 | +// RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \ |
| 53 | +// RUN: -fno-aarch64-jump-table-hardening -faarch64-jump-table-hardening \ |
| 54 | +// RUN: %s 2>&1 | FileCheck %s --check-prefix=ALL-DARWIN |
| 55 | +// 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 | 56 |
|
22 | 57 | // RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
23 | 58 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1 |
|
40 | 75 | // RUN: -fno-aarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
41 | 76 |
|
42 | 77 | //// 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) |
| 78 | +//// An error about unsupported ABI will be emitted later in pipeline (see ERR3 below) |
44 | 79 | // RUN: %clang -### -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2 |
45 | 80 |
|
46 | 81 | // PAUTHABI2: "-cc1" |
|
55 | 90 | // PAUTHABI3-NOT: "-fptrauth- |
56 | 91 | // PAUTHABI3-NOT: "-faarch64-jump-table-hardening" |
57 | 92 |
|
58 | | -// RUN: not %clang -### -c --target=x86_64 -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
| 93 | +//// Non-pauthtest ABI. |
| 94 | +// RUN: not %clang -### -c --target=aarch64-linux -fptrauth-intrinsics -fptrauth-calls -fptrauth-returns -fptrauth-auth-traps \ |
59 | 95 | // RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \ |
60 | 96 | // RUN: -fptrauth-type-info-vtable-pointer-discrimination -fptrauth-indirect-gotos -fptrauth-init-fini \ |
61 | | -// RUN: -fptrauth-init-fini-address-discrimination -faarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=ERR1 |
| 97 | +// RUN: -fptrauth-init-fini-address-discrimination -fptrauth-elf-got %s 2>&1 | FileCheck %s --check-prefix=ERR1 |
62 | 98 | // ERR1: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}' |
63 | 99 | // ERR1-NEXT: error: unsupported option '-fptrauth-calls' for target '{{.*}}' |
64 | 100 | // ERR1-NEXT: error: unsupported option '-fptrauth-returns' for target '{{.*}}' |
|
69 | 105 | // ERR1-NEXT: error: unsupported option '-fptrauth-indirect-gotos' for target '{{.*}}' |
70 | 106 | // ERR1-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}' |
71 | 107 | // ERR1-NEXT: error: unsupported option '-fptrauth-init-fini-address-discrimination' for target '{{.*}}' |
72 | | -// ERR1-NEXT: error: unsupported option '-faarch64-jump-table-hardening' for target '{{.*}}' |
| 108 | +// ERR1-NEXT: error: unsupported option '-fptrauth-elf-got' for target '{{.*}}' |
73 | 109 |
|
| 110 | +//// Non-AArch64. |
| 111 | +// RUN: not %clang -### -c --target=x86_64-linux -faarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=ERR2 |
| 112 | +// ERR2: error: unsupported option '-faarch64-jump-table-hardening' for target '{{.*}}' |
| 113 | + |
| 114 | +//// Only support PAuth ABI for Linux as for now. |
| 115 | +// RUN: not %clang -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR3 |
| 116 | +// ERR3: error: unknown target ABI 'pauthtest' |
74 | 117 |
|
75 | | -// RUN: not %clang -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR2 |
76 | 118 | //// The ABI is not specified explicitly, and for non-Linux pauthtest environment does not correspond |
77 | 119 | //// to pauthtest ABI (each OS target defines this behavior separately). Do not emit an error. |
78 | | -// RUN: %clang -c --target=aarch64-pauthtest %s -o /dev/null |
79 | | -// ERR2: error: unknown target ABI 'pauthtest' |
| 120 | +// RUN: %clang -c --target=aarch64-pauthtest %s -o /dev/null |
80 | 121 |
|
81 | 122 | //// 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' |
| 123 | +// RUN: not %clang -### -c --target=aarch64-linux-gnu -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR4 |
| 124 | +// ERR4: error: unsupported option '-mabi=pauthtest' for target 'aarch64-unknown-linux-gnu' |
84 | 125 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest -mabi=pauthtest %s |
85 | 126 |
|
86 | 127 | //// The only branch protection option compatible with PAuthABI is BTI. |
87 | 128 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
88 | | -// RUN: FileCheck %s --check-prefix=ERR4_1 |
| 129 | +// RUN: FileCheck %s --check-prefix=ERR5_1 |
89 | 130 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=pac-ret %s 2>&1 | \ |
90 | | -// RUN: FileCheck %s --check-prefix=ERR4_1 |
| 131 | +// RUN: FileCheck %s --check-prefix=ERR5_1 |
91 | 132 | // RUN: not %clang -### -c --target=aarch64 -fptrauth-returns -mbranch-protection=pac-ret %s 2>&1 | \ |
92 | | -// RUN: FileCheck %s --check-prefix=ERR4_2 |
93 | | -// ERR4_1: error: unsupported option '-mbranch-protection=pac-ret' for target 'aarch64-unknown-linux-pauthtest' |
94 | | -// ERR4_2: error: the combination of '-mbranch-protection=pac-ret' and '-fptrauth-returns' is incompatible |
| 133 | +// RUN: FileCheck %s --check-prefix=ERR5_2 |
| 134 | +// ERR5_1: error: unsupported option '-mbranch-protection=pac-ret' for target 'aarch64-unknown-linux-pauthtest' |
| 135 | +// ERR5_2: error: the combination of '-mbranch-protection=pac-ret' and '-fptrauth-returns' is incompatible |
95 | 136 |
|
96 | 137 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
97 | | -// RUN: FileCheck %s --check-prefix=ERR5_1 |
| 138 | +// RUN: FileCheck %s --check-prefix=ERR6_1 |
98 | 139 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=gcs %s 2>&1 | \ |
99 | | -// RUN: FileCheck %s --check-prefix=ERR5_1 |
| 140 | +// RUN: FileCheck %s --check-prefix=ERR6_1 |
100 | 141 | // RUN: not %clang -### -c --target=aarch64 -fptrauth-returns -mbranch-protection=gcs %s 2>&1 | \ |
101 | | -// RUN: FileCheck %s --check-prefix=ERR5_2 |
102 | | -// ERR5_1: error: unsupported option '-mbranch-protection=gcs' for target 'aarch64-unknown-linux-pauthtest' |
103 | | -// ERR5_2: error: the combination of '-mbranch-protection=gcs' and '-fptrauth-returns' is incompatible |
| 142 | +// RUN: FileCheck %s --check-prefix=ERR6_2 |
| 143 | +// ERR6_1: error: unsupported option '-mbranch-protection=gcs' for target 'aarch64-unknown-linux-pauthtest' |
| 144 | +// ERR6_2: error: the combination of '-mbranch-protection=gcs' and '-fptrauth-returns' is incompatible |
104 | 145 |
|
105 | 146 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -mbranch-protection=standard %s 2>&1 | \ |
106 | | -// RUN: FileCheck %s --check-prefix=ERR6_1 |
| 147 | +// RUN: FileCheck %s --check-prefix=ERR7_1 |
107 | 148 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -mbranch-protection=standard %s 2>&1 | \ |
108 | | -// RUN: FileCheck %s --check-prefix=ERR6_1 |
| 149 | +// RUN: FileCheck %s --check-prefix=ERR7_1 |
109 | 150 | // RUN: not %clang -### -c --target=aarch64 -fptrauth-returns -mbranch-protection=standard %s 2>&1 | \ |
110 | | -// RUN: FileCheck %s --check-prefix=ERR6_2 |
111 | | -// ERR6_1: error: unsupported option '-mbranch-protection=standard' for target 'aarch64-unknown-linux-pauthtest' |
112 | | -// ERR6_2: error: the combination of '-mbranch-protection=standard' and '-fptrauth-returns' is incompatible |
| 151 | +// RUN: FileCheck %s --check-prefix=ERR7_2 |
| 152 | +// ERR7_1: error: unsupported option '-mbranch-protection=standard' for target 'aarch64-unknown-linux-pauthtest' |
| 153 | +// ERR7_2: error: the combination of '-mbranch-protection=standard' and '-fptrauth-returns' is incompatible |
113 | 154 |
|
114 | 155 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=all %s 2>&1 | \ |
115 | | -// RUN: FileCheck %s --check-prefix=ERR7 |
| 156 | +// RUN: FileCheck %s --check-prefix=ERR8 |
116 | 157 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=all %s 2>&1 | \ |
117 | | -// RUN: FileCheck %s --check-prefix=ERR7 |
118 | | -// ERR7: error: unsupported option '-msign-return-address=all' for target 'aarch64-unknown-linux-pauthtest' |
| 158 | +// RUN: FileCheck %s --check-prefix=ERR8 |
| 159 | +// ERR8: error: unsupported option '-msign-return-address=all' for target 'aarch64-unknown-linux-pauthtest' |
119 | 160 |
|
120 | 161 | // RUN: not %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
121 | | -// RUN: FileCheck %s --check-prefix=ERR8 |
| 162 | +// RUN: FileCheck %s --check-prefix=ERR9 |
122 | 163 | // RUN: not %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=non-leaf %s 2>&1 | \ |
123 | | -// RUN: FileCheck %s --check-prefix=ERR8 |
124 | | -// ERR8: error: unsupported option '-msign-return-address=non-leaf' for target 'aarch64-unknown-linux-pauthtest' |
| 164 | +// RUN: FileCheck %s --check-prefix=ERR9 |
| 165 | +// ERR9: error: unsupported option '-msign-return-address=non-leaf' for target 'aarch64-unknown-linux-pauthtest' |
125 | 166 |
|
126 | 167 | // RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=none %s |
127 | 168 | // RUN: %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=none %s |
|
0 commit comments