llvm15: add patch for sanitizers on arm*-musl

This commit is contained in:
classabbyamp 2023-04-01 01:42:03 -04:00
parent 90ffb797a9
commit d97818d808
No known key found for this signature in database
GPG key ID: 6BE0755918A4C7F5
2 changed files with 26 additions and 6 deletions

View file

@ -0,0 +1,22 @@
Based on patch from Alpine:
https://gitlab.alpinelinux.org/alpine/aports/-/blob/693203c42aa1cde88cb547173ef67a98824973fd/main/llvm-runtimes/compiler-rt-sanitizer-supported-arch.patch
Sanitizer code is broken on armhf, armv7, s390x, x86, and probably riscv64 on musl,
i.e. enable it only on x86_64, aarch64, and ppc64le.
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -23,9 +23,13 @@ if(APPLE)
set(X86_64 x86_64 x86_64h)
endif()
+if (LIBCXX_HAS_MUSL_LIBC)
+set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86_64} ${ARM64} ${PPC64})
+else()
set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}
${HEXAGON} ${LOONGARCH64})
+endif()
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
${LOONGARCH64})

View file

@ -129,7 +129,6 @@ post_patch() {
vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
;;
esac
}
pre_configure() {
@ -169,12 +168,11 @@ pre_configure() {
cd ../..
fi
# Patch this after we built tblgen.
case "$XBPS_TARGET_MACHINE" in
arm*-musl|i686-musl) # sanitizer code is broken since it duplicates some libc bits
vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \
${wrksrc}/compiler-rt/cmake/config-ix.cmake
;;
arm*-musl|i686-musl)
# sanitizer code is broken since it duplicates some libc bits
configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
;;
esac
case "$XBPS_TARGET_MACHINE" in