[clang] [clang][PAC][darwin] Set correct default ptrauth features for arm64e-darwin (PR #153722)

Ahmed Bougacha via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 13:30:59 PDT 2025


================
@@ -0,0 +1,85 @@
+// RUN: %clang -target arm64                   -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64-apple-macosx      -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64-darwin            -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64-apple-darwin      -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64-apple-ios-macabi  -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64-linux-gnu         -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64e-linux-gnu        -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target aarch64-linux-gnu       -DNO_DEFAULT_PTRAUTH     %s -fsyntax-only -Xclang -verify=no_default_ptrauth
+// RUN: %clang -target arm64e-apple-macosx     -DDARWIN_DEFAULT_PTRAUTH %s -fsyntax-only -Xclang -verify=darwin_ptrauth_defaults
+// RUN: %clang -target arm64e-apple-ios        -DDARWIN_DEFAULT_PTRAUTH %s -fsyntax-only -Xclang -verify=darwin_ptrauth_defaults
+// RUN: %clang -target arm64e-darwin           -DDARWIN_DEFAULT_PTRAUTH %s -fsyntax-only -Xclang -verify=darwin_ptrauth_defaults
+// RUN: %clang -target arm64e-apple-darwin     -DDARWIN_DEFAULT_PTRAUTH %s -fsyntax-only -Xclang -verify=darwin_ptrauth_defaults
+// RUN: %clang -target arm64e-apple-ios-macabi -DDARWIN_DEFAULT_PTRAUTH %s -fsyntax-only -Xclang -verify=darwin_ptrauth_defaults
+
+// A simple test case to test basic override logic
+// RUN: %clang -target arm64e-apple-macosx     -DDARWIN_DEFAULT_PTRAUTH_OVERRIDE -fno-ptrauth-calls %s -fsyntax-only -Xclang -verify=darwin_ptrauth_override
+
+#define ASSERT_MODE_AND_KIND(feature, enabled, kind)                           \
+  _Static_assert(enabled == __has_##kind(feature),                             \
----------------
ahmedbougacha wrote:

ISTM this conflates testing the features and the driver defaults.  We already do both in
```
clang/test/Driver/arch-arm64e.c
clang/test/Preprocessor/ptrauth_feature.c
```
They both could always benefit from some cleaning up, but I'd rather have those updated, WDYT?

https://github.com/llvm/llvm-project/pull/153722


More information about the cfe-commits mailing list