commit: 78a38ce8207aed11226702252f25f9c61471abb7 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Tue Feb 10 08:37:15 2026 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Tue Feb 10 16:57:22 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78a38ce8
llvm-core/clang-common: Add 22.1.0_rc3 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> llvm-core/clang-common/Manifest | 2 + .../clang-common/clang-common-22.1.0_rc3.ebuild | 338 +++++++++++++++++++++ 2 files changed, 340 insertions(+) diff --git a/llvm-core/clang-common/Manifest b/llvm-core/clang-common/Manifest index 69b990500c85..1ecc92e6d0dc 100644 --- a/llvm-core/clang-common/Manifest +++ b/llvm-core/clang-common/Manifest @@ -14,6 +14,8 @@ DIST llvm-project-22.1.0-rc1.src.tar.xz 166976000 BLAKE2B eec2cf8822aa6937c751d9 DIST llvm-project-22.1.0-rc1.src.tar.xz.sig 119 BLAKE2B e3d5a6c00d7960b0694919ff083e02f0273e97da6a40ad452fbb8261b9edfc52d4262733d82a59f03ad7d15b3b62de743b37a1b2e191417443ecb730520be376 SHA512 51326b9402d7719c491ac5c6ab80a678896743dd88e3f997245adb77e7b3f5e0f84f6389c75872aea268de8a7a049684c84cdf575c1f19c4971bb280a9374de6 DIST llvm-project-22.1.0-rc2.src.tar.xz 166979860 BLAKE2B d4d58b2615ce596f97ad743ba43a774a7b1e69f8aa394411cfdfdae6abf76ef23c9f483a8db590eac6012a965dbe720111c3c779cf20d1483bd216a3fe5111a0 SHA512 2690f582950a2b8b4dccfce849080b841b34068bbd07acd25ae7d18ef0bc6919f83cd57edda8b90a00327b73aa5cb3411d413ea800247cf541c89143ca26ef98 DIST llvm-project-22.1.0-rc2.src.tar.xz.sig 119 BLAKE2B 797d0fb36d5ff979504bf094c574ab6473d6d428b0ee0f80c95f6b700c534b8d390f0685e01bd9681fd0b33c0fe39af2d6a8b79372d05af1d87b0a602ba7ff2f SHA512 619a9ef733d7f89ed1e7564d027b4d1ad714dbe7912cd7ff258436e9ee6b878cc806d2856f00b600f982a472644cd9ba54739f8d034f5b5033c1036fcddf9a09 +DIST llvm-project-22.1.0-rc3.src.tar.xz 167027608 BLAKE2B 30076ce497a4222ce05849f08742a3a62e5f074453e3a2707fe0bda3b956720897e5c3733869d720c7e51a6c5a16b09dff65fb92d6afa09ba1b0ea2ff75530ee SHA512 65c065167de616e650c2f985f165627698dae7706e032018094d7f6b86a305a40c6f244db3a85c4a455fd26323589594f6ddb4bf677912f22891cddaed7c6d26 +DIST llvm-project-22.1.0-rc3.src.tar.xz.sig 119 BLAKE2B 393e41e0970847f30b484333123e7e5a0ac8a7fd70d15895d8bd82c02f75331646d6921da875db0aa0b7420a6fe2ec632c0e08b931424517e981254238c21e45 SHA512 cbc82d1736a6b481b1894047128699cc8e52bc2322e6b655158775c6da4225a36fcbfaad37fbebb890c1d3e170f4aec1d4ee434bc4454475a799701652744111 DIST llvm-project-424bebd9c784b8490e63290feeeceb42dfdaeb49.tar.gz 259881041 BLAKE2B 3ad34527e65de98be5153d97c7604e0aa8187907f0361bcdf98d37eceaad3a2f152243f5a89ba65f76aba83a69ad3b51f98832095caa7845e7dd5d369611405e SHA512 023581069f5b1f29e1160567df5e365addcf3763829562f7b751d44e0bb0c7adb962101967ae69b2b6a01680af8c833077cd04285727f5fb0292ee7fc61789fc DIST llvm-project-8d2078332c23b10dcf3571adc1a186e5c65f82df.tar.gz 261730510 BLAKE2B 89d2208b2daf0f1a8849d9dc44992b5ce27c716a6818682aa5087f6c1455af73ffda87227b0e7e1fa960721dbc706560b8216a1e575ffbb932c5f5019a37ed01 SHA512 7a23d37bf312ae75bbcdbd812737324a6d45a413aab14d32d8a896d0df35e4f008d315092050ee81033bdc3525a5a9dbc197328f75ad792c51084ebb9684cba8 DIST llvm-project-9eaa1ff11ccde52f2e3bf86f253b6b646548c7cc.tar.gz 259436517 BLAKE2B effc5d342ef8440834d03ca7f9d56dc9f5a0aaa10f62aa81fb3d468cfcd0f28a41b343dc12d91e087a5e509a8bb6aa00b477582f42b87efbf22ea580b48a981e SHA512 fda87f688a8a3626c3b025d2a783d7deb0c64ae83cb9c9c89adb73eba764435981545844eb654d7094361fb3786ea955101ba261f0e4af5ee4beffdd9c2449d7 diff --git a/llvm-core/clang-common/clang-common-22.1.0_rc3.ebuild b/llvm-core/clang-common/clang-common-22.1.0_rc3.ebuild new file mode 100644 index 000000000000..b85ba707d148 --- /dev/null +++ b/llvm-core/clang-common/clang-common-22.1.0_rc3.ebuild @@ -0,0 +1,338 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit bash-completion-r1 elisp-common llvm.org multilib + +DESCRIPTION="Common files shared between multiple slots of clang" +HOMEPAGE="https://llvm.org/" + +LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA" +SLOT="0" +IUSE=" + default-compiler-rt default-libcxx default-lld + bootstrap-prefix cet emacs hardened llvm-libunwind +" + +PDEPEND=" + default-compiler-rt? ( + llvm-runtimes/clang-runtime:${LLVM_MAJOR}[compiler-rt] + llvm-libunwind? ( llvm-runtimes/libunwind[static-libs] ) + !llvm-libunwind? ( sys-libs/libunwind[static-libs] ) + ) + !default-compiler-rt? ( sys-devel/gcc ) + default-libcxx? ( >=llvm-runtimes/libcxx-${PV}[static-libs] ) + !default-libcxx? ( sys-devel/gcc ) + default-lld? ( >=llvm-core/lld-${PV} ) + !default-lld? ( sys-devel/binutils ) +" +# enforce flags on clang-runtime as well to aid transition +PDEPEND+=" + llvm-runtimes/clang-runtime[default-compiler-rt(-)?,default-libcxx(-)?,default-lld(-)?,llvm-libunwind(-)?] + emacs? ( >=app-editors/emacs-26.3:* ) +" +IDEPEND=" + !default-compiler-rt? ( sys-devel/gcc-config ) + !default-libcxx? ( sys-devel/gcc-config ) +" +BDEPEND=" + emacs? ( >=app-editors/emacs-26.3:* ) +" + +LLVM_COMPONENTS=( clang/utils clang/tools/clang-format ) +llvm.org_set_globals + +SITEFILE="50clang-gentoo.el" + +pkg_pretend() { + [[ ${CLANG_IGNORE_DEFAULT_RUNTIMES} ]] && return + + local flag missing_flags=() + for flag in default-{compiler-rt,libcxx,lld}; do + if ! use "${flag}" && has_version "llvm-core/clang[${flag}]"; then + missing_flags+=( "${flag}" ) + fi + done + + if [[ ${missing_flags[@]} ]]; then + eerror "It seems that you have the following flags set on llvm-core/clang:" + eerror + eerror " ${missing_flags[*]}" + eerror + eerror "The default runtimes are now set via flags on llvm-core/clang-common." + eerror "The build is being aborted to prevent breakage. Please either set" + eerror "the respective flags on this ebuild, e.g.:" + eerror + eerror " llvm-core/clang-common ${missing_flags[*]}" + eerror + eerror "or build with CLANG_IGNORE_DEFAULT_RUNTIMES=1." + die "Mismatched defaults detected between llvm-core/clang and llvm-core/clang-common" + fi +} + +_doclang_cfg() { + local triple="${1}" + + local tool + for tool in ${triple}-clang{,++}; do + newins - "${tool}.cfg" <<-EOF + # This configuration file is used by ${tool} driver. + @gentoo-common.cfg + @gentoo-common-ld.cfg + EOF + if [[ ${triple} == x86_64* ]]; then + cat >> "${ED}/etc/clang/${tool}.cfg" <<-EOF || die + @gentoo-cet.cfg + EOF + fi + done + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/${triple}-clang++.cfg" <<-EOF || die + -lc++abi + EOF + fi + + newins - "${triple}-clang-cpp.cfg" <<-EOF + # This configuration file is used by the ${triple}-clang-cpp driver. + @gentoo-common.cfg + EOF + if [[ ${triple} == x86_64* ]]; then + cat >> "${ED}/etc/clang/${triple}-clang-cpp.cfg" <<-EOF || die + @gentoo-cet.cfg + EOF + fi + + # Install symlinks for triples with other vendor strings since some + # programs insist on mangling the triple. + local vendor + for vendor in gentoo pc unknown; do + local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}" + for tool in clang{,++,-cpp}; do + if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then + dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg" + fi + done + done +} + +doclang_cfg() { + local triple="${1}" + + _doclang_cfg ${triple} + + # LLVM may have different arch names in some cases. For example in x86 + # profiles the triple uses i686, but llvm will prefer i386 if invoked + # with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will + # be used if invoked through ${CHOST}-clang{,++,-cpp} though. + # + # To make sure the correct triples are installed, + # see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp + # and compare with CHOST values in profiles. + + local abi=${triple%%-*} + case ${abi} in + armv4l|armv4t|armv5tel|armv6j|armv7a) + _doclang_cfg ${triple/${abi}/arm} + ;; + i686) + _doclang_cfg ${triple/${abi}/i386} + ;; + sparc) + _doclang_cfg ${triple/${abi}/sparcel} + ;; + sparc64) + _doclang_cfg ${triple/${abi}/sparcv9} + ;; + esac +} + +src_compile() { + default + use emacs && elisp-compile ../tools/clang-format/clang-format.el +} + +src_install() { + newbashcomp bash-autocomplete.sh clang + + insinto /etc/clang + newins - gentoo-runtimes.cfg <<-EOF + # This file is initially generated by llvm-runtimes/clang-runtime. + # It is used to control the default runtimes using by clang. + + --rtlib=$(usex default-compiler-rt compiler-rt libgcc) + --unwindlib=$(usex default-compiler-rt libunwind libgcc) + --stdlib=$(usex default-libcxx libc++ libstdc++) + -fuse-ld=$(usex default-lld lld bfd) + EOF + + newins - gentoo-gcc-install.cfg <<-EOF + # This file is maintained by gcc-config. + # It is used to specify the selected GCC installation. + EOF + + newins - gentoo-common.cfg <<-EOF + # This file contains flags common to clang, clang++ and clang-cpp. + @gentoo-runtimes.cfg + @gentoo-gcc-install.cfg + @gentoo-hardened.cfg + # bug #870001 + -include "${EPREFIX}/usr/include/gentoo/maybe-stddefs.h" + EOF + + # clang-cpp does not like link args being passed to it when directly + # invoked, so use a separate configuration file. + newins - gentoo-common-ld.cfg <<-EOF + # This file contains flags common to clang and clang++ + @gentoo-hardened-ld.cfg + EOF + + # Baseline hardening (bug #851111) + newins - gentoo-hardened.cfg <<-EOF + # Some of these options are added unconditionally, regardless of + # USE=hardened, for parity with sys-devel/gcc. + -Xarch_host -fstack-clash-protection + -Xarch_host -fstack-protector-strong + -fPIE + -include "${EPREFIX}/usr/include/gentoo/fortify.h" + EOF + + newins - gentoo-cet.cfg <<-EOF + -Xarch_host -fcf-protection=$(usex cet full none) + EOF + + if use kernel_Darwin; then + newins - gentoo-hardened-ld.cfg <<-EOF + # There was -Wl,-z,relro here, but it's not supported on Mac + # TODO: investigate whether -bind_at_load or -read_only_stubs will do the job + EOF + else + newins - gentoo-hardened-ld.cfg <<-EOF + # Some of these options are added unconditionally, regardless of + # USE=hardened, for parity with sys-devel/gcc. + -Wl,-z,relro + -Wl,-z,now + EOF + fi + + dodir /usr/include/gentoo + + cat >> "${ED}/usr/include/gentoo/maybe-stddefs.h" <<-EOF || die + /* __has_include is an extension, but it's fine, because this is only + for Clang anyway. */ + #if defined __has_include && __has_include (<stdc-predef.h>) && !defined(__GLIBC__) + # include <stdc-predef.h> + #endif + EOF + + local fortify_level=$(usex hardened 3 2) + # We have to do this because glibc's headers warn if F_S is set + # without optimization and that would at the very least be very noisy + # during builds and at worst trigger many -Werror builds. + cat >> "${ED}/usr/include/gentoo/fortify.h" <<- EOF || die + #ifdef __clang__ + # pragma clang system_header + #endif + #ifndef _FORTIFY_SOURCE + # if defined(__has_feature) + # define __GENTOO_HAS_FEATURE(x) __has_feature(x) + # else + # define __GENTOO_HAS_FEATURE(x) 0 + # endif + # + # if !defined(__OPTIMIZE__) || __OPTIMIZE__ == 0 + # elif !defined(__STDC_HOSTED__) || __STDC_HOSTED__ != 1 + # elif defined(__SANITIZE_ADDRESS__) + # elif __GENTOO_HAS_FEATURE(address_sanitizer) + # elif __GENTOO_HAS_FEATURE(hwaddress_sanitizer) + # elif __GENTOO_HAS_FEATURE(memory_sanitizer) + # elif __GENTOO_HAS_FEATURE(numerical_stability_sanitizer) + # elif __GENTOO_HAS_FEATURE(realtime_sanitizer) + # elif __GENTOO_HAS_FEATURE(thread_sanitizer) + # else + # define _FORTIFY_SOURCE ${fortify_level} + # endif + # + # undef __GENTOO_HAS_FEATURE + #endif + EOF + + # TODO: Maybe -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST for + # non-hardened? + if use hardened ; then + cat >> "${ED}/etc/clang/gentoo-hardened.cfg" <<-EOF || die + # Options below are conditional on USE=hardened. + -Xarch_host -D_GLIBCXX_ASSERTIONS + + # Analogue to GLIBCXX_ASSERTIONS + # https://libcxx.llvm.org/UsingLibcxx.html#assertions-mode + # https://libcxx.llvm.org/Hardening.html#using-hardened-mode + -Xarch_host -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE + EOF + + cat >> "${ED}/etc/clang/gentoo-hardened-ld.cfg" <<-EOF || die + # Options below are conditional on USE=hardened. + EOF + fi + + # We only install config files for supported ABIs because unprefixed tools + # might be used for crosscompilation where e.g. PIE may not be supported. + # See bug #912237 and bug #901247. Just ${CHOST} won't do due to bug #912685. + local abi + for abi in $(get_all_abis); do + local abi_chost=$(get_abi_CHOST "${abi}") + doclang_cfg "${abi_chost}" + done + + if use kernel_Darwin; then + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + # Gentoo Prefix on Darwin + -Wl,-search_paths_first + EOF + if use bootstrap-prefix ; then + # bootstrap-prefix is only set during stage2 of bootstrapping + # Prefix, where EPREFIX is set to EPREFIX/tmp. + # Here we need to point it at the future lib dir of the stage3's + # EPREFIX. + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + -Wl,-rpath,${EPREFIX}/../usr/lib + -Wl,-L,${EPREFIX}/../usr/lib + -isystem ${EPREFIX}/../usr/include + EOF + fi + # Using -Wl,-L instead of -L to trick compiler driver to put it + # after -isysroot's internal -L + cat >> "${ED}/etc/clang/gentoo-common.cfg" <<-EOF || die + -Wl,-rpath,${EPREFIX}/usr/lib + -Wl,-L,${EPREFIX}/usr/lib + -isystem ${EPREFIX}/usr/include + -isysroot ${EPREFIX}/MacOSX.sdk + EOF + fi + + if use emacs ; then + elisp-install clang ../tools/clang-format/clang-format.{el,elc} + elisp-make-site-file "${SITEFILE}" clang + fi +} + +pkg_preinst() { + if has_version -b sys-devel/gcc-config && has_version sys-devel/gcc + then + local gcc_path=$(gcc-config --get-lib-path 2>/dev/null) + if [[ -n ${gcc_path} ]]; then + cat >> "${ED}/etc/clang/gentoo-gcc-install.cfg" <<-EOF + --gcc-install-dir="${gcc_path%%:*}" + EOF + fi + fi +} + +pkg_postinst() { + use emacs && elisp-site-regen +} + +pkg_postrm() { + use emacs && elisp-site-regen +}
