From 6609892a2dcdd1a4f6adefe191b55524861f020c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 23 Aug 2021 12:12:43 -0400 Subject: [PATCH] [clang] allow -fstack-clash-protection on FreeBSD -fstack-clash-protection was added in Clang commit e67cbac81211 but was enabled only on Linux. Allow it on FreeBSD as well, as it works fine. Reviewed By: serge-sans-paille Differential Revision: https://reviews.llvm.org/D108571 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/test/Driver/stack-clash-protection.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index e19e122..b973428 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3198,7 +3198,7 @@ static void RenderSCPOptions(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) { const llvm::Triple &EffectiveTriple = TC.getEffectiveTriple(); - if (!EffectiveTriple.isOSLinux()) + if (!EffectiveTriple.isOSFreeBSD() && !EffectiveTriple.isOSLinux()) return; if (!EffectiveTriple.isX86() && !EffectiveTriple.isSystemZ() && diff --git a/clang/test/Driver/stack-clash-protection.c b/clang/test/Driver/stack-clash-protection.c index 5217ed2..048668f 100644 --- a/clang/test/Driver/stack-clash-protection.c +++ b/clang/test/Driver/stack-clash-protection.c @@ -5,6 +5,7 @@ // SCP-i386-NO-NOT: "-fstack-clash-protection" // RUN: %clang -target x86_64-scei-linux -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-x86 +// 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 armv7k-apple-linux -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-armv7 -- 2.7.4