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

Patch by: Philip Guenther
This commit is contained in:
Brad Smith 2020-08-27 17:17:38 -04:00
parent ba1de5f2f7
commit d870e36326
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}