[llvm] d870e36 - [SSP] Restore setting the visibility of __guard_local to hidden for better code generation.

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 14:30:19 PDT 2020


Author: Brad Smith
Date: 2020-08-27T17:17:38-04:00
New Revision: d870e363263835bec96c83f51b20e64722cad742

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

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

Patch by: Philip Guenther

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 868302abc999..40bb45a584db 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1844,7 +1844,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-commits mailing list