From 590b9b7b03bf4651e099949e318755af7cfa81b8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 1 Aug 2021 22:03:23 +0100 Subject: gentoo resync : 01.08.2021 --- sys-libs/compiler-rt-sanitizers/Manifest | 1 + .../compiler-rt-sanitizers-14.0.0.9999.ebuild | 200 +++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-14.0.0.9999.ebuild (limited to 'sys-libs/compiler-rt-sanitizers') diff --git a/sys-libs/compiler-rt-sanitizers/Manifest b/sys-libs/compiler-rt-sanitizers/Manifest index 215ae9c5494b..ef3a6792e240 100644 --- a/sys-libs/compiler-rt-sanitizers/Manifest +++ b/sys-libs/compiler-rt-sanitizers/Manifest @@ -12,4 +12,5 @@ EBUILD compiler-rt-sanitizers-11.1.0-r1.ebuild 6036 BLAKE2B 30bbe8f96289a6a4e663 EBUILD compiler-rt-sanitizers-12.0.0.ebuild 6081 BLAKE2B 7b72248427b99b3210a6aaab4d2d335c66d113bd3b473f16e660396009d1e1444241748d40b2d91851433754227fce0a893132dc668d43c7a8e962ddb83cd635 SHA512 ad69ec8901fa6273498b2b249d87c7546deeb7c294a8625fb3568faad9edaa2dd55443c00686ce18008201fecc3cba120e6282c2cec056db87af4440c920e293 EBUILD compiler-rt-sanitizers-12.0.1.ebuild 5958 BLAKE2B 817b71b56351dd4ec5fd1b812949b5f02826b6d1122f7ab9d40975aa65f7ff8e8f068bbe4eb111ac579686485be06cf386f621386993cae1c628f1636bed3ab6 SHA512 0ba1217f5949313bd857fe62c0a773d587e629c640eee4d39c2db0a2b558db4398eb39b73cb52dfa0ec2eb5eba9b108fa9c4a219ebd9a979e894eb503d33a3bb EBUILD compiler-rt-sanitizers-13.0.0.9999.ebuild 5886 BLAKE2B 63ff0582aae1fb2ec007553d3d0800f9caf900e95299fa8571d5151c2f029696391af2fab3358b5b378c1ae5fe6de4a60136c09b3f8f72435b92d353e948c24e SHA512 c553a0cd3d4849af21324eeb1498aee728bba3705d00c734f6f55ad6d0354cafd3078addfa691be494bf79b902fc8c669cd76b13a45868ddcb00ea196cd5454d +EBUILD compiler-rt-sanitizers-14.0.0.9999.ebuild 5886 BLAKE2B 63ff0582aae1fb2ec007553d3d0800f9caf900e95299fa8571d5151c2f029696391af2fab3358b5b378c1ae5fe6de4a60136c09b3f8f72435b92d353e948c24e SHA512 c553a0cd3d4849af21324eeb1498aee728bba3705d00c734f6f55ad6d0354cafd3078addfa691be494bf79b902fc8c669cd76b13a45868ddcb00ea196cd5454d MISC metadata.xml 1341 BLAKE2B 27ba2b57b7ba21538680b5535aec8b0e8e772a040b25ac8c9285765ed00a485a01ce6dd47c32686c7d162d072f4d6d7d2e1a790e9bd867b61a460b01ad79bade SHA512 909a922e1b0e9649534d88bb7692b1d1d7a9d3d539a4926054dac834d672da065cfea5b2aab02dd23f2a7b0dde0eb0b10ae453990c3ecf99ec20f6a2d2bdbac6 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-14.0.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-14.0.0.9999.ebuild new file mode 100644 index 000000000000..cc239e8feec6 --- /dev/null +++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-14.0.0.9999.ebuild @@ -0,0 +1,200 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..10} ) +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="$(ver_cut 1-3)" +KEYWORDS="" +IUSE="+clang test elibc_glibc" +# base targets +IUSE+=" +libfuzzer +memprof +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 profile xray ) + test? ( + cfi? ( ubsan ) + gwp-asan? ( scudo ) + )" +RESTRICT="!test? ( test ) !clang? ( test )" + +CLANG_SLOT=${SLOT%%.*} +# llvm-6 for new lit options +DEPEND=" + >=sys-devel/llvm-6" +BDEPEND=" + >=dev-util/cmake-3.16 + clang? ( sys-devel/clang ) + elibc_glibc? ( net-libs/libtirpc ) + test? ( + !=dev-python/lit-5[\${PYTHON_USEDEP}]") + =sys-devel/clang-${PV%_*}*:${CLANG_SLOT} + sys-libs/compiler-rt:${SLOT} + ) + ${PYTHON_DEPS}" + +LLVM_COMPONENTS=( compiler-rt ) +LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest ) +LLVM_PATCHSET=9999-1 +llvm.org_set_globals + +python_check_deps() { + use test || return 0 + has_version "dev-python/lit[${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_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() { + # 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/${SLOT}" + # 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/${SLOT}" + + -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_PROFILE=$(usex profile) + -DCOMPILER_RT_BUILD_SANITIZERS="${want_sanitizer}" + -DCOMPILER_RT_BUILD_XRAY=$(usex xray) + + -DPython3_EXECUTABLE="${PYTHON}" + ) + if use test; then + mycmakeargs+=( + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" + -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/${CLANG_SLOT}/bin/clang" + -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${CLANG_SLOT}/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/${CLANG_SLOT}/bin/clang \ + CXX=${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/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/${SLOT}/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/${CLANG_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die + cp "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/bin/clang{,++} \ + "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/bin/ || die + cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \ + "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die + cp "${sys_dir}"/*builtins*.a \ + "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die + # we also need LLVMgold.so for gold-based tests + if [[ -f ${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so ]]; then + ln -s "${EPREFIX}"/usr/lib/llvm/${CLANG_SLOT}/$(get_libdir)/LLVMgold.so \ + "${BUILD_DIR}"/lib/llvm/${CLANG_SLOT}/$(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 +} -- cgit v1.2.3