git: 3b3a785bf35d - 2021Q4 - devel/llvm13: fix building software with -fstack-protector-strong
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Nov 2021 17:50:26 UTC
The branch 2021Q4 has been updated by brooks:
URL: https://cgit.FreeBSD.org/ports/commit/?id=3b3a785bf35d1b77e26324f7950791b460d80bd1
commit 3b3a785bf35d1b77e26324f7950791b460d80bd1
Author: Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-11-12 17:31:00 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-11-12 17:31:00 +0000
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
(cherry picked from commit 531a51cc368cf2f53fd21923532964ba96965474)
devel/llvm13: revert to the older powerpc64 fix
The newer one apparently causes a regression on amd64 freestanding binaries.
While here, fix some whitespace issues in Makefile.
Submitted by: adalava
(cherry picked from commit d326758c32dff2938c1da97c0df5926612c3efa2)
---
devel/llvm13/Makefile | 8 ++++----
.../files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp | 14 ++++++++++++++
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/devel/llvm13/Makefile b/devel/llvm13/Makefile
index 6a6dfde8cac4..da322d06b25b 100644
--- a/devel/llvm13/Makefile
+++ b/devel/llvm13/Makefile
@@ -385,7 +385,7 @@ _BE_LIBS_AMDGPU= AsmParser Disassembler Utils
_BE_LIBS_BACKWARDS_AMDGPU=MCACustomBehaviour
_BE_LIBS_ARM= AsmParser Disassembler Utils
_BE_LIBS_AVR= AsmParser Disassembler
-_BE_LIBS_BPF= AsmParser Disassembler
+_BE_LIBS_BPF= AsmParser Disassembler
_BE_LIBS_Hexagon= AsmParser Disassembler
_BE_LIBS_Lanai= AsmParser Disassembler
_BE_LIBS_MSP430= AsmParser Disassembler
@@ -412,7 +412,7 @@ BE_PATTERN=${_BE_LIBS_STANDARD:O:S/$/.a/:ts|}
_CRTLIBDIR= ${LLVM_DIR}/lib/clang/${LLVM_RELEASE}/lib/freebsd
_CRTBLDIR= ${LLVM_DIR}/lib/clang/${LLVM_RELEASE}/share
_COMPILER_RT_BLACKLISTS= cfi_ignorelist.txt
-_COMPILER_RT_LIBS_i386= \
+_COMPILER_RT_LIBS_i386= \
libclang_rt.asan-i386.a \
libclang_rt.asan-i386.so \
libclang_rt.asan-preinit-i386.a \
@@ -432,7 +432,7 @@ _COMPILER_RT_LIBS_i386= \
.if ${ARCH} == "amd64"
_COMPILER_RT_BLACKLISTS+= asan_ignorelist.txt
_COMPILER_RT_BLACKLISTS+= msan_ignorelist.txt
-_COMPILER_RT_LIBS= \
+_COMPILER_RT_LIBS= \
libclang_rt.asan-preinit-x86_64.a \
libclang_rt.asan-x86_64.a \
libclang_rt.asan-x86_64.a.syms \
@@ -490,7 +490,7 @@ MAKE_ENV+= COMPILER_PATH=${LOCALBASE}/bin
# Comment out plist entries for unsupported options.
.for opt in ${_ALL_OPTIONS}
.if !${OPTIONS_DEFINE:M${opt}}
-PLIST_SUB+= ${opt}="@comment "
+PLIST_SUB+= ${opt}="@comment "
.endif
.endfor
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..be583763f6ea
--- /dev/null
+++ b/devel/llvm13/files/patch-llvm_lib_CodeGen_TargetLoweringBase.cpp
@@ -0,0 +1,14 @@
+diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp
+--- llvm/lib/CodeGen/TargetLoweringBase.cpp
++++ llvm/lib/CodeGen/TargetLoweringBase.cpp
+@@ -1961,7 +1961,8 @@
+ GlobalVariable::ExternalLinkage, nullptr,
+ "__stack_chk_guard");
+ if (TM.getRelocationModel() == Reloc::Static &&
+- !TM.getTargetTriple().isWindowsGNUEnvironment())
++ !TM.getTargetTriple().isWindowsGNUEnvironment() &&
++ !(TM.getTargetTriple().isPPC64() && TM.getTargetTriple().isOSFreeBSD()))
+ GV->setDSOLocal(true);
+ }
+ }
+