summaryrefslogtreecommitdiff
path: root/sys-libs/compiler-rt-sanitizers
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-29 18:03:51 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-29 18:03:51 +0000
commitd7ed2b01311f15ba54fe8ea872aab7d59ab2b193 (patch)
tree1814dd2b5bbf2e7639fdafbeef48d228cfaf5e9b /sys-libs/compiler-rt-sanitizers
parentabaa75b10f899ada8dd05b23cc03205064394bc6 (diff)
gentoo resync : 29.01.2021
Diffstat (limited to 'sys-libs/compiler-rt-sanitizers')
-rw-r--r--sys-libs/compiler-rt-sanitizers/Manifest14
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild2
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.ebuild2
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc1.ebuild2
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc2.ebuild201
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0_rc1.ebuild197
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-13.0.0.9999.ebuild197
-rw-r--r--sys-libs/compiler-rt-sanitizers/files/11.1.0/compiler-rt-prefix-paths.patch79
-rw-r--r--sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch79
9 files changed, 687 insertions, 86 deletions
diff --git a/sys-libs/compiler-rt-sanitizers/Manifest b/sys-libs/compiler-rt-sanitizers/Manifest
index ee7411e4ae16..b1612f1f9178 100644
--- a/sys-libs/compiler-rt-sanitizers/Manifest
+++ b/sys-libs/compiler-rt-sanitizers/Manifest
@@ -1,15 +1,21 @@
+AUX 11.1.0/compiler-rt-prefix-paths.patch 3794 BLAKE2B f6e8992658e665bd9cc13bae00c9d7757d01438a73ffd8809be67bbcd1c6d3956e9965890fd84e573c9ef6cc74a7fc7a349e2e5eec21387150c8ef2ae2bf055d SHA512 23a05ce3805678e855be2a4678102e72fe81cb86208357df0dc95b85c7268fe95025603908dd114b27742f39432c4c860859904b287cf52f5a5b337b131bcb9e
AUX 9.0.1/glibc-2.31.patch 1728 BLAKE2B 96b52a5c287ad2a561134b6470904fc42c0ea14c6d453871b603048df7e0c9a1edb15624eca06726490d6fd874fa2a80279896f131041e0b70f5c9f672485ae4 SHA512 ca5e8fbff32066d137446fca870e93ad0f51a27621bc4954a1b07205f34332015d00465e644db539d8f35352ec547e027846ccbce36705a27fa758cc2f85a026
-AUX 9999/compiler-rt-prefix-paths.patch 3794 BLAKE2B f6e8992658e665bd9cc13bae00c9d7757d01438a73ffd8809be67bbcd1c6d3956e9965890fd84e573c9ef6cc74a7fc7a349e2e5eec21387150c8ef2ae2bf055d SHA512 23a05ce3805678e855be2a4678102e72fe81cb86208357df0dc95b85c7268fe95025603908dd114b27742f39432c4c860859904b287cf52f5a5b337b131bcb9e
+AUX 9999/compiler-rt-prefix-paths.patch 0 BLAKE2B 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3c8a6ff1a1f152f94bfe362c07884339fe571ff7fe903ed3b3deb150b2fa868c387887a0dea2930dc08b81db71a5b1 SHA512 48078fff9293a87f1a973f3348f79506f04c3da774295f5eb67d74dd2d1aa94f0973f8ced3f4ab9e8339902071f82c603b43d5608ad7227046c4da769c5d2151
DIST llvmorg-11.0.0.tar.gz 122743665 BLAKE2B 3f95570240789fd68ddb747df817f5c6cdc9da40911bbe9ee3531c15ada9165e5002b1c2f778cf8735858485ea05a8754e3d3a5f4b15bdd6cb33d64a14692984 SHA512 b6d38871ccce0e086e27d35e42887618d68e57d8274735c59e3eabc42dee352412489296293f8d5169fe0044936345915ee7da61ebdc64ec10f7737f6ecd90f2
DIST llvmorg-11.0.1.tar.gz 122790338 BLAKE2B 0130996b4a8c4d9f757136fd7fb318068c9bfdc565060dec0d4336480c4ab66c4ae3185a7fdb05f13cf9ee8fd4123b09df938881b75d6e5d3689595114b7e32a SHA512 f5e6ef0b3111aae08a89cd01adb2ff4abfa9ef779c68b9190421d0447efd25c2cc00e5aae9f4764805f5fa31434866043d1510ae7389817e28ae53a5442e2fdf
DIST llvmorg-11.1.0-rc1.tar.gz 122793491 BLAKE2B f4777455f5903cffea284eaffd872be6c287c6c1ebbd0c4b5b5473f146d7f5476f3551998a58d3e976ab90cde7b0d05db2b3be97f4e8e2c3474755ff38739268 SHA512 44e281486c44fa1611042ab658b9833a75f9613b7f896863613cfb99de66d13607fb1e9064f42ea3d89ca7951113465a90fd96ca4544262f165f78bd5261f5a8
+DIST llvmorg-11.1.0-rc2.tar.gz 122794772 BLAKE2B ab533f078d9d6c37e27c578866a07896344a0b4cf4ebf6402f4fa490213e017310d1c882bf63e552e99a5b4f6d1d8c01413420713b200bfa6732eff64f3c47a9 SHA512 88d8f1d938f0ba7ec39478d03a35c09a30bea51735276205494265b1061621b3ebcda8ee4211e896783b1b99a377c9fa68046118b0d6cb7fcb7bea1e960f95b7
+DIST llvmorg-12.0.0-rc1.tar.gz 134164708 BLAKE2B d4261ff7d9586b47f4cfda3d2cda4b76534f9e17fbd5cdb8861895b8eb466021962f4608bfcdeb52f8fce78850a994fd5eda0560f7211e5c8d1ac9330a738a36 SHA512 3d07d013d0705bb99f56898cc55d054d0d95aeb53b3c756cfab80b4c9097cc4935bcea89b9efde2e503a899b9fccf0dacc0073c9991c8ea352755c5ec68a757a
DIST llvmorg-9.0.1.tar.gz 113193320 BLAKE2B b86e405f2b8e00436045fd409fe19cdde75c797b1192c62a22b5ec75e6b4dc8e874a0f33008dc31562445e4cbe53a992b6f48c684255a6a1ef261e595b8b161f SHA512 fa88beeaae94b6d0cd9b5ba38658d0ffed8004035d7d8a4f95c3d31a709b88b581ae9bd7761333c8e5375c44b8f6be01768b5a3be901163159d7e6c43b71da59
EBUILD compiler-rt-sanitizers-10.0.1.ebuild 4490 BLAKE2B 28571f35471e04346016d4a717f005d0ee36351b1107fed666650783fa4981cf3e12f71db023ee450e395a71bcb7d62f2be26602c6a2ec79063502c818582358 SHA512 8e2f563c419f85adf8c9536db4e2deb6079ca9741e36002964625930cb1fa0fa9af14436c2278fce987e5b1b46fd597eb67b666e5a194de1f67db3d25e974411
-EBUILD compiler-rt-sanitizers-11.0.0.ebuild 5090 BLAKE2B 2f0c5dacd0abb8e806f73fa3a4896918a88cc2cb5f08a9ef003394b989f1af014f82b5ccce43bd98d0de9b121283c457f8cb2bcb3d682bee69862a92ffce235c SHA512 bf0682cfa02ca7acb180d1bb090887fb2b17331f5b4c008852329d855e13fe5ad702d2e1806461606ae25973e1849a0603159998370308812e2b047711d1a524
-EBUILD compiler-rt-sanitizers-11.0.1.ebuild 5997 BLAKE2B f45312a70d7559e30811fec80d7189e578a334c4f09c8f2cbca3d143687f2448f032d1d586dbbaaf89c2c64b5a75458a2d50914db40f6e315a702ead04bb5030 SHA512 f58f81c77dd6ea37ec8a671d7a2ef7dcc503f15f4180b86aa91c63b67ede4d34e49b40f0033522514ac11e6af67e4193f032426d6382a65a6fd8c6c634a7cf04
-EBUILD compiler-rt-sanitizers-11.1.0_rc1.ebuild 5925 BLAKE2B 10a0ae38c1aeb208c4b128c513b4f9d486a7c50aed4813b99d6586979efb78d339c125e1c5e350e50a4fd0e3ded1585d669452a66acc9813f46e2158b4ec88ce SHA512 8dc4318b7f82a0c4d16c676a4fdcde3654badbc30f25e0287c9128b6973f3e45b5465a2822607f6484883ba524a2d2a1496799c36e9a07162c9c623113ae1254
+EBUILD compiler-rt-sanitizers-11.0.0.ebuild 5092 BLAKE2B bc09a8631caf74d813ece526236205f90dc8d7f280a90f055c38deb81e7f327d1726bf7ae2e7416523a6bb39b9b681fab5564dce940134614381c6f2c1fd732e SHA512 50d24f32c63f19415f20ba8518c0b6e486060721ab5687050da3e7c79fb9cd0b4aa2d96df89bf918a2aed8d6446fa189af348c64570ef1f7bc48ae460e9b6a61
+EBUILD compiler-rt-sanitizers-11.0.1.ebuild 5999 BLAKE2B ce444784053ead63e19df7e1d4c5e71da436bb0545735625b4e81da642e04082b6be9035c154a7751506cd759c910cc761786443f1826c0d803b4adfd0a59701 SHA512 3abc178902d7c93bd0a27da3b85a2b7854de0eabd23fc61dfef8216b27d0a55bcc01128a745300eb0332929827fc38d25317597365b1273fc4698082a7b73cfb
+EBUILD compiler-rt-sanitizers-11.1.0_rc1.ebuild 5927 BLAKE2B 5929d1ab48549468007499d870ceda5090a4669401867628d340f354bee253cab3b724e2d784001a03343394983b2baa2eae8bfdb0649a752365cd77dae155af SHA512 2999f3306ba8d33babf7c3105739024c463431bf9a7d8f039729a771216de58003ffef9d6209a0a2f103e36dc388459c363aba910798e437510604f518efd3b4
+EBUILD compiler-rt-sanitizers-11.1.0_rc2.ebuild 5927 BLAKE2B 5929d1ab48549468007499d870ceda5090a4669401867628d340f354bee253cab3b724e2d784001a03343394983b2baa2eae8bfdb0649a752365cd77dae155af SHA512 2999f3306ba8d33babf7c3105739024c463431bf9a7d8f039729a771216de58003ffef9d6209a0a2f103e36dc388459c363aba910798e437510604f518efd3b4
EBUILD compiler-rt-sanitizers-12.0.0.9999.ebuild 5788 BLAKE2B 3ff53ad32567ced4b380faab967a4f0b2e9c5c97dc9b191d07b1f9e9e7254598f0c44a959d79845cfd730daffe3ca1c2f87158f7634505d30da267b6ab00fe5a SHA512 5738bc9bffed79b039a23cbe0e69cbee0b6ce3d48d58fb8bbd151c67c38495ee403bbd44003c7fff532f7093a27daaa43642e2c1115d1afb33149bc9fc621338
+EBUILD compiler-rt-sanitizers-12.0.0_rc1.ebuild 5788 BLAKE2B 751af9986f90ebc2aec0efef0bba5364e9aa3b741c85bbd6f09a9c8a98e8e0fef951dfb3c55635bc5678f4c2a43c0bfed1c7ae6a6dbd8c6b9aaa317ec5d162c2 SHA512 75e62721b997cf165525c0bbed298d90304c8607c964ca7143730c0e672060117c33bbea592169de16bbfaaca1b79b4c13abe86037b1f4067944c66f010aa333
+EBUILD compiler-rt-sanitizers-13.0.0.9999.ebuild 5788 BLAKE2B 751af9986f90ebc2aec0efef0bba5364e9aa3b741c85bbd6f09a9c8a98e8e0fef951dfb3c55635bc5678f4c2a43c0bfed1c7ae6a6dbd8c6b9aaa317ec5d162c2 SHA512 75e62721b997cf165525c0bbed298d90304c8607c964ca7143730c0e672060117c33bbea592169de16bbfaaca1b79b4c13abe86037b1f4067944c66f010aa333
EBUILD compiler-rt-sanitizers-9.0.1-r1.ebuild 4886 BLAKE2B dbdd0ebd27dac7419f83c4e91d92a6acf68c08413568cfd2f642a3175f53a37e53b67958ef825b06e75de59f3b549ebfa3dae579a8dbb340aac43aa284a3322a SHA512 fdf79aa707e8839ca12afaaedf72c90efac5206f915ac8d451778019a5c9e1ba6ffb38057c9ab6a85adde400791c6c7d64f9664334eb07b9e5dca717a67791bd
EBUILD compiler-rt-sanitizers-9.0.1.ebuild 4836 BLAKE2B 0de8a010cb24b13fb4c7d320ed88b1e59b8f09e8c8b2769cd0db0666de6f6318bd9bcaf74000908dd73ddec551fcf576496f3132be4acb42afb4f4319e169ec4 SHA512 4c96efa4fa90a26cdaa824e0dfdee335dde9ade0cfa4ec04131777c858b4c081c02181bba019d40c388492c6222abf74b8d5edc5b440bcb87f5cc17b462fe542
MISC metadata.xml 1280 BLAKE2B 68347dd2fdb4698150d2e19f2880437b0607360d06ae1e87b753d3d2f91a51265cc1abb76d59fd8933e42ea2df2643f694d7722f88957a9e927877830f181690 SHA512 41348dcf18acf298501484813d2194d4bffcf6f24ca6758b7b5ba4d84b7270a7c467c365eea4c46d6a75824b483bbba4b3e7a2146c0773e1dae91e7cce884cc7
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
index 52e9ff58f471..ed18a87d53fc 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
@@ -36,7 +36,7 @@ BDEPEND="
${PYTHON_DEPS}"
PATCHES=(
- "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+ "${FILESDIR}/11.1.0/compiler-rt-prefix-paths.patch"
)
python_check_deps() {
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.ebuild
index 249ebcf8e2ac..8f8b68d9d0ca 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.ebuild
@@ -49,7 +49,7 @@ LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
PATCHES=(
- "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+ "${FILESDIR}/11.1.0/compiler-rt-prefix-paths.patch"
)
python_check_deps() {
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc1.ebuild
index bc31bbb98930..699bf43e7b63 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc1.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc1.ebuild
@@ -49,7 +49,7 @@ LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
PATCHES=(
- "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+ "${FILESDIR}/11.1.0/compiler-rt-prefix-paths.patch"
)
python_check_deps() {
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc2.ebuild
new file mode 100644
index 000000000000..699bf43e7b63
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.1.0_rc2.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+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 +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 )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
+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? (
+ !<sys-apps/sandbox-2.13
+ $(python_gen_any_dep ">=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.org_set_globals
+
+PATCHES=(
+ "${FILESDIR}/11.1.0/compiler-rt-prefix-paths.patch"
+)
+
+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
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || die
+ fi
+
+ # broken with new glibc
+ sed -i -e '/EXPECT_EQ.*ThreadDescriptorSize/d' \
+ lib/sanitizer_common/tests/sanitizer_linux_test.cpp || die
+
+ 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_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
+}
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0_rc1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0_rc1.ebuild
new file mode 100644
index 000000000000..4261329f9d3c
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0_rc1.ebuild
@@ -0,0 +1,197 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+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 +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 )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
+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? (
+ !<sys-apps/sandbox-2.13
+ $(python_gen_any_dep ">=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.org_set_globals
+
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
+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
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || 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_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
+}
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-13.0.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-13.0.0.9999.ebuild
new file mode 100644
index 000000000000..4261329f9d3c
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-13.0.0.9999.ebuild
@@ -0,0 +1,197 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+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 +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 )
+ gwp-asan? ( scudo )
+ ubsan? ( cfi )"
+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? (
+ !<sys-apps/sandbox-2.13
+ $(python_gen_any_dep ">=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.org_set_globals
+
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
+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
+
+ if use asan && ! use profile; then
+ # TODO: fix these tests to be skipped upstream
+ rm test/asan/TestCases/asan_and_llvm_coverage_test.cpp || 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_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
+}
diff --git a/sys-libs/compiler-rt-sanitizers/files/11.1.0/compiler-rt-prefix-paths.patch b/sys-libs/compiler-rt-sanitizers/files/11.1.0/compiler-rt-prefix-paths.patch
new file mode 100644
index 000000000000..c27e3c44f684
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/11.1.0/compiler-rt-prefix-paths.patch
@@ -0,0 +1,79 @@
+--- a/compiler-rt/cmake/config-ix.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/config-ix.cmake 2020-12-13 16:17:43.000000000 -0600
+@@ -424,10 +424,7 @@
+ ${DARWIN_COMMON_LINK_FLAGS}
+ ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
+
+- if(DARWIN_osx_SYSROOT)
+- list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
+- list(APPEND DARWIN_osx_LINK_FLAGS -isysroot ${DARWIN_osx_SYSROOT})
+- endif()
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
+
+ # Figure out which arches to use for each OS
+ darwin_get_toolchain_supported_archs(toolchain_arches)
+--- a/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:17:13.000000000 -0600
++++ b/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:18:59.000000000 -0600
+@@ -102,23 +102,8 @@
+ endif()
+
+ if(APPLE)
+- # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
+- # not the command line tools (or is using macOS 10.14 or newer). If this is
+- # the case, we need to find the OS X sysroot to pass to clang.
+- if(NOT EXISTS /usr/include/c++)
+- execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
+- OUTPUT_VARIABLE OSX_SYSROOT
+- ERROR_QUIET
+- OUTPUT_STRIP_TRAILING_WHITESPACE)
+- if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
+- message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
+- else()
+- message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
+- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
+- endif()
+- else()
+- set(OSX_SYSROOT_FLAG "")
+- endif()
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++ set(OSX_SYSROOT_FLAG "")
+
+ option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
+ option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
+--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-12-13 16:21:32.000000000 -0600
+@@ -273,7 +273,8 @@
+ ${ARGN})
+ set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
+ add_library(${libname} STATIC ${LIB_SOURCES})
+- if(DARWIN_${LIB_OS}_SYSROOT)
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++ if(DARWIN_${LIB_OS}_SYSROOT AND NOT "${LIB_OS}" STREQUAL "osx")
+ set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
+ endif()
+
+--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-12-13 18:12:27.000000000 -0600
+@@ -277,9 +277,10 @@
+ if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
+ list(APPEND extra_cflags_${libname} "--target=${CMAKE_C_COMPILER_TARGET}")
+ endif()
++ # Do not add --sysroot flag on Gentoo Prefix (search paths handled by cmake)
+- if(CMAKE_SYSROOT)
++ if(CMAKE_SYSROOT AND NOT APPLE)
+ list(APPEND extra_cflags_${libname} "--sysroot=${CMAKE_SYSROOT}")
+ endif()
+ string(REPLACE ";" " " extra_cflags_${libname} "${extra_cflags_${libname}}")
+ string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
+ ${CMAKE_C_COMPILE_OBJECT})
+--- a/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:02.000000000 -0600
++++ b/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:38.000000000 -0600
+@@ -244,6 +244,7 @@
+ # and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD
+ # until this is addressed.
+ if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
++ AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
+ AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ file(GLOB _tsan_generic_sources rtl/tsan*)
+ file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
+
diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
index c27e3c44f684..e69de29bb2d1 100644
--- a/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
@@ -1,79 +0,0 @@
---- a/compiler-rt/cmake/config-ix.cmake 2020-10-07 05:10:48.000000000 -0500
-+++ b/compiler-rt/cmake/config-ix.cmake 2020-12-13 16:17:43.000000000 -0600
-@@ -424,10 +424,7 @@
- ${DARWIN_COMMON_LINK_FLAGS}
- ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
-
-- if(DARWIN_osx_SYSROOT)
-- list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
-- list(APPEND DARWIN_osx_LINK_FLAGS -isysroot ${DARWIN_osx_SYSROOT})
-- endif()
-+ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
-
- # Figure out which arches to use for each OS
- darwin_get_toolchain_supported_archs(toolchain_arches)
---- a/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:17:13.000000000 -0600
-+++ b/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:18:59.000000000 -0600
-@@ -102,23 +102,8 @@
- endif()
-
- if(APPLE)
-- # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
-- # not the command line tools (or is using macOS 10.14 or newer). If this is
-- # the case, we need to find the OS X sysroot to pass to clang.
-- if(NOT EXISTS /usr/include/c++)
-- execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
-- OUTPUT_VARIABLE OSX_SYSROOT
-- ERROR_QUIET
-- OUTPUT_STRIP_TRAILING_WHITESPACE)
-- if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
-- message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
-- else()
-- message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
-- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
-- endif()
-- else()
-- set(OSX_SYSROOT_FLAG "")
-- endif()
-+ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
-+ set(OSX_SYSROOT_FLAG "")
-
- option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
- option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
---- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-10-07 05:10:48.000000000 -0500
-+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-12-13 16:21:32.000000000 -0600
-@@ -273,7 +273,8 @@
- ${ARGN})
- set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
- add_library(${libname} STATIC ${LIB_SOURCES})
-- if(DARWIN_${LIB_OS}_SYSROOT)
-+ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
-+ if(DARWIN_${LIB_OS}_SYSROOT AND NOT "${LIB_OS}" STREQUAL "osx")
- set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
- endif()
-
---- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-10-07 05:10:48.000000000 -0500
-+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-12-13 18:12:27.000000000 -0600
-@@ -277,9 +277,10 @@
- if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
- list(APPEND extra_cflags_${libname} "--target=${CMAKE_C_COMPILER_TARGET}")
- endif()
-+ # Do not add --sysroot flag on Gentoo Prefix (search paths handled by cmake)
-- if(CMAKE_SYSROOT)
-+ if(CMAKE_SYSROOT AND NOT APPLE)
- list(APPEND extra_cflags_${libname} "--sysroot=${CMAKE_SYSROOT}")
- endif()
- string(REPLACE ";" " " extra_cflags_${libname} "${extra_cflags_${libname}}")
- string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
- ${CMAKE_C_COMPILE_OBJECT})
---- a/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:02.000000000 -0600
-+++ b/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:38.000000000 -0600
-@@ -244,6 +244,7 @@
- # and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD
- # until this is addressed.
- if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
-+ AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
- AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- file(GLOB _tsan_generic_sources rtl/tsan*)
- file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
-