aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2021-10-22 11:42:37 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2021-10-22 11:42:37 +0000
commit531a51cc368cf2f53fd21923532964ba96965474 (patch)
tree9f069155b4a27535f7faa10d6cec158242044726
parent99bd02ae3817b300160f08244664240a79f2e437 (diff)
downloadports-531a51cc368cf2f53fd21923532964ba96965474.tar.gz
ports-531a51cc368cf2f53fd21923532964ba96965474.zip
devel/llvm13: fix building software with -fstack-protector-strong
Apply https://reviews.llvm.org/D109090 Fixes immediate segfault when executing binaries built by the port's compiler with -fstack-protector-strong. Submitted by: adalava
-rw-r--r--devel/llvm13/files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/devel/llvm13/files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp b/devel/llvm13/files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp
new file mode 100644
index 000000000000..0323f6d7a13b
--- /dev/null
+++ b/devel/llvm13/files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp
@@ -0,0 +1,15 @@
+--- llvm/lib/CodeGen/TargetLoweringBase.cpp.orig 2021-09-24 16:18:10 UTC
++++ llvm/lib/CodeGen/TargetLoweringBase.cpp
+@@ -1980,8 +1980,11 @@ void TargetLoweringBase::insertSSPDeclarations(Module
+ auto *GV = new GlobalVariable(M, Type::getInt8PtrTy(M.getContext()), false,
+ GlobalVariable::ExternalLinkage, nullptr,
+ "__stack_chk_guard");
++
++ // FreeBSD has "__stack_chk_guard" defined externally on libc.so
+ if (TM.getRelocationModel() == Reloc::Static &&
+- !TM.getTargetTriple().isWindowsGNUEnvironment())
++ !TM.getTargetTriple().isWindowsGNUEnvironment() &&
++ !TM.getTargetTriple().isOSFreeBSD())
+ GV->setDSOLocal(true);
+ }
+ }