diff --git a/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass index ba83cad72c..87da1fba73 100644 --- a/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass +++ b/sdk_container/src/third_party/portage-stable/eclass/toolchain.eclass @@ -242,7 +242,14 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then IUSE+=" pgo" IUSE+=" objc-gc" TC_FEATURES+=( objc-gc ) IUSE+=" libssp objc++" - IUSE+=" +openmp" + + # Stop forcing openmp on by default in the eclass. Gradually phase it out. + # See bug #890999. + if tc_version_is_at_least 13.0.0_pre20221218 ; then + IUSE+=" openmp" + else + IUSE+=" +openmp" + fi tc_version_is_at_least 4.3 && IUSE+=" fixed-point" tc_version_is_at_least 4.7 && IUSE+=" go" @@ -281,6 +288,9 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow" tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection" tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2" + # See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html + # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why + # it was disabled in 13. tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" fi @@ -642,6 +652,11 @@ toolchain_src_unpack() { if tc_is_live ; then git-r3_src_unpack + # Needed for gcc --version to include the upstream commit used + # rather than only the commit after we apply our patches. + # It includes both with this. + echo "${EGIT_VERSION}" > "${S}"/gcc/REVISION || die + if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then toolchain_fetch_git_patches fi @@ -719,12 +734,11 @@ toolchain_src_prepare() { || eerror "Please file a bug about this" eend $? done - # bug #215828 - sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die - # Prevent new texinfo from breaking old versions (see #198182, bug #464008) - einfo "Remove texinfo (bug #198182, bug #464008)" - eapply "${FILESDIR}"/gcc-configure-texinfo.patch + # bug #215828 + if ! tc_version_is_at_least 4.6.0 ; then + sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die + fi if ! use prefix-guest && [[ -n ${EPREFIX} ]] ; then einfo "Prefixifying dynamic linkers..." @@ -1550,21 +1564,11 @@ toolchain_src_configure() { ) fi - if [[ ${PV} != *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then - # Disable gcc info regeneration -- it ships with generated info pages - # already. Our custom version/urls/etc... trigger it. bug #464008 - export gcc_cv_prog_makeinfo_modern=no - else - # Allow a fallback so we don't accidentally install no docs - # bug #834845 - ewarn "No pre-generated info pages in tarball. Allowing regeneration with texinfo..." - - if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then - # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed - # without corresponding ebuild changes. - eqawarn "Snapshot release with pre-generated info pages found!" - eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo." - fi + if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then + # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed + # without corresponding ebuild changes. + eqawarn "Snapshot release with pre-generated info pages found!" + eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo." fi # Do not let the X detection get in our way. We know things can be found @@ -1757,6 +1761,9 @@ gcc_do_filter_flags() { append-flags -O2 fi + # Please use USE=lto instead (bug #906007). + filter-lto + # Avoid shooting self in foot filter-flags '-mabi*' -m31 -m32 -m64 @@ -1893,7 +1900,7 @@ toolchain_src_compile() { touch "${S}"/gcc/c-gperf.h || die # Do not make manpages if we do not have perl ... - [[ ! -x /usr/bin/perl ]] \ + [[ ! -x "${BROOT}"/usr/bin/perl ]] \ && find "${WORKDIR}"/build -name '*.[17]' -exec touch {} + # To compile ada library standard files special compiler options are passed @@ -2083,16 +2090,6 @@ toolchain_src_install() { # Don't allow symlinks in private gcc include dir as this can break the build find gcc/include*/ -type l -delete || die - # Copy over the info pages. We disabled their generation earlier, but the - # build system only expects to install out of the build dir, not the source. bug #464008 - mkdir -p gcc/doc || die - local x= - for x in "${S}"/gcc/doc/*.info* ; do - if [[ -f ${x} ]] ; then - cp "${x}" gcc/doc/ || die - fi - done - # Re-enable fixincludes for >= GCC 13 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107128 if [[ ${GCCMAJOR} -lt 13 ]] ; then @@ -2119,7 +2116,7 @@ toolchain_src_install() { # # Do the 'make install' from the build directory pushd "${WORKDIR}"/build-jit > /dev/null || die - S="${WORKDIR}"/build-jit emake DESTDIR="${D}" install + S="${WORKDIR}"/build-jit emake DESTDIR="${D}" -j1 install # Punt some tools which are really only useful while building gcc find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; @@ -2133,7 +2130,17 @@ toolchain_src_install() { fi # Do the 'make install' from the build directory - S="${WORKDIR}"/build emake DESTDIR="${D}" install + # + # Unfortunately, we have to use -j1 for make install. Upstream + # don't really test it and there's not much appetite for fixing bugs + # with it. Several reported bugs exist where the resulting image + # was wrong, rather than a simple compile/install failure: + # - bug #906155 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42980 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51814 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103656 + # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109898 + S="${WORKDIR}"/build emake DESTDIR="${D}" -j1 install # Punt some tools which are really only useful while building gcc find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;