git: c37c3d580eb3 - stable/12 - clang: allow -fstack-clash-protection on FreeBSD

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 22 Dec 2021 10:06:25 UTC
The branch stable/12 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=c37c3d580eb36c1b9dfb608412904b30c997aab3

commit c37c3d580eb36c1b9dfb608412904b30c997aab3
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2020-11-25 14:26:13 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-22 10:01:23 +0000

    clang: allow -fstack-clash-protection on FreeBSD
    
    -fstack-clash-protection was added in Clang commit e67cbac81211 but was
    enabled only on Linux.  It should work fine on FreeBSD as well, so
    enable it.
    
    To be discussed and upstreamed with a test.  The OS test should probably
    just be removed.
    
    Reviewed by:    dim
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D27366
    
    (cherry picked from commit 3063e1e56b509373d143a3a4c67d388bd390f268)
---
 contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
index af4bcf951e6c..01024ee3a16a 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2967,7 +2967,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() &&