[llvm-branch-commits] [llvm] 97ac9e8 - [SSP] Restore setting the visibility of __guard_local to hidden for better code generation.

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 28 02:50:54 PDT 2020


Author: Brad Smith
Date: 2020-08-28T11:45:57+02:00
New Revision: 97ac9e82002d6b12831ca2c78f739cca65a4fa05

URL: https://github.com/llvm/llvm-project/commit/97ac9e82002d6b12831ca2c78f739cca65a4fa05
DIFF: https://github.com/llvm/llvm-project/commit/97ac9e82002d6b12831ca2c78f739cca65a4fa05.diff

LOG: [SSP] Restore setting the visibility of __guard_local to hidden for better code generation.

Patch by: Philip Guenther

(cherry picked from commit d870e363263835bec96c83f51b20e64722cad742)

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 2c94c2c62e5f..42c1fa8af0e6 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1827,7 +1827,10 @@ Value *TargetLoweringBase::getIRStackGuard(IRBuilder<> &IRB) const {
   if (getTargetMachine().getTargetTriple().isOSOpenBSD()) {
     Module &M = *IRB.GetInsertBlock()->getParent()->getParent();
     PointerType *PtrTy = Type::getInt8PtrTy(M.getContext());
-    return M.getOrInsertGlobal("__guard_local", PtrTy);
+    Constant *C = M.getOrInsertGlobal("__guard_local", PtrTy);
+    if (GlobalVariable *G = dyn_cast_or_null<GlobalVariable>(C))
+      G->setVisibility(GlobalValue::HiddenVisibility);
+    return C;
   }
   return nullptr;
 }


        


More information about the llvm-branch-commits mailing list