commit:     95f98436e3f549994ea500c552ae9586b61594b5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 19:05:58 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct 22 19:12:21 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95f98436

llvm-runtimes/libgcc: Add 22.0.0_pre20251022 snapshot

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

 llvm-runtimes/libgcc/Manifest                      |   1 +
 .../libgcc/libgcc-22.0.0_pre20251022.ebuild        | 173 +++++++++++++++++++++
 2 files changed, 174 insertions(+)

diff --git a/llvm-runtimes/libgcc/Manifest b/llvm-runtimes/libgcc/Manifest
index a988c057ca94..4c24948be415 100644
--- a/llvm-runtimes/libgcc/Manifest
+++ b/llvm-runtimes/libgcc/Manifest
@@ -4,4 +4,5 @@ DIST llvm-project-20.1.8.src.tar.xz 147242952 BLAKE2B 
7657ac0b26acc5affb1bfc91b9
 DIST llvm-project-20.1.8.src.tar.xz.sig 566 BLAKE2B 
85beedfcff1195a974fab2c667b9efd4b715b3480c1b44b1b887fe32c69f72aca0d3b8fb276c03b6cc5a866622f669047aeee5ccb976640b4008ccd31dce77a4
 SHA512 
d74369bdb4d1b82775161ea53c9c5f3a23ce810f4df5ff617123023f9d8ce720e7d6ecc9e17f8ebd39fd9e7a9de79560abdf2ffe73bcb907a43148d43665d619
 DIST llvm-project-21.1.4.src.tar.xz 158939036 BLAKE2B 
b87eff4e3cb881d86aafcfdb46d85344ad6ae92d5c1e72c05282f375b4b11844756d0e6b4d0da5e522a348170a5da9842917737e272b758d8dde7e1fb2bee135
 SHA512 
a8c0883abe7c5a3e55ca7ed0fd974fae4351184a0b0df18295a982ca8ddb0f8d167353564204ed00f0cd9a1d8baef7074c0b39a99e0b5c52ced6bbee73dde3da
 DIST llvm-project-21.1.4.src.tar.xz.sig 119 BLAKE2B 
c74a56448ad3e325234fcbe7d62ea888831e1e7696afb5aa5a185ea76a0880abe2d755f9e69a07760bbf9380534c3bb96c920ed6359ffd0f5f51c962d1494dcf
 SHA512 
4812c2e3861aa3b726d842c3ca259b19ef1aa531fed9f6f47099483de91de2b2a165f40d243f6f40f2eea749741d5f8b7090f394399c56db02053f308921077a
+DIST llvm-project-57a8599d14d4685487064e8b8a5c748970daa4d6.tar.gz 250938364 
BLAKE2B 
793d84c9716cb392667f84005048d549c96cbdbe666b52025c4f3fbd59d47d0b8b1d2485fe5ea52dfb67b6617e97b17197b208dc0d6744468475e459d0193b6d
 SHA512 
06a2dfd70fc7a0bc772a67cc2eb5fe25cf5a170a3e0e07dfa284aaf5f4d90337a66ff026843c7798ed6bbdca84aa42428a9a9caf7ceba354665d2cd811ae84e6
 DIST llvm-project-6a0e5b2fd7c340a872ae1e011cfb9de0d188feba.tar.gz 249848364 
BLAKE2B 
5d8eadfd43e1a131d7c061968c7d306b0537c0983c9366973d5b8d1bab4b384d1319604e12f097e235e077aefcd8b9c8395c3e16b53612f9f06fb11ba358aad6
 SHA512 
d931218ca1dafab09525f862f4b993cb6dde2f8738092e84b87542318d05c81fd41499098833f8629501c19f4fa741a35fc6447631f1c8830b2bb0b2cb64cc43

diff --git a/llvm-runtimes/libgcc/libgcc-22.0.0_pre20251022.ebuild 
b/llvm-runtimes/libgcc/libgcc-22.0.0_pre20251022.ebuild
new file mode 100644
index 000000000000..093c756cc032
--- /dev/null
+++ b/llvm-runtimes/libgcc/libgcc-22.0.0_pre20251022.ebuild
@@ -0,0 +1,173 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+
+inherit cmake crossdev flag-o-matic llvm.org llvm-utils python-any-r1
+inherit toolchain-funcs
+
+DESCRIPTION="Compiler runtime library for clang, compatible with libgcc_s"
+HOMEPAGE="https://llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0"
+IUSE="debug test"
+
+DEPEND="
+       ~llvm-runtimes/libunwind-${PV}[static-libs]
+"
+RDEPEND="
+       ${DEPEND}
+       !sys-devel/gcc
+"
+BDEPEND="
+       llvm-core/clang:${LLVM_MAJOR}
+       test? (
+               $(python_gen_any_dep ">=dev-python/lit-15[\${PYTHON_USEDEP}]")
+               =llvm-core/clang-${LLVM_VERSION}*:${LLVM_MAJOR}
+       )
+       !test? (
+               ${PYTHON_DEPS}
+       )
+"
+
+LLVM_COMPONENTS=( compiler-rt cmake llvm/cmake llvm-libgcc )
+LLVM_TEST_COMPONENTS=( llvm/include/llvm/TargetParser )
+llvm.org_set_globals
+
+python_check_deps() {
+       use test || return 0
+       python_has_version ">=dev-python/lit-15[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       if target_is_not_host || tc-is-cross-compiler ; then
+               # strips vars like CFLAGS="-march=x86_64-v3" for non-x86 
architectures
+               CHOST=${CTARGET} strip-unsupported-flags
+               # overrides host docs otherwise
+               DOCS=()
+       fi
+       python-any-r1_pkg_setup
+}
+
+src_configure() {
+       # We need to build a separate copy of compiler-rt, because we need to 
disable the
+       # COMPILER_RT_BUILTINS_HIDE_SYMBOLS option - compatibility with libgcc 
requires
+       # visibility of all symbols.
+
+       llvm_prepend_path -b "${LLVM_MAJOR}"
+
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+       export CC=${CTARGET}-clang CXX=${CTARGET}-clang++
+       strip-unsupported-flags
+
+       local mycmakeargs=(
+               
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${LLVM_MAJOR}"
+               -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}"
+
+               -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
+               -DCOMPILER_RT_BUILD_CRT=OFF
+               -DCOMPILER_RT_BUILD_CTX_PROFILE=OFF
+               -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
+               -DCOMPILER_RT_BUILD_MEMPROF=OFF
+               -DCOMPILER_RT_BUILD_ORC=OFF
+               -DCOMPILER_RT_BUILD_PROFILE=OFF
+               -DCOMPILER_RT_BUILD_SANITIZERS=OFF
+               -DCOMPILER_RT_BUILD_XRAY=OFF
+
+               -DCOMPILER_RT_BUILTINS_HIDE_SYMBOLS=OFF
+
+               -DPython3_EXECUTABLE="${PYTHON}"
+       )
+
+       # disable building non-native runtimes since we don't do multilib
+       if use amd64; then
+               mycmakeargs+=(
+                       -DCAN_TARGET_i386=OFF
+               )
+       fi
+
+       if use test; then
+               mycmakeargs+=(
+                       -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+                       -DLLVM_LIT_ARGS="$(get_lit_flags)"
+
+                       
-DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang"
+                       
-DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/bin/clang++"
+               )
+       fi
+
+       cmake_src_configure
+}
+
+# Usage: deps
+gen_ldscript() {
+       local output_format
+       output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | 
sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+       [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( 
${output_format} )"
+
+       cat <<-END_LDSCRIPT
+/* GNU ld script
+   Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+src_compile() {
+       cmake_src_compile
+
+       local rtlib=$(
+               "${CC}" -rtlib=compiler-rt -resource-dir="${BUILD_DIR}" \
+                       -print-libgcc-file-name || die
+       )
+
+       # Use the llvm-libgcc's version script to produce libgcc.{a,so}, which
+       # combines compiler-rt and libunwind into a libgcc replacement.
+       #
+       # What we do here is similar to what upstream does[0], with the 
following
+       # differences:
+       #
+       # * We build the local copy of compiler-rt manually, to have a full 
control
+       #   over CMake options.
+       # * Upstream links the locally built copy of libunwind statically. We 
link the
+       #   system-wide libunwind dynamically.
+       #
+       # [0] 
https://github.com/llvm/llvm-project/blob/llvmorg-19.1.7/llvm-libgcc/CMakeLists.txt#L102-L120
+       "${CC}" -E -xc \
+               "${WORKDIR}/llvm-libgcc/gcc_s.ver.in" \
+               -o gcc_s.ver || die
+       "${CC}" -nostdlib \
+               ${LDFLAGS} \
+               -Wl,--version-script,gcc_s.ver \
+               -Wl,--undefined-version \
+               -Wl,--whole-archive \
+               "${rtlib}" \
+               -Wl,-soname,libgcc_s.so.1.0 \
+               -lc -lunwind -shared \
+               -o libgcc_s.so.1.0 || die
+       # Generate libgcc_s.so ldscript for inclusion of libunwind as a
+       # dependency so that `clang -lgcc_s` works out of the box.
+       gen_ldscript libgcc_s.so.1.0 libunwind.so.1.0 > libgcc_s.so || die
+       cp "${rtlib}" libgcc.a || die
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+
+       cmake_build check-builtins
+}
+
+src_install() {
+       local libdir=$(get_libdir)
+       dolib.so libgcc_s.so.1.0 libgcc_s.so
+       dolib.a libgcc.a
+       dosym libgcc_s.so.1.0 "/usr/${libdir}/libgcc_s.so.1"
+       dosym libunwind.a "/usr/${libdir}/libgcc_eh.a"
+}

Reply via email to