From 814f4cf860e299a046b649eaee5463427984c09c Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@redcorelinux.org>
Date: Thu, 8 Jul 2021 15:03:58 +0100
Subject: gentoo resync : 08.07.2021

---
 sys-libs/llvm-libunwind/Manifest                   |  12 +-
 .../llvm-libunwind/llvm-libunwind-12.0.0.ebuild    |  16 ++-
 .../llvm-libunwind-12.0.1.9999.ebuild              |  18 ++-
 .../llvm-libunwind-12.0.1_rc1.ebuild               | 124 ------------------
 .../llvm-libunwind-12.0.1_rc2.ebuild               | 124 ------------------
 .../llvm-libunwind-12.0.1_rc4.ebuild               | 138 +++++++++++++++++++++
 .../llvm-libunwind-13.0.0.9999.ebuild              |  18 ++-
 7 files changed, 190 insertions(+), 260 deletions(-)
 delete mode 100644 sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc1.ebuild
 delete mode 100644 sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc2.ebuild
 create mode 100644 sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc4.ebuild

(limited to 'sys-libs/llvm-libunwind')

diff --git a/sys-libs/llvm-libunwind/Manifest b/sys-libs/llvm-libunwind/Manifest
index d99ac3f52462..6f0c4d00ec14 100644
--- a/sys-libs/llvm-libunwind/Manifest
+++ b/sys-libs/llvm-libunwind/Manifest
@@ -1,13 +1,11 @@
 DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3c8a6ff1a1f152f94bfe362c07884339fe571ff7fe903ed3b3deb150b2fa868c387887a0dea2930dc08b81db71a5b1 SHA512 48078fff9293a87f1a973f3348f79506f04c3da774295f5eb67d74dd2d1aa94f0973f8ced3f4ab9e8339902071f82c603b43d5608ad7227046c4da769c5d2151
 DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45ca1c93b64fa4c6ebcd70a1d3849dbad2b8e4e24fba02d144c6266d7fab3607ebc6999b28c229cb35256cf40f26a985 SHA512 9a8ce022a935eed42fa71a224f2a207122aadcbef58ee855fdb4825f879e7d028e4dcff22c19b9d336db1c8bf63fb84372d44981acf84615f757e54306c92b81
 DIST llvmorg-12.0.0.tar.gz 134226215 BLAKE2B f9c3ba8c58571855caa4f206fd285c9b5be66672fb0814cb8bc0964a051f57f5d35013aa1e27cbda502652b37df1ec23474129109e76a42066847860db441dbe SHA512 0cff02155c5ac0d6db2b72d60d9819d5b5dd859663b45f721b1c7540239c2fceb1f57d9173f6870c49de851c242ed8e85c5c6d6577a1f8092a7c5dcd12513b26
-DIST llvmorg-12.0.1-rc1.tar.gz 134261735 BLAKE2B d29510495641c06e6d7a5ac165e6d34e0ba15d1a5b786534e186e341e3a0550cdd3d8a2b61deb3e2bf44c0b0ff8561224bf7f8cebc2ce9415639cb67ceae289e SHA512 4595a26df56eed7d5941240fe92116ad2f1c61639f0f464697c2c530a601347032fbad6802d1fa915ced8574c7b30ef05bc8c0be737784c844d3860892817e6e
-DIST llvmorg-12.0.1-rc2.tar.gz 134274147 BLAKE2B 2d3f6ce8d5239cf2e5ea52f4b9020d6a8fedb8d6a4df02ca0d8e4398237f4eb967865e1e65570d16cd191865281b9619a63905c1e1c47b31183b881e97e49867 SHA512 cdebb954016dc92251cd9c6281804f7a36e7bc8c6f101a6817d96cc121aba4d361fb99501c259409a29c90d7749b224be670c41177fe43fa64b730ff294831b8
+DIST llvmorg-12.0.1-rc4.tar.gz 134278617 BLAKE2B d407421c7244bb125151e69e2a341f1af0a0cf8c1fda3b8ae3d4114c3a285d6307620bbf82b22d96d2c7782b37b0975e87be80c24e3ce1fdc71152734be1e8f8 SHA512 1a2c18435a970491eb9fc9381ba66af726e17dcbd5bf6774f9341b1e82fd35f2e5686844743f5317ebd2106b902c39e09aa98102e58a86e290b29102241c949f
 EBUILD llvm-libunwind-10.0.1.ebuild 3185 BLAKE2B 150bde0a85684ac2cbc01d20139e458f57377c2c9692037e7fec432019b16f073d6e14d772dfee190ab8a682e4b133f538dce51fce3ede54e8e20152575ac7c1 SHA512 4cdf4ce69be5ca630701d4e41bdcfead01eac10ced7edc39a9b20628e3225b65b33ac493d3010f8ac8cfe5cce73b70bb2d4988d1ea00f2766efdbe30c03aa6de
 EBUILD llvm-libunwind-11.1.0.ebuild 3223 BLAKE2B c39bdefd6bf0656db7d84f3cd868da01aa4b37f51c729951d1bcb73336f6ab1d8beb114a7d10d79c1441ce945b03aaf9444481e5e1b3e7dd7fdb9a7e971c451d SHA512 ad8cb081326e4dd6cd888882fabcc3fa1a152c37b28197c9565d46d8f8419f233a1a9f6cc9f3bcfe4ba1441cf97147dafb684e3eb60453020d2b64ccfb56d1c1
-EBUILD llvm-libunwind-12.0.0.ebuild 3235 BLAKE2B 18f5400379d84e9fc40d32687f996d65e3304913e1a523815994114d80721d6be3b97eab2d9d3cca8636c720703da68ab9513b17d620c1d243eb99d7d42c8f41 SHA512 01bfb2d438b0a63fd778991e5b0d1e7e682e7d5cff62523a6a4e77c48e074be309a3450e3571d7d2f5572fd754dd0cf7d883376ec6faa690d3000feeba81555f
-EBUILD llvm-libunwind-12.0.1.9999.ebuild 3191 BLAKE2B c6d413951aed1e093b629506afdb3f76f5887239dc4aedd1d9f7063549d2cad5b286d253df25aacb20116ad6ac6f85453d357eb96de02611d18d5f136d62ebc4 SHA512 99693bac2c943e756f4c7b586d78add1811f91c0bf9bad235bb9a9feb4df1edb779d1e01759ff86a484e48a8bca2ebd6740d5a4c4cdf9dbddab6ebc6a0bd8591
-EBUILD llvm-libunwind-12.0.1_rc1.ebuild 3191 BLAKE2B c6d413951aed1e093b629506afdb3f76f5887239dc4aedd1d9f7063549d2cad5b286d253df25aacb20116ad6ac6f85453d357eb96de02611d18d5f136d62ebc4 SHA512 99693bac2c943e756f4c7b586d78add1811f91c0bf9bad235bb9a9feb4df1edb779d1e01759ff86a484e48a8bca2ebd6740d5a4c4cdf9dbddab6ebc6a0bd8591
-EBUILD llvm-libunwind-12.0.1_rc2.ebuild 3191 BLAKE2B c6d413951aed1e093b629506afdb3f76f5887239dc4aedd1d9f7063549d2cad5b286d253df25aacb20116ad6ac6f85453d357eb96de02611d18d5f136d62ebc4 SHA512 99693bac2c943e756f4c7b586d78add1811f91c0bf9bad235bb9a9feb4df1edb779d1e01759ff86a484e48a8bca2ebd6740d5a4c4cdf9dbddab6ebc6a0bd8591
-EBUILD llvm-libunwind-13.0.0.9999.ebuild 3191 BLAKE2B c6d413951aed1e093b629506afdb3f76f5887239dc4aedd1d9f7063549d2cad5b286d253df25aacb20116ad6ac6f85453d357eb96de02611d18d5f136d62ebc4 SHA512 99693bac2c943e756f4c7b586d78add1811f91c0bf9bad235bb9a9feb4df1edb779d1e01759ff86a484e48a8bca2ebd6740d5a4c4cdf9dbddab6ebc6a0bd8591
+EBUILD llvm-libunwind-12.0.0.ebuild 3657 BLAKE2B f5c411498c8e240c965ea15a23c7c7395a0fb5a1e7c526adfadf6ac084093dae68793df330632b067b509f92fad03116c7655c91849ed5c88c283a064dafc18b SHA512 e6a1f6fe0a830de61cac8ce1966a4dca2c4bd2a00094ff2a3b82c05bbccd4df06b3fe4391a2ca684acd32362683eaa8a2ccd609ebba33c955d98f5359644ccac
+EBUILD llvm-libunwind-12.0.1.9999.ebuild 3614 BLAKE2B 3e47e7add3d6d0092623c8206fd8a2945ebcb83e067a0d77218d2eadd391ad1202678e9a8315f4c55f21c167e68461b593871f1d3e183b5b297d70f05886ec86 SHA512 2d78c6359c2bc744ff1c857832c619cf4b4cc1f3788d6a13f1614baadab091b6e12fcc688d240efa347606cdf21f50bc086b9dbee1cbea19aa96a63cd0f27614
+EBUILD llvm-libunwind-12.0.1_rc4.ebuild 3614 BLAKE2B 3e47e7add3d6d0092623c8206fd8a2945ebcb83e067a0d77218d2eadd391ad1202678e9a8315f4c55f21c167e68461b593871f1d3e183b5b297d70f05886ec86 SHA512 2d78c6359c2bc744ff1c857832c619cf4b4cc1f3788d6a13f1614baadab091b6e12fcc688d240efa347606cdf21f50bc086b9dbee1cbea19aa96a63cd0f27614
+EBUILD llvm-libunwind-13.0.0.9999.ebuild 3614 BLAKE2B 3e47e7add3d6d0092623c8206fd8a2945ebcb83e067a0d77218d2eadd391ad1202678e9a8315f4c55f21c167e68461b593871f1d3e183b5b297d70f05886ec86 SHA512 2d78c6359c2bc744ff1c857832c619cf4b4cc1f3788d6a13f1614baadab091b6e12fcc688d240efa347606cdf21f50bc086b9dbee1cbea19aa96a63cd0f27614
 MISC metadata.xml 302 BLAKE2B ef8858b3c26dfa1727e57685381dbf71eb74008e74127b06467aaff9eea2fd7f3fdcdb1819529b8e828d42720745855e948d608bbe3eb40778fe1e4e260118ad SHA512 d5e641d63402052ef7af157f98998868a816d5e5072424725b09ded5c2477b26aaafbb8874473367a860d3fc365e0f4f0db451315ec4be3df23cce4c1194f2d7
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.0.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.0.ebuild
index 0f82c1251fad..7d7b98339029 100644
--- a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.0.ebuild
+++ b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.0.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 CMAKE_ECLASS=cmake
 PYTHON_COMPAT=( python3_{7..9} )
-inherit cmake-multilib llvm llvm.org python-any-r1
+inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
 
 DESCRIPTION="C++ runtime stack unwinder from LLVM"
 HOMEPAGE="https://github.com/llvm-mirror/libunwind"
@@ -38,8 +38,19 @@ pkg_setup() {
 }
 
 multilib_src_configure() {
+	local use_compiler_rt=OFF
 	local libdir=$(get_libdir)
 
+	# link to compiler-rt
+	# https://github.com/gentoo/gentoo/pull/21516
+	if tc-is-clang; then
+		local compiler-rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+		   ${LD_FLAGS} -print-libgcc-file-name)
+		if [[ ${compiler_rt} == *libclang_rt* ]]; then
+			use_compiler_rt=ON
+		fi
+	fi
+
 	local mycmakeargs=(
 		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
 		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
@@ -49,6 +60,9 @@ multilib_src_configure() {
 		# support non-native unwinding; given it's small enough,
 		# enable it unconditionally
 		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
+
+		# avoid dependency on libgcc_s if compiler-rt is used
+		-DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt}
 	)
 	if use test; then
 		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1.9999.ebuild
index bf538b66689b..d64e79cc6b30 100644
--- a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1.9999.ebuild
+++ b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1.9999.ebuild
@@ -4,8 +4,8 @@
 EAPI=7
 
 CMAKE_ECLASS=cmake
-PYTHON_COMPAT=( python3_{7..9} )
-inherit cmake-multilib llvm llvm.org python-any-r1
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
 
 DESCRIPTION="C++ runtime stack unwinder from LLVM"
 HOMEPAGE="https://github.com/llvm-mirror/libunwind"
@@ -38,8 +38,19 @@ pkg_setup() {
 }
 
 multilib_src_configure() {
+	local use_compiler_rt=OFF
 	local libdir=$(get_libdir)
 
+	# link to compiler-rt
+	# https://github.com/gentoo/gentoo/pull/21516
+	if tc-is-clang; then
+		local compiler-rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+		   ${LD_FLAGS} -print-libgcc-file-name)
+		if [[ ${compiler_rt} == *libclang_rt* ]]; then
+			use_compiler_rt=ON
+		fi
+	fi
+
 	local mycmakeargs=(
 		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
 		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
@@ -49,6 +60,9 @@ multilib_src_configure() {
 		# support non-native unwinding; given it's small enough,
 		# enable it unconditionally
 		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
+
+		# avoid dependency on libgcc_s if compiler-rt is used
+		-DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt}
 	)
 	if use test; then
 		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc1.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc1.ebuild
deleted file mode 100644
index bf538b66689b..000000000000
--- a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc1.ebuild
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-CMAKE_ECLASS=cmake
-PYTHON_COMPAT=( python3_{7..9} )
-inherit cmake-multilib llvm llvm.org python-any-r1
-
-DESCRIPTION="C++ runtime stack unwinder from LLVM"
-HOMEPAGE="https://github.com/llvm-mirror/libunwind"
-
-LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
-SLOT="0"
-KEYWORDS=""
-IUSE="debug static-libs test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="!sys-libs/libunwind"
-# llvm-6 for new lit options
-DEPEND="
-	>=sys-devel/llvm-6"
-BDEPEND="
-	test? ( >=sys-devel/clang-3.9.0
-		$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
-	)"
-
-LLVM_COMPONENTS=( libunwind libcxx llvm/cmake/modules )
-LLVM_TEST_COMPONENTS=( libcxxabi )
-llvm.org_set_globals
-
-python_check_deps() {
-	has_version "dev-python/lit[${PYTHON_USEDEP}]"
-}
-
-pkg_setup() {
-	use test && python-any-r1_pkg_setup
-}
-
-multilib_src_configure() {
-	local libdir=$(get_libdir)
-
-	local mycmakeargs=(
-		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
-		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
-		-DLIBUNWIND_ENABLE_STATIC=$(usex static-libs)
-		-DLLVM_INCLUDE_TESTS=$(usex test)
-
-		# support non-native unwinding; given it's small enough,
-		# enable it unconditionally
-		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
-	)
-	if use test; then
-		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
-		[[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
-
-		mycmakeargs+=(
-			-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
-			-DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
-			-DLIBUNWIND_LIBCXX_PATH="${WORKDIR}/libcxx"
-		)
-	fi
-
-	cmake_src_configure
-}
-
-build_libcxxabi() {
-	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/$(get_libdir)"
-	local CMAKE_USE_DIR=${WORKDIR}/libcxxabi
-	local BUILD_DIR=${BUILD_DIR}/libcxxabi
-	local mycmakeargs=(
-		-DLIBCXXABI_LIBDIR_SUFFIX=
-		-DLIBCXXABI_ENABLE_SHARED=OFF
-		-DLIBCXXABI_ENABLE_STATIC=ONF
-		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
-		-DLIBCXXABI_INCLUDE_TESTS=OFF
-
-		-DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
-		-DLIBCXXABI_LIBUNWIND_INCLUDES="${S}"/include
-	)
-
-	cmake_src_configure
-	cmake_src_compile
-}
-
-build_libcxx() {
-	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libcxxabi/lib -L${BUILD_DIR}/$(get_libdir)"
-	local CMAKE_USE_DIR=${WORKDIR}/libcxx
-	local BUILD_DIR=${BUILD_DIR}/libcxx
-	local mycmakeargs=(
-		-DLIBCXX_LIBDIR_SUFFIX=
-		-DLIBCXX_ENABLE_SHARED=OFF
-		-DLIBCXX_ENABLE_STATIC=ON
-		-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
-		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
-		-DLIBCXX_CXX_ABI=libcxxabi
-		-DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
-		-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
-		-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-		-DLIBCXX_HAS_GCC_S_LIB=OFF
-		-DLIBCXX_INCLUDE_TESTS=OFF
-	)
-
-	cmake_src_configure
-	cmake_src_compile
-}
-
-multilib_src_test() {
-	# build local copies of libc++ & libc++abi for testing to avoid
-	# circular deps
-	build_libcxxabi
-	build_libcxx
-	mv "${BUILD_DIR}"/libcxx*/lib/libc++* "${BUILD_DIR}/$(get_libdir)/" || die
-
-	local -x LIT_PRESERVES_TMP=1
-	cmake_build check-unwind
-}
-
-multilib_src_install() {
-	cmake_src_install
-
-	# install headers like sys-libs/libunwind
-	doheader "${S}"/include/*.h
-}
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc2.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc2.ebuild
deleted file mode 100644
index bf538b66689b..000000000000
--- a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc2.ebuild
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-CMAKE_ECLASS=cmake
-PYTHON_COMPAT=( python3_{7..9} )
-inherit cmake-multilib llvm llvm.org python-any-r1
-
-DESCRIPTION="C++ runtime stack unwinder from LLVM"
-HOMEPAGE="https://github.com/llvm-mirror/libunwind"
-
-LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
-SLOT="0"
-KEYWORDS=""
-IUSE="debug static-libs test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="!sys-libs/libunwind"
-# llvm-6 for new lit options
-DEPEND="
-	>=sys-devel/llvm-6"
-BDEPEND="
-	test? ( >=sys-devel/clang-3.9.0
-		$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
-	)"
-
-LLVM_COMPONENTS=( libunwind libcxx llvm/cmake/modules )
-LLVM_TEST_COMPONENTS=( libcxxabi )
-llvm.org_set_globals
-
-python_check_deps() {
-	has_version "dev-python/lit[${PYTHON_USEDEP}]"
-}
-
-pkg_setup() {
-	use test && python-any-r1_pkg_setup
-}
-
-multilib_src_configure() {
-	local libdir=$(get_libdir)
-
-	local mycmakeargs=(
-		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
-		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
-		-DLIBUNWIND_ENABLE_STATIC=$(usex static-libs)
-		-DLLVM_INCLUDE_TESTS=$(usex test)
-
-		# support non-native unwinding; given it's small enough,
-		# enable it unconditionally
-		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
-	)
-	if use test; then
-		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
-		[[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
-
-		mycmakeargs+=(
-			-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
-			-DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
-			-DLIBUNWIND_LIBCXX_PATH="${WORKDIR}/libcxx"
-		)
-	fi
-
-	cmake_src_configure
-}
-
-build_libcxxabi() {
-	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/$(get_libdir)"
-	local CMAKE_USE_DIR=${WORKDIR}/libcxxabi
-	local BUILD_DIR=${BUILD_DIR}/libcxxabi
-	local mycmakeargs=(
-		-DLIBCXXABI_LIBDIR_SUFFIX=
-		-DLIBCXXABI_ENABLE_SHARED=OFF
-		-DLIBCXXABI_ENABLE_STATIC=ONF
-		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
-		-DLIBCXXABI_INCLUDE_TESTS=OFF
-
-		-DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
-		-DLIBCXXABI_LIBUNWIND_INCLUDES="${S}"/include
-	)
-
-	cmake_src_configure
-	cmake_src_compile
-}
-
-build_libcxx() {
-	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libcxxabi/lib -L${BUILD_DIR}/$(get_libdir)"
-	local CMAKE_USE_DIR=${WORKDIR}/libcxx
-	local BUILD_DIR=${BUILD_DIR}/libcxx
-	local mycmakeargs=(
-		-DLIBCXX_LIBDIR_SUFFIX=
-		-DLIBCXX_ENABLE_SHARED=OFF
-		-DLIBCXX_ENABLE_STATIC=ON
-		-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
-		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
-		-DLIBCXX_CXX_ABI=libcxxabi
-		-DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
-		-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
-		-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-		-DLIBCXX_HAS_GCC_S_LIB=OFF
-		-DLIBCXX_INCLUDE_TESTS=OFF
-	)
-
-	cmake_src_configure
-	cmake_src_compile
-}
-
-multilib_src_test() {
-	# build local copies of libc++ & libc++abi for testing to avoid
-	# circular deps
-	build_libcxxabi
-	build_libcxx
-	mv "${BUILD_DIR}"/libcxx*/lib/libc++* "${BUILD_DIR}/$(get_libdir)/" || die
-
-	local -x LIT_PRESERVES_TMP=1
-	cmake_build check-unwind
-}
-
-multilib_src_install() {
-	cmake_src_install
-
-	# install headers like sys-libs/libunwind
-	doheader "${S}"/include/*.h
-}
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc4.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc4.ebuild
new file mode 100644
index 000000000000..d64e79cc6b30
--- /dev/null
+++ b/sys-libs/llvm-libunwind/llvm-libunwind-12.0.1_rc4.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="C++ runtime stack unwinder from LLVM"
+HOMEPAGE="https://github.com/llvm-mirror/libunwind"
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS=""
+IUSE="debug static-libs test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="!sys-libs/libunwind"
+# llvm-6 for new lit options
+DEPEND="
+	>=sys-devel/llvm-6"
+BDEPEND="
+	test? ( >=sys-devel/clang-3.9.0
+		$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
+	)"
+
+LLVM_COMPONENTS=( libunwind libcxx llvm/cmake/modules )
+LLVM_TEST_COMPONENTS=( libcxxabi )
+llvm.org_set_globals
+
+python_check_deps() {
+	has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+	use test && python-any-r1_pkg_setup
+}
+
+multilib_src_configure() {
+	local use_compiler_rt=OFF
+	local libdir=$(get_libdir)
+
+	# link to compiler-rt
+	# https://github.com/gentoo/gentoo/pull/21516
+	if tc-is-clang; then
+		local compiler-rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+		   ${LD_FLAGS} -print-libgcc-file-name)
+		if [[ ${compiler_rt} == *libclang_rt* ]]; then
+			use_compiler_rt=ON
+		fi
+	fi
+
+	local mycmakeargs=(
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
+		-DLIBUNWIND_ENABLE_STATIC=$(usex static-libs)
+		-DLLVM_INCLUDE_TESTS=$(usex test)
+
+		# support non-native unwinding; given it's small enough,
+		# enable it unconditionally
+		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
+
+		# avoid dependency on libgcc_s if compiler-rt is used
+		-DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt}
+	)
+	if use test; then
+		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
+		[[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
+
+		mycmakeargs+=(
+			-DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+			-DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
+			-DLIBUNWIND_LIBCXX_PATH="${WORKDIR}/libcxx"
+		)
+	fi
+
+	cmake_src_configure
+}
+
+build_libcxxabi() {
+	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/$(get_libdir)"
+	local CMAKE_USE_DIR=${WORKDIR}/libcxxabi
+	local BUILD_DIR=${BUILD_DIR}/libcxxabi
+	local mycmakeargs=(
+		-DLIBCXXABI_LIBDIR_SUFFIX=
+		-DLIBCXXABI_ENABLE_SHARED=OFF
+		-DLIBCXXABI_ENABLE_STATIC=ONF
+		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
+		-DLIBCXXABI_INCLUDE_TESTS=OFF
+
+		-DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
+		-DLIBCXXABI_LIBUNWIND_INCLUDES="${S}"/include
+	)
+
+	cmake_src_configure
+	cmake_src_compile
+}
+
+build_libcxx() {
+	local -x LDFLAGS="${LDFLAGS} -L${BUILD_DIR}/libcxxabi/lib -L${BUILD_DIR}/$(get_libdir)"
+	local CMAKE_USE_DIR=${WORKDIR}/libcxx
+	local BUILD_DIR=${BUILD_DIR}/libcxx
+	local mycmakeargs=(
+		-DLIBCXX_LIBDIR_SUFFIX=
+		-DLIBCXX_ENABLE_SHARED=OFF
+		-DLIBCXX_ENABLE_STATIC=ON
+		-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
+		-DLIBCXXABI_USE_LLVM_UNWINDER=ON
+		-DLIBCXX_CXX_ABI=libcxxabi
+		-DLIBCXX_CXX_ABI_INCLUDE_PATHS="${WORKDIR}"/libcxxabi/include
+		-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
+		-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+		-DLIBCXX_HAS_GCC_S_LIB=OFF
+		-DLIBCXX_INCLUDE_TESTS=OFF
+	)
+
+	cmake_src_configure
+	cmake_src_compile
+}
+
+multilib_src_test() {
+	# build local copies of libc++ & libc++abi for testing to avoid
+	# circular deps
+	build_libcxxabi
+	build_libcxx
+	mv "${BUILD_DIR}"/libcxx*/lib/libc++* "${BUILD_DIR}/$(get_libdir)/" || die
+
+	local -x LIT_PRESERVES_TMP=1
+	cmake_build check-unwind
+}
+
+multilib_src_install() {
+	cmake_src_install
+
+	# install headers like sys-libs/libunwind
+	doheader "${S}"/include/*.h
+}
diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild
index bf538b66689b..d64e79cc6b30 100644
--- a/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild
+++ b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.0.9999.ebuild
@@ -4,8 +4,8 @@
 EAPI=7
 
 CMAKE_ECLASS=cmake
-PYTHON_COMPAT=( python3_{7..9} )
-inherit cmake-multilib llvm llvm.org python-any-r1
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
 
 DESCRIPTION="C++ runtime stack unwinder from LLVM"
 HOMEPAGE="https://github.com/llvm-mirror/libunwind"
@@ -38,8 +38,19 @@ pkg_setup() {
 }
 
 multilib_src_configure() {
+	local use_compiler_rt=OFF
 	local libdir=$(get_libdir)
 
+	# link to compiler-rt
+	# https://github.com/gentoo/gentoo/pull/21516
+	if tc-is-clang; then
+		local compiler-rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+		   ${LD_FLAGS} -print-libgcc-file-name)
+		if [[ ${compiler_rt} == *libclang_rt* ]]; then
+			use_compiler_rt=ON
+		fi
+	fi
+
 	local mycmakeargs=(
 		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
 		-DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug)
@@ -49,6 +60,9 @@ multilib_src_configure() {
 		# support non-native unwinding; given it's small enough,
 		# enable it unconditionally
 		-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON
+
+		# avoid dependency on libgcc_s if compiler-rt is used
+		-DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt}
 	)
 	if use test; then
 		local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
-- 
cgit v1.2.3