[clang] [clang][PAC][darwin] Set correct default ptrauth features for arm64e-darwin (PR #153722)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 15 13:52:06 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), \
----------------
ojhunt wrote:
I would also rather keep both the arg and feature flags because I've encountered problems previously where one place screwed up propagation of flags -- I think it did something like `if (OPT_foo) push_back("-fbar")` or `LangOpts.Bar = hasArg(OPT_foo)`, testing the features captures the full clang->clang_cc->feature path as a backup paranoia test, and doesn't have any real cost.
https://github.com/llvm/llvm-project/pull/153722
More information about the cfe-commits
mailing list