Skip to content

Commit 92e1ce3

Browse files
kovdan01aokblast
authored andcommitted
[PAC][Driver] Support ptrauth flags only on ARM64 Darwin or with pauthtest ABI (llvm#113152)
Most ptrauth flags are ABI-affecting, so usually we do not want them to be exposed to end users. Allow them only in the following cases: - ARM64 Darwin (under certain conditions, some ptrauth driver flags are intended to be used in this case); - pauthtest ABI (it's intended to be used for experimenting with signing schema and the signing schema is explicitly encoded in the pauth elf marking). Leave `-faarch64-jump-table-hardening` available for all AArch64 targets since it's not ABI-affecting.
1 parent 4789dcb commit 92e1ce3

File tree

3 files changed

+123
-69
lines changed

3 files changed

+123
-69
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,17 +1414,18 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
14141414
GuardedControlStack = PBP.GuardedControlStack;
14151415
}
14161416

1417-
bool HasPtrauthReturns = llvm::any_of(CmdArgs, [](const char *Arg) {
1418-
return StringRef(Arg) == "-fptrauth-returns";
1419-
});
1417+
Arg *PtrauthReturnsArg = Args.getLastArg(options::OPT_fptrauth_returns,
1418+
options::OPT_fno_ptrauth_returns);
1419+
bool HasPtrauthReturns =
1420+
PtrauthReturnsArg &&
1421+
PtrauthReturnsArg->getOption().matches(options::OPT_fptrauth_returns);
14201422
// GCS is currently untested with ptrauth-returns, but enabling this could be
14211423
// allowed in future after testing with a suitable system.
1422-
if (HasPtrauthReturns &&
1423-
(Scope != "none" || BranchProtectionPAuthLR || GuardedControlStack)) {
1424+
if (Scope != "none" || BranchProtectionPAuthLR || GuardedControlStack) {
14241425
if (Triple.getEnvironment() == llvm::Triple::PAuthTest)
14251426
D.Diag(diag::err_drv_unsupported_opt_for_target)
14261427
<< A->getAsString(Args) << Triple.getTriple();
1427-
else
1428+
else if (HasPtrauthReturns)
14281429
D.Diag(diag::err_drv_incompatible_options)
14291430
<< A->getAsString(Args) << "-fptrauth-returns";
14301431
}
@@ -1670,34 +1671,42 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
16701671

16711672
AddUnalignedAccessWarning(CmdArgs);
16721673

1673-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_intrinsics,
1674-
options::OPT_fno_ptrauth_intrinsics);
1675-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_calls,
1676-
options::OPT_fno_ptrauth_calls);
1677-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_returns,
1678-
options::OPT_fno_ptrauth_returns);
1679-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_auth_traps,
1680-
options::OPT_fno_ptrauth_auth_traps);
1681-
Args.addOptInFlag(
1682-
CmdArgs, options::OPT_fptrauth_vtable_pointer_address_discrimination,
1683-
options::OPT_fno_ptrauth_vtable_pointer_address_discrimination);
1684-
Args.addOptInFlag(
1685-
CmdArgs, options::OPT_fptrauth_vtable_pointer_type_discrimination,
1686-
options::OPT_fno_ptrauth_vtable_pointer_type_discrimination);
1687-
Args.addOptInFlag(
1688-
CmdArgs, options::OPT_fptrauth_type_info_vtable_pointer_discrimination,
1689-
options::OPT_fno_ptrauth_type_info_vtable_pointer_discrimination);
1690-
Args.addOptInFlag(
1691-
CmdArgs, options::OPT_fptrauth_function_pointer_type_discrimination,
1692-
options::OPT_fno_ptrauth_function_pointer_type_discrimination);
1693-
1694-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_indirect_gotos,
1695-
options::OPT_fno_ptrauth_indirect_gotos);
1696-
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_init_fini,
1697-
options::OPT_fno_ptrauth_init_fini);
1698-
Args.addOptInFlag(CmdArgs,
1699-
options::OPT_fptrauth_init_fini_address_discrimination,
1700-
options::OPT_fno_ptrauth_init_fini_address_discrimination);
1674+
if (Triple.isOSDarwin() ||
1675+
(Triple.isOSLinux() &&
1676+
Triple.getEnvironment() == llvm::Triple::PAuthTest)) {
1677+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_intrinsics,
1678+
options::OPT_fno_ptrauth_intrinsics);
1679+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_calls,
1680+
options::OPT_fno_ptrauth_calls);
1681+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_returns,
1682+
options::OPT_fno_ptrauth_returns);
1683+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_auth_traps,
1684+
options::OPT_fno_ptrauth_auth_traps);
1685+
Args.addOptInFlag(
1686+
CmdArgs, options::OPT_fptrauth_vtable_pointer_address_discrimination,
1687+
options::OPT_fno_ptrauth_vtable_pointer_address_discrimination);
1688+
Args.addOptInFlag(
1689+
CmdArgs, options::OPT_fptrauth_vtable_pointer_type_discrimination,
1690+
options::OPT_fno_ptrauth_vtable_pointer_type_discrimination);
1691+
Args.addOptInFlag(
1692+
CmdArgs, options::OPT_fptrauth_type_info_vtable_pointer_discrimination,
1693+
options::OPT_fno_ptrauth_type_info_vtable_pointer_discrimination);
1694+
Args.addOptInFlag(
1695+
CmdArgs, options::OPT_fptrauth_function_pointer_type_discrimination,
1696+
options::OPT_fno_ptrauth_function_pointer_type_discrimination);
1697+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_indirect_gotos,
1698+
options::OPT_fno_ptrauth_indirect_gotos);
1699+
}
1700+
if (Triple.isOSLinux() &&
1701+
Triple.getEnvironment() == llvm::Triple::PAuthTest) {
1702+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_init_fini,
1703+
options::OPT_fno_ptrauth_init_fini);
1704+
Args.addOptInFlag(
1705+
CmdArgs, options::OPT_fptrauth_init_fini_address_discrimination,
1706+
options::OPT_fno_ptrauth_init_fini_address_discrimination);
1707+
Args.addOptInFlag(CmdArgs, options::OPT_fptrauth_elf_got,
1708+
options::OPT_fno_ptrauth_elf_got);
1709+
}
17011710
Args.addOptInFlag(CmdArgs, options::OPT_faarch64_jump_table_hardening,
17021711
options::OPT_fno_aarch64_jump_table_hardening);
17031712

clang/test/Driver/aarch64-ptrauth.c

Lines changed: 74 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// NONE: "-cc1"
55
// NONE-NOT: "-fptrauth-
66

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 \
89
// RUN: -fno-ptrauth-intrinsics -fptrauth-intrinsics \
910
// RUN: -fno-ptrauth-calls -fptrauth-calls \
1011
// RUN: -fno-ptrauth-returns -fptrauth-returns \
@@ -15,9 +16,43 @@
1516
// RUN: -fno-ptrauth-indirect-gotos -fptrauth-indirect-gotos \
1617
// RUN: -fno-ptrauth-init-fini -fptrauth-init-fini \
1718
// RUN: -fno-ptrauth-init-fini-address-discrimination -fptrauth-init-fini-address-discrimination \
19+
// RUN: -fno-ptrauth-elf-got -fptrauth-elf-got \
1820
// 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"
2156

2257
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1
2358
// RUN: %clang -### -c --target=aarch64-linux-pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI1
@@ -40,7 +75,7 @@
4075
// RUN: -fno-aarch64-jump-table-hardening %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2
4176

4277
//// 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)
4479
// RUN: %clang -### -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=PAUTHABI2
4580

4681
// PAUTHABI2: "-cc1"
@@ -55,10 +90,11 @@
5590
// PAUTHABI3-NOT: "-fptrauth-
5691
// PAUTHABI3-NOT: "-faarch64-jump-table-hardening"
5792

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 \
5995
// RUN: -fptrauth-vtable-pointer-address-discrimination -fptrauth-vtable-pointer-type-discrimination \
6096
// 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
6298
// ERR1: error: unsupported option '-fptrauth-intrinsics' for target '{{.*}}'
6399
// ERR1-NEXT: error: unsupported option '-fptrauth-calls' for target '{{.*}}'
64100
// ERR1-NEXT: error: unsupported option '-fptrauth-returns' for target '{{.*}}'
@@ -69,59 +105,64 @@
69105
// ERR1-NEXT: error: unsupported option '-fptrauth-indirect-gotos' for target '{{.*}}'
70106
// ERR1-NEXT: error: unsupported option '-fptrauth-init-fini' for target '{{.*}}'
71107
// 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 '{{.*}}'
73109

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'
74117

75-
// RUN: not %clang -c --target=aarch64 -mabi=pauthtest %s 2>&1 | FileCheck %s --check-prefix=ERR2
76118
//// The ABI is not specified explicitly, and for non-Linux pauthtest environment does not correspond
77119
//// 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
80121

81122
//// 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'
84125
// RUN: %clang -### -c --target=aarch64-linux-pauthtest -mabi=pauthtest %s
85126

86127
//// The only branch protection option compatible with PAuthABI is BTI.
87128
// 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
89130
// 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
91132
// 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
95136

96137
// 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
98139
// 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
100141
// 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
104145

105146
// 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
107148
// 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
109150
// 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
113154

114155
// 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
116157
// 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'
119160

120161
// 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
122163
// 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'
125166

126167
// RUN: %clang -### -c --target=aarch64-linux -mabi=pauthtest -msign-return-address=none %s
127168
// RUN: %clang -### -c --target=aarch64-linux-pauthtest -msign-return-address=none %s

clang/test/Frontend/aarch64-ignore-branch-protection-attribute.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
// REQUIRES: aarch64-registered-target
22

3-
// RUN: %clang -target aarch64-linux-pauthtest %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s
4-
// RUN: %clang -target aarch64 -fptrauth-returns %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s
3+
// RUN: %clang -target aarch64-linux-pauthtest %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: %s
4+
// RUN: not %clang -target aarch64 -fptrauth-returns %s -S -emit-llvm -o - 2>&1 | FileCheck --implicit-check-not=warning: --check-prefix=PTRAUTH-RETURNS %s
5+
6+
// Clang fails early, no LLVM IR output produced.
7+
// PTRAUTH-RETURNS: clang: error: unsupported option '-fptrauth-returns' for target 'aarch64'
8+
// PTRAUTH-RETURNS-NOT: attributes
59

610
/// Unsupported with pauthtest, warning emitted
711
__attribute__((target("branch-protection=pac-ret"))) void f1() {}

0 commit comments

Comments
 (0)