openbsd-ports/devel/llvm/patches/patch-lib_CodeGen_TargetLoweringBase_cpp
ajacoutot ab90bf3743 Update to llvm-6.0.0.
tested in a bulk
from Brad (maintainer)
2018-04-07 14:55:42 +00:00

22 lines
948 B
Plaintext

$OpenBSD: patch-lib_CodeGen_TargetLoweringBase_cpp,v 1.4 2018/04/07 14:55:42 ajacoutot Exp $
Restore setting the visibility of __guard_local to hidden for better
code generation. Use dyn_case_or_null instead of a static cast to
solve the crashes in the previous code.
Index: lib/CodeGen/TargetLoweringBase.cpp
--- lib/CodeGen/TargetLoweringBase.cpp.orig
+++ lib/CodeGen/TargetLoweringBase.cpp
@@ -1579,7 +1579,10 @@ Value *TargetLoweringBase::getIRStackGuard(IRBuilder<>
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;
}