git: ece3eda9478d - stable/12 - llvm/powerpc64*: fix broken binaries generated by clang12

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 25 Dec 2021 11:55:48 UTC
The branch stable/12 has been updated by dim:

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

commit ece3eda9478d23eb9f0339e1b3152914c3236191
Author:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
AuthorDate: 2021-08-27 14:47:11 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-25 11:51:20 +0000

    llvm/powerpc64*: fix broken binaries generated by clang12
    
    Amends LLVM commit 2518433f861fcb877d0a7bdd9aec1aec1f77505a that
    was pointed as the source of regression on LLVM12.
    
    This affects powerpc64*, making binaries crash with segmentation fault
    due to bad code generation around "__stack_chk_guard"
    
    Root cause and/or proper fix is under investigation by:
        https://bugs.llvm.org/show_bug.cgi?id=51590
    
    Reviewed by:    dim
    MFC after:      2 days
    Sponsored by:   Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D31698
    
    (cherry picked from commit 9a4d48a645a7a3ebee05fae25afd154a132b638a)
---
 contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 28c8bd0a7ded..74fea674f962 100644
--- a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1961,7 +1961,8 @@ void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
                                   GlobalVariable::ExternalLinkage, nullptr,
                                   "__stack_chk_guard");
     if (TM.getRelocationModel() == Reloc::Static &&
-        !TM.getTargetTriple().isWindowsGNUEnvironment())
+        !TM.getTargetTriple().isWindowsGNUEnvironment() &&
+	!(TM.getTargetTriple().isPPC64() && TM.getTargetTriple().isOSFreeBSD()))
       GV->setDSOLocal(true);
   }
 }