Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -3081,9 +3081,7 @@ ArgStringList &CmdArgs) { const llvm::Triple &EffectiveTriple = TC.getEffectiveTriple(); - if (!EffectiveTriple.isOSLinux()) - return; - + // Only enable stack clash protection for backends that implement it. if (!EffectiveTriple.isX86() && !EffectiveTriple.isSystemZ() && !EffectiveTriple.isPPC64()) return; Index: clang/test/Driver/stack-clash-protection.c =================================================================== --- clang/test/Driver/stack-clash-protection.c +++ clang/test/Driver/stack-clash-protection.c @@ -15,7 +15,8 @@ // SCP-warn: warning: Unable to protect inline asm that clobbers stack pointer against stack clash // RUN: %clang -target x86_64-pc-unknown-linux -fstack-clash-protection -S -emit-llvm -o- %s | FileCheck %s -check-prefix=SCP-ll-linux64 -// SCP-ll-linux64: attributes {{.*}} "probe-stack"="inline-asm" +// RUN: %clang -target x86_64-unknown-freebsd13 -fstack-clash-protection -S -emit-llvm -o- %s | FileCheck %s -check-prefix=SCP-inline-asm +// SCP-inline-asm: attributes {{.*}} "probe-stack"="inline-asm" // RUN: %clang -target x86_64-pc-windows-msvc -fstack-clash-protection -S -emit-llvm -o- %s 2>&1 | FileCheck %s -check-prefix=SCP-ll-win64 // SCP-ll-win64-NOT: attributes {{.*}} "probe-stack"="inline-asm"