[clang] [clang] Enable -fstack-clash-protection by default for Android (PR #209279)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 14:02:15 PDT 2026


================
@@ -8,6 +8,21 @@
 // RUN: %clang -target x86_64-unknown-freebsd -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-x86
 // SCP-x86: "-fstack-clash-protection"
 
+// RUN: %clang -target x86_64-unknown-linux -### %s 2>&1 | FileCheck %s -check-prefix=SCP-LINUX-NO
+// SCP-LINUX-NO-NOT: "-fstack-clash-protection"
+
+// RUN: %clang -target x86_64-linux-android -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID
+// RUN: %clang -target i686-linux-android -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID
+// RUN: %clang -target aarch64-linux-android -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID
+// RUN: %clang -target riscv64-linux-android -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID
+// RUN: %clang -target aarch64-linux-android -fno-stack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID-NO
+// RUN: %clang -target aarch64-linux-android -fno-stack-clash-protection -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID
+// RUN: %clang -target aarch64-linux-android -fstack-clash-protection -fno-stack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID-NO
+// RUN: %clang -target armv7-linux-androideabi -### %s 2>&1 | FileCheck %s -check-prefix=SCP-ANDROID-ARMV7
+// SCP-ANDROID: "-fstack-clash-protection"
----------------
nickdesaulniers wrote:

Also, we don't need all these different File check prefixes that all point to the same value.  There should be one prefix line that all RUN lines that expect this point to.

Example:
```c++
// RUN: ... -check-prefix=enabled
// RUN: ... -check-prefix=enabled
// enabled: "-fstack-clash-protection"
```

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


More information about the cfe-commits mailing list