Skip to content

Commit e5dc43f

Browse files
authored
[AArch64] Error if PAuth language features are used on unsupported CPU (#66)
Check for several -fptrauth-* language features that require CPU with FEAT_PAuth support. If such unsupported feature is requested, make Clang frontend print error and exit early.
1 parent 1c0b04f commit e5dc43f

File tree

73 files changed

+334
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+334
-108
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,13 @@ def err_stack_tagging_requires_hardware_feature : Error<
532532
"'-fsanitize=memtag-stack' requires hardware support (+memtag). For Armv8 or "
533533
"Armv9, try compiling with -march=armv8a+memtag or -march=armv9a+memtag">;
534534

535+
def err_pauth_cpu_feature_missing : Error<
536+
"%0 or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option">;
537+
538+
def warn_pauth_option_ignored : Warning<
539+
"%0 is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified">,
540+
InGroup<OptionIgnored>;
541+
535542
def err_cmse_pi_are_incompatible : Error<
536543
"cmse is not compatible with %select{RWPI|ROPI}0">;
537544

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "AArch64.h"
14+
#include "clang/Basic/DiagnosticDriver.h"
1415
#include "clang/Basic/LangOptions.h"
1516
#include "clang/Basic/TargetBuiltins.h"
1617
#include "clang/Basic/TargetInfo.h"
@@ -197,6 +198,72 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
197198
Opts.EABIVersion == llvm::EABI::GNU ? "\01_mcount" : "mcount";
198199
}
199200

201+
void AArch64TargetInfo::validatePAuthOptions(DiagnosticsEngine &Diags,
202+
LangOptions &Opts) const {
203+
// AArch64TargetInfo::adjust can be called multiple times during
204+
// compilation, so unset unsupported options to prevent printing
205+
// multiple identical diagnostics.
206+
auto UnsetIgnoredOptions = [&]() {
207+
assert(!Opts.PointerAuthCalls && "Will change the behavior");
208+
Opts.PointerAuthInitFini = false;
209+
Opts.FunctionPointerTypeDiscrimination = false;
210+
Opts.PointerAuthVTPtrAddressDiscrimination = false;
211+
Opts.PointerAuthVTPtrTypeDiscrimination = false;
212+
Opts.PointerAuthBlockDescriptorPointers = false;
213+
};
214+
auto UnsetUnsupportedOptions = [&]() {
215+
assert(!HasPAuth && !Opts.SoftPointerAuth && "Will change the behavior");
216+
Opts.PointerAuthIntrinsics = false;
217+
Opts.PointerAuthCalls = false;
218+
Opts.PointerAuthReturns = false;
219+
Opts.setPointerAuthObjcIsaAuthentication(PointerAuthenticationMode::None);
220+
};
221+
222+
if (!Opts.PointerAuthCalls) {
223+
if (Opts.PointerAuthInitFini)
224+
Diags.Report(diag::warn_pauth_option_ignored) << "-fptrauth-init-fini";
225+
if (Opts.FunctionPointerTypeDiscrimination)
226+
Diags.Report(diag::warn_pauth_option_ignored)
227+
<< "-fptrauth-function-pointer-type-discrimination";
228+
if (Opts.PointerAuthVTPtrAddressDiscrimination)
229+
Diags.Report(diag::warn_pauth_option_ignored)
230+
<< "-fptrauth-vtable-pointer-address-discrimination";
231+
if (Opts.PointerAuthVTPtrTypeDiscrimination)
232+
Diags.Report(diag::warn_pauth_option_ignored)
233+
<< "-fptrauth-vtable-pointer-type-discrimination";
234+
if (Opts.PointerAuthBlockDescriptorPointers)
235+
Diags.Report(diag::warn_pauth_option_ignored)
236+
<< "-fptrauth-block-descriptor-pointers";
237+
UnsetIgnoredOptions();
238+
}
239+
240+
if (HasPAuth || Opts.SoftPointerAuth)
241+
return;
242+
243+
// FIXME: Some ptrauth_* intrinsics can be implemented by only using
244+
// HINT-encoded instructions, thus not requiring FEAT_PAUTH.
245+
// At now, checking conservatively.
246+
if (Opts.PointerAuthIntrinsics)
247+
Diags.Report(diag::err_pauth_cpu_feature_missing) << "-fptrauth-intrinsics";
248+
if (Opts.PointerAuthCalls)
249+
Diags.Report(diag::err_pauth_cpu_feature_missing) << "-fptrauth-calls";
250+
if (Opts.PointerAuthReturns)
251+
Diags.Report(diag::err_pauth_cpu_feature_missing) << "-fptrauth-returns";
252+
if (Opts.getPointerAuthObjcIsaAuthentication() !=
253+
PointerAuthenticationMode::None)
254+
Diags.Report(diag::err_pauth_cpu_feature_missing)
255+
<< "-fptrauth-objc-isa=...";
256+
257+
UnsetUnsupportedOptions();
258+
// Opts.PointerAuthCalls was unset - prevent unexpected warnings, too.
259+
UnsetIgnoredOptions();
260+
}
261+
262+
void AArch64TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
263+
TargetInfo::adjust(Diags, Opts);
264+
validatePAuthOptions(Diags, Opts);
265+
}
266+
200267
StringRef AArch64TargetInfo::getABI() const { return ABI; }
201268

202269
bool AArch64TargetInfo::setABI(const std::string &Name) {

clang/lib/Basic/Targets/AArch64.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
9191
public:
9292
AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
9393

94+
void validatePAuthOptions(DiagnosticsEngine &Diags, LangOptions &Opts) const;
95+
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override;
96+
9497
StringRef getABI() const override;
9598
bool setABI(const std::string &Name) override;
9699

clang/test/AST/ast-dump-ptrauth-json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -std=c++11 -ast-dump=json %s | FileCheck %s
22

33
// CHECK: "name": "__builtin_ptrauth_type_discriminator",
44

clang/test/CodeGen/ptrauth-authenticated-null-values.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -O0 -o - | FileCheck %s
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -emit-llvm %s -O0 -o - | FileCheck %s
22

33
typedef void *__ptrauth(2, 0, 0, "authenticates-null-values") authenticated_null;
44
typedef void *__ptrauth(2, 1, 0, "authenticates-null-values") authenticated_null_addr_disc;

clang/test/CodeGen/ptrauth-blocks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -fblocks -emit-llvm %s -o - | FileCheck %s
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -fblocks -emit-llvm %s -o - | FileCheck %s
22

33
void (^blockptr)(void);
44

clang/test/CodeGen/ptrauth-cfstr-isa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -cc1 -internal-isystem /Users/oliver/llvm-internal/debug/lib/clang/11.0.0/include -nostdsysteminc -fptrauth-calls -fptrauth-objc-isa-mode=sign-and-strip -triple arm64-apple-ios -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s
2-
// RUN: %clang_cc1 -cc1 -internal-isystem /Users/oliver/llvm-internal/debug/lib/clang/11.0.0/include -nostdsysteminc -fptrauth-calls -fptrauth-objc-isa-mode=sign-and-auth -triple arm64-apple-ios -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -cc1 -internal-isystem /Users/oliver/llvm-internal/debug/lib/clang/11.0.0/include -nostdsysteminc -fptrauth-calls -fptrauth-objc-isa-mode=sign-and-strip -triple arm64-apple-ios -target-feature +pauth -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s
2+
// RUN: %clang_cc1 -cc1 -internal-isystem /Users/oliver/llvm-internal/debug/lib/clang/11.0.0/include -nostdsysteminc -fptrauth-calls -fptrauth-objc-isa-mode=sign-and-auth -triple arm64-apple-ios -target-feature +pauth -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s
33

44
#define CFSTR __builtin___CFStringMakeConstantString
55

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// REQUIRES: aarch64-registered-target
2+
3+
// Test that features requiring FEAT_PAuth fail early if the requirement is not met:
4+
// Specifying the precise target triples here to prevent accidentally enabling unexpected
5+
// -fptrauth-* options as target defaults (would violate NO-UNEXPECTED check lines).
6+
//
7+
// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pauthabi 2>&1 \
8+
// RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,FAIL-CALLS,FAIL-RETURNS,NO-UNEXPECTED
9+
// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-intrinsics 2>&1 \
10+
// RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,NO-UNEXPECTED
11+
// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-calls 2>&1 \
12+
// RUN: | FileCheck %s --check-prefixes=FAIL-CALLS,NO-UNEXPECTED
13+
// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-returns 2>&1 \
14+
// RUN: | FileCheck %s --check-prefixes=FAIL-RETURNS,NO-UNEXPECTED
15+
// RUN: not %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-objc-isa 2>&1 \
16+
// RUN: | FileCheck %s --check-prefixes=FAIL-OBJC-ISA,NO-UNEXPECTED
17+
//
18+
// Test that no errors and warnings are generated if FEAT_PAUTH is supported:
19+
// RUN: %clang %s -S -o - -target aarch64 -mcpu=apple-a12 -mbranch-protection=pauthabi 2>&1 \
20+
// RUN: | FileCheck %s --check-prefix=PAUTH --implicit-check-not=error --implicit-check-not=warning
21+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.3-a -mbranch-protection=pauthabi 2>&1 \
22+
// RUN: | FileCheck %s --check-prefix=PAUTH --implicit-check-not=error --implicit-check-not=warning
23+
// RUN: %clang %s -S -o - -target aarch64 -march=armv9-a -mbranch-protection=pauthabi 2>&1 \
24+
// RUN: | FileCheck %s --check-prefix=PAUTH --implicit-check-not=error --implicit-check-not=warning
25+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.2-a+pauth -mbranch-protection=pauthabi 2>&1 \
26+
// RUN: | FileCheck %s --check-prefix=PAUTH --implicit-check-not=error --implicit-check-not=warning
27+
//
28+
// Test a few combinations of options that should not generate warnings:
29+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.3-a -fptrauth-returns 2>&1 \
30+
// RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
31+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.3-a -fptrauth-objc-isa 2>&1 \
32+
// RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
33+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.3-a -fptrauth-init-fini -fptrauth-calls 2>&1 \
34+
// RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
35+
// RUN: %clang %s -S -o - -target aarch64 -march=armv8.3-a -fptrauth-init-fini -mbranch-protection=pauthabi 2>&1 \
36+
// RUN: | FileCheck %s --check-prefix=NO-UNEXPECTED
37+
38+
// Test that the following options are still gated on -fptrauth-calls.
39+
// If they are not, in assertion builds they would usually fail at asm printing time.
40+
// These tests rely on -fptrauth-calls not being implicitly enabled, so
41+
// specifying the precise target triple.
42+
//
43+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-init-fini 2>&1 \
44+
// RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-init-fini
45+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-function-pointer-type-discrimination 2>&1 \
46+
// RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-function-pointer-type-discrimination
47+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-address-discrimination 2>&1 \
48+
// RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-vtable-pointer-address-discrimination
49+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-vtable-pointer-type-discrimination 2>&1 \
50+
// RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-vtable-pointer-type-discrimination
51+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -fptrauth-block-descriptor-pointers -fblocks -DBLOCKS 2>&1 \
52+
// RUN: | FileCheck %s --check-prefixes=NO-PTRAUTH-CALLS,NO-UNEXPECTED -DOPTION=-fptrauth-block-descriptor-pointers
53+
54+
// Test that v8.2-compatible code is generated, if possible:
55+
//
56+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -msign-return-address=all 2>&1 \
57+
// RUN: | FileCheck %s --check-prefix=COMPAT
58+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret 2>&1 \
59+
// RUN: | FileCheck %s --check-prefix=COMPAT
60+
// RUN: %clang %s -S -o - -target aarch64-linux-gnu -mcpu=cortex-a72 -mbranch-protection=pac-ret+b-key 2>&1 \
61+
// RUN: | FileCheck %s --check-prefix=COMPAT
62+
63+
// arm64e has ptrauth enabled and assumes modern enough CPU by default:
64+
//
65+
// RUN: %clang %s -S -o - -target arm64e-apple-ios 2>&1 \
66+
// RUN: | FileCheck %s --check-prefix=PAUTH
67+
// RUN: not %clang %s -S -o - -target arm64e-apple-ios -mcpu=cortex-a72 2>&1 \
68+
// RUN: | FileCheck %s --check-prefixes=FAIL-INTRINSICS,FAIL-CALLS,FAIL-RETURNS,FAIL-OBJC-ISA,NO-UNEXPECTED
69+
70+
volatile int counter;
71+
72+
void ext(void);
73+
74+
// Basically check the code generated for `caller`, other functions and classes
75+
// are provided just to check that assertion-enabled builds do not crash when
76+
// generating code for constructors, vtable, etc.
77+
78+
extern "C" int caller(void) {
79+
ext();
80+
return 0;
81+
}
82+
83+
#ifdef BLOCKS
84+
int g(int (^bptr)(int)) {
85+
return bptr(42);
86+
}
87+
#endif
88+
89+
class Base {
90+
public:
91+
virtual void f() {}
92+
virtual ~Base() {}
93+
};
94+
95+
class Derived : public Base {
96+
void f() override {
97+
counter += 1;
98+
}
99+
};
100+
101+
__attribute__((constructor)) void constr(void) {
102+
counter = 42;
103+
}
104+
105+
__attribute__((destructor)) void destr(void) {
106+
counter = 0;
107+
}
108+
109+
// Make Base and Derived usable from outside of this compilation unit
110+
// to prevent superfluous optimization.
111+
extern "C" void call_virtual(Base *B) {
112+
B->f();
113+
}
114+
extern "C" void *create(bool f) {
115+
if (f)
116+
return new Base();
117+
else
118+
return new Derived();
119+
}
120+
121+
// NO-PTRAUTH-CALLS: warning: [[OPTION]] is ignored because neither -fptrauth-calls nor -mbranch-protection=pauthabi is specified
122+
// FAIL-INTRINSICS: error: -fptrauth-intrinsics or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
123+
// FAIL-CALLS: error: -fptrauth-calls or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
124+
// FAIL-RETURNS: error: -fptrauth-returns or -mbranch-protection=pauthabi is passed that require either enabling PAuth CPU feature or passing -fptrauth-soft option
125+
// 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
126+
// NO-UNEXPECTED-NOT: error:
127+
// NO-UNEXPECTED-NOT: warning:
128+
129+
// COMPAT: caller:
130+
// COMPAT: hint {{#25|#27}}
131+
//
132+
// COMPAT: hint {{#29|#31}}
133+
// COMPAT: ret
134+
// COMPAT: -- End function
135+
136+
// PAUTH: caller:
137+
// PAUTH: paci{{[ab]}}sp
138+
//
139+
// PAUTH: reta{{[ab]}}
140+
// PAUTH: -- End function
141+
142+
// Just check that some assembler output is printed and -fptrauth-init-fini
143+
// is disabled.
144+
//
145+
// NO-PTRAUTH-CALLS-NOT: @AUTH
146+
//
147+
// NO-PTRAUTH-CALLS: caller:
148+
//
149+
// NO-PTRAUTH-CALLS-NOT: @AUTH

clang/test/CodeGen/ptrauth-debuginfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64-apple-ios \
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth \
22
// RUN: -fptrauth-calls -fptrauth-intrinsics -emit-llvm -fblocks \
33
// RUN: %s -debug-info-kind=limited -o - | FileCheck %s
44

clang/test/CodeGen/ptrauth-function-attributes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
22

3-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
4-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
3+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
4+
// RUN: %clang_cc1 -triple arm64e-apple-ios -target-feature +pauth -fptrauth-returns -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,RETS
55
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
66

7-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
8-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
7+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
8+
// RUN: %clang_cc1 -triple arm64e-apple-ios -target-feature +pauth -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,CALLS
99
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
1010

11-
// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
12-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
11+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
12+
// RUN: %clang_cc1 -triple arm64e-apple-ios -target-feature +pauth -fptrauth-auth-traps -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,TRAPS
1313
// RUN: %clang_cc1 -triple arm64e-apple-ios -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,OFF
1414

1515
// RUN: %clang_cc1 -triple arm64e-apple-ios -mbranch-target-enforce -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALL,BTI

clang/test/CodeGen/ptrauth-function-init-fail.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-calls %s -verify -emit-llvm -S -o -
1+
// RUN: %clang_cc1 -triple arm64e-apple-ios -target-feature +pauth -fptrauth-calls %s -verify -emit-llvm -S -o -
22

33
void f(void);
44

clang/test/CodeGen/ptrauth-function-init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s
2-
// RUN: %clang_cc1 -xc++ %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefixes=CHECK,CXX
1+
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s
2+
// RUN: %clang_cc1 -xc++ %s -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefixes=CHECK,CXX
33

44
#ifdef __cplusplus
55
extern "C" {

clang/test/CodeGen/ptrauth-function-lvalue-cast-disc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- -fptrauth-function-pointer-type-discrimination | FileCheck %s
1+
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- -fptrauth-function-pointer-type-discrimination | FileCheck %s
22

33
typedef void (*fptr_t)(void);
44

clang/test/CodeGen/ptrauth-function-lvalue-cast-undisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- | FileCheck %s
1+
// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -emit-llvm -o- | FileCheck %s
22

33
typedef void (*fptr_t)(void);
44

clang/test/CodeGen/ptrauth-function.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKC
2-
// RUN: %clang_cc1 -xc++ %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKCXX
1+
// RUN: %clang_cc1 %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKC
2+
// RUN: %clang_cc1 -xc++ %s -fptrauth-function-pointer-type-discrimination -triple arm64e-apple-ios13 -target-feature +pauth -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKCXX
33

44
#ifdef __cplusplus
55
extern "C" {

clang/test/CodeGen/ptrauth-in-c-struct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple arm64-apple-ios -fblocks -fptrauth-calls -fptrauth-returns -fptrauth-intrinsics -emit-llvm -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +pauth -fblocks -fptrauth-calls -fptrauth-returns -fptrauth-intrinsics -emit-llvm -o - %s | FileCheck %s
22

33
#define AQ1_50 __ptrauth(1,1,50)
44
#define AQ2_30 __ptrauth(2,1,30)

0 commit comments

Comments
 (0)