commit:     e90f71bad361d4a14d1d7678a6e29cd9b1599f94
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 19:37:58 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 19:47:17 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e90f71ba

sys-libs/compiler-rt-sanitizers: Bump to 17.0.1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/compiler-rt-sanitizers/Manifest           |   2 +
 .../compiler-rt-sanitizers-17.0.1.ebuild           | 216 +++++++++++++++++++++
 2 files changed, 218 insertions(+)

diff --git a/sys-libs/compiler-rt-sanitizers/Manifest 
b/sys-libs/compiler-rt-sanitizers/Manifest
index 0be3a56c10c4..b5f1c8f2e239 100644
--- a/sys-libs/compiler-rt-sanitizers/Manifest
+++ b/sys-libs/compiler-rt-sanitizers/Manifest
@@ -8,4 +8,6 @@ DIST llvm-project-16.0.6.src.tar.xz 118013488 BLAKE2B 
95192d39cbd2914e5609db3659
 DIST llvm-project-16.0.6.src.tar.xz.sig 566 BLAKE2B 
2060cebd5ed57cb8a86a44238c43dfd4b921649298b10c3d19da308374c1e49869174294e29943c2af459fe06428264e26881d6c1288ebbc48686cc2cf467c7a
 SHA512 
ca249262c7102e0889ec1bdc6f71a3a6f0e7e5d5fbab8abcd6fccd2871e7955eff7af5b055a76006097baf0dfaf2f5069eff3035b3107fc552abdb2481b21447
 DIST llvm-project-17.0.0rc4.src.tar.xz 127838724 BLAKE2B 
e3bf524e55db5e4305099ecdff09c0d3eab7957a5f8729eefe636e361460f405fbfd569af38aa39eea3b6c1e024feaa0400f8bc092194f2c3b54c695e7962591
 SHA512 
be7b5ad136d03864dbd11a589ca9e8b0b04a4226ebcffcc123b3ba72992f704bab4f9550d03eb2ac1d21fb8b73ac7824398b4cb4c9cec2118efb112babfe0f65
 DIST llvm-project-17.0.0rc4.src.tar.xz.sig 438 BLAKE2B 
2cda35b4a3ebddfdbe6828459c8bd8fdfaa8e04d2d1c4f2faf16f5c66909186d2dd73e6a163cf733d8955c007249cf3f62f237855d5a76b1b61f3bfa30e4972d
 SHA512 
5f713e05b7c58fab6e9cc43f2f3f69120482c9b60008146da0cddb266d1a5c9b9a77e1e338fce4e15624b332ac53a90c5c4a6f62c58a77f2122a015b4f0ebed2
+DIST llvm-project-17.0.1.src.tar.xz 127830376 BLAKE2B 
bb3b9f7358df9006307f5eeccfc5c5ee5497498c4f091347924911cb6534e8d930024c35387456af24bf647d9e24a3d927aa49199036fb475018a610b5d792c7
 SHA512 
6fc1d5ff4fec49ef5bb495ba9d8f9ee9052c10999ec9d3ac8f825c718e3cdd64abd95408c4e5bb7f67eb9a7bfac9e26d2a949c4da9f163b5646c02e8a670ead5
+DIST llvm-project-17.0.1.src.tar.xz.sig 438 BLAKE2B 
3182e3c3a48635fdec39b945ee3b782d7c9c2a07911d9ede2e3421031bb1b4959bd495c5e39d094aeaf555579b9fe3eb834c1449077c154c629f5db605375e7c
 SHA512 
301a6e6c46d6fee13c86dec1a021c35f6bf3a97e5d6b0aa7b7eac34e7ca52f6cefffc25a9e376250b1eb721a65a5852f2f1948abd432698363a81dd7ee19d81c
 DIST llvm-project-7e5809e7e7bc9a828427b6540a51d45884d8bbbb.tar.gz 197275742 
BLAKE2B 
17df09155cf3451deffcdd71a4b0602211a4638ad961eb351802028f4fd1b8db870bef817430adb709ea7c1e85f545d7507c06d7fca26869f8a10e6ac6b03967
 SHA512 
e84aa041aadf3e50376cffd1e92c1447acdca0a2cf8e7df9cca9d0337dfeccb1d022da3a229bb0cfdc9c5fb87215682a1e4f474208b09b8800f30aa0c6e36c4b

diff --git 
a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-17.0.1.ebuild 
b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-17.0.1.ebuild
new file mode 100644
index 000000000000..dde9db9d3f77
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-17.0.1.ebuild
@@ -0,0 +1,216 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit check-reqs cmake flag-o-matic llvm llvm.org python-any-r1
+
+DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
+HOMEPAGE="https://llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="${LLVM_MAJOR}"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~ppc-macos 
~x64-macos"
+IUSE="+abi_x86_32 abi_x86_64 +clang debug test"
+# base targets
+IUSE+=" +libfuzzer +memprof +orc +profile +xray"
+# sanitizer targets, keep in sync with config-ix.cmake
+# NB: ubsan, scudo deliberately match two entries
+SANITIZER_FLAGS=(
+       asan dfsan lsan msan hwasan tsan ubsan safestack cfi scudo
+       shadowcallstack gwp-asan
+)
+IUSE+=" ${SANITIZER_FLAGS[@]/#/+}"
+REQUIRED_USE="
+       || ( ${SANITIZER_FLAGS[*]} libfuzzer orc profile xray )
+       test? (
+               cfi? ( ubsan )
+               gwp-asan? ( scudo )
+       )
+"
+RESTRICT="
+       !clang? ( test )
+       !test? ( test )
+"
+
+DEPEND="
+       sys-devel/llvm:${LLVM_MAJOR}
+       virtual/libcrypt[abi_x86_32(-)?,abi_x86_64(-)?]
+"
+BDEPEND="
+       >=dev-util/cmake-3.16
+       clang? ( sys-devel/clang )
+       elibc_glibc? ( net-libs/libtirpc )
+       test? (
+               $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
+               =sys-devel/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
+               sys-libs/compiler-rt:${LLVM_MAJOR}
+       )
+       !test? (
+               ${PYTHON_DEPS}
+       )
+"
+
+LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake )
+LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support third-party )
+llvm.org_set_globals
+
+python_check_deps() {
+       use test || return 0
+       python_has_version ">=dev-python/lit-15[${PYTHON_USEDEP}]"
+}
+
+check_space() {
+       if use test; then
+               local CHECKREQS_DISK_BUILD=11G
+               check-reqs_pkg_pretend
+       fi
+}
+
+pkg_pretend() {
+       check_space
+}
+
+pkg_setup() {
+       check_space
+       LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
+       python-any-r1_pkg_setup
+}
+
+src_prepare() {
+       sed -i -e 's:-Werror::' lib/tsan/go/buildgo.sh || die
+
+       local flag
+       for flag in "${SANITIZER_FLAGS[@]}"; do
+               if ! use "${flag}"; then
+                       local cmake_flag=${flag/-/_}
+                       sed -i -e 
"/COMPILER_RT_HAS_${cmake_flag^^}/s:TRUE:FALSE:" \
+                               cmake/config-ix.cmake || die
+               fi
+       done
+
+       # TODO: fix these tests to be skipped upstream
+       if use asan && ! use profile; then
+               rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
+       fi
+       if use ubsan && ! use cfi; then
+               > test/cfi/CMakeLists.txt || die
+       fi
+
+       llvm.org_src_prepare
+}
+
+src_configure() {
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+       # pre-set since we need to pass it to cmake
+       BUILD_DIR=${WORKDIR}/compiler-rt_build
+
+       if use clang; then
+               local -x CC=${CHOST}-clang
+               local -x CXX=${CHOST}-clang++
+               strip-unsupported-flags
+       fi
+
+       local flag want_sanitizer=OFF
+       for flag in "${SANITIZER_FLAGS[@]}"; do
+               if use "${flag}"; then
+                       want_sanitizer=ON
+                       break
+               fi
+       done
+
+       local mycmakeargs=(
+               
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}"
+               # use a build dir structure consistent with install
+               # this makes it possible to easily deploy test-friendly clang
+               -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${LLVM_MAJOR}"
+
+               -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
+               # builtins & crt installed by sys-libs/compiler-rt
+               -DCOMPILER_RT_BUILD_BUILTINS=OFF
+               -DCOMPILER_RT_BUILD_CRT=OFF
+               -DCOMPILER_RT_BUILD_LIBFUZZER=$(usex libfuzzer)
+               -DCOMPILER_RT_BUILD_MEMPROF=$(usex memprof)
+               -DCOMPILER_RT_BUILD_ORC=$(usex orc)
+               -DCOMPILER_RT_BUILD_PROFILE=$(usex profile)
+               -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}"
+               -DCOMPILER_RT_BUILD_XRAY=$(usex xray)
+
+               -DPython3_EXECUTABLE="${PYTHON}"
+       )
+
+       if use amd64; then
+               mycmakeargs+=(
+                       -DCAN_TARGET_i386=$(usex abi_x86_32)
+                       -DCAN_TARGET_x86_64=$(usex abi_x86_64)
+               )
+       fi
+
+       if use test; then
+               mycmakeargs+=(
+                       -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+                       -DLLVM_LIT_ARGS="$(get_lit_flags)"
+
+                       # they are created during src_test()
+                       
-DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_MAJOR}/bin/clang"
+                       
-DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_MAJOR}/bin/clang++"
+               )
+
+               # same flags are passed for build & tests, so we need to strip
+               # them down to a subset supported by clang
+               CC=${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang \
+               CXX=${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang++ \
+               strip-unsupported-flags
+       fi
+
+       if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
+               mycmakeargs+=(
+                       # setting -isysroot is disabled with 
compiler-rt-prefix-paths.patch
+                       # this allows adding arm64 support using SDK in EPREFIX
+                       -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+                       # Set version based on the SDK in EPREFIX
+                       # This disables i386 for SDK >= 10.15
+                       # Will error if has_use tsan and SDK < 10.12
+                       -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath 
${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+                       # Use our libtool instead of looking it up with xcrun
+                       -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
+               )
+       fi
+
+       cmake_src_configure
+
+       if use test; then
+               local sys_dir=( "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/lib/* )
+               [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
+               [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic 
compiler-rt install: ${sys_dir[*]}"
+
+               # copy clang over since resource_dir is located relatively to 
binary
+               # therefore, we can put our new libraries in it
+               mkdir -p 
"${BUILD_DIR}"/lib/{llvm/${LLVM_MAJOR}/{bin,$(get_libdir)},clang/${LLVM_MAJOR}/include}
 || die
+               cp "${EPREFIX}"/usr/lib/llvm/${LLVM_MAJOR}/bin/clang{,++} \
+                       "${BUILD_DIR}"/lib/llvm/${LLVM_MAJOR}/bin/ || die
+               cp "${EPREFIX}"/usr/lib/clang/${LLVM_MAJOR}/include/*.h \
+                       "${BUILD_DIR}"/lib/clang/${LLVM_MAJOR}/include/ || die
+               cp "${sys_dir}"/*builtins*.a \
+                       
"${BUILD_DIR}/lib/clang/${LLVM_MAJOR}/lib/${sys_dir##*/}/" || die
+               # we also need LLVMgold.so for gold-based tests
+               if [[ -f 
${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so ]]; then
+                       ln -s 
"${EPREFIX}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/LLVMgold.so \
+                               
"${BUILD_DIR}"/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/ || die
+               fi
+       fi
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+       # disable sandbox to have it stop clobbering LD_PRELOAD
+       local -x SANDBOX_ON=0
+       # wipe LD_PRELOAD to make ASAN happy
+       local -x LD_PRELOAD=
+
+       cmake_build check-all
+}

Reply via email to