eclass/toolchain: Sync with Gentoo

It's from Gentoo commit dc98ced8ef0ff5784b8fe79b031c959526156fd1.
This commit is contained in:
Flatcar Buildbot 2025-06-16 07:11:54 +00:00 committed by Krzesimir Nowak
parent 2a3635727f
commit e3ed5813fa

View File

@ -338,7 +338,7 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
# and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why
# it was disabled in 13. # it was disabled in 13.
tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" TC_FEATURES+=( rust ) tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" TC_FEATURES+=( rust )
tc_version_is_at_least 14.2.1_p20241026 ${PV} && IUSE+=" time64" tc_version_is_at_least 13.3.1_p20250522 ${PV} && IUSE+=" time64"
tc_version_is_at_least 15.0.0_pre20241124 ${PV} && IUSE+=" libgdiagnostics" tc_version_is_at_least 15.0.0_pre20241124 ${PV} && IUSE+=" libgdiagnostics"
tc_version_is_at_least 15.0.1_pre20250316 ${PV} && IUSE+=" cobol" tc_version_is_at_least 15.0.1_pre20250316 ${PV} && IUSE+=" cobol"
fi fi
@ -772,6 +772,19 @@ do_gcc_gentoo_patches() {
eapply "${WORKDIR}"/musl/{,nocross/}*.patch eapply "${WORKDIR}"/musl/{,nocross/}*.patch
${shopt_save} ${shopt_save}
fi fi
#
# THIS IS A TEMPORARY SOLUTION AND SHOULD BE REPLACED BY A PROPER FIX.
# Adding it so we can already build stages for further testing. -dilfridge
#
if [[ ${CTARGET} == m68*-aligned-* ]]; then
einfo "Hard-wiring m68k -malign-int switch into gcc"
echo '#define DRIVER_SELF_SPECS "-malign-int"' >> "${S}/gcc/config/m68k/m68k.h" || die
fi
#
# END TEMPORARY SOLUTION
#
fi fi
} }
@ -1139,6 +1152,15 @@ toolchain_setup_ada() {
! tc-is-cross-compiler && _toolchain_make_gnat_wrappers ! tc-is-cross-compiler && _toolchain_make_gnat_wrappers
export CC="$(tc-getCC) -specs=${T}/ada.spec" export CC="$(tc-getCC) -specs=${T}/ada.spec"
if ver_test ${PV} -lt 13 && [[ ${CTARGET} == hppa* ]] ; then
# For HPPA, the ada-bootstrap binaries seem to default
# to -fstack-protector still (maybe because of cross-building)
# so we need to override it for <13 (which ignores -fstack-protector)
# as SSP doesn't exist there. The GNAT configure test gets confused
# by GCC warning about this otherwise.
CC+=" -fno-stack-protector"
fi
} }
# @FUNCTION: toolchain_setup_d # @FUNCTION: toolchain_setup_d
@ -1180,7 +1202,7 @@ toolchain_src_configure() {
downgrade_arch_flags downgrade_arch_flags
gcc_do_filter_flags gcc_do_filter_flags
if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] && tc_version_is_at_least 14.2.1_p20241026 ${PV}; then if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] && tc_version_is_at_least 13.3.1_p20250522 ${PV}; then
append-cppflags "-D_GENTOO_TIME64_FORCE=$(usex time64 1 0)" append-cppflags "-D_GENTOO_TIME64_FORCE=$(usex time64 1 0)"
fi fi
@ -2680,8 +2702,8 @@ toolchain_src_install() {
# Hack for C++ modules # Hack for C++ modules
if ! is_crosscompile && tc_version_is_at_least 15.0.1_pre20250316 ${PV}; then if ! is_crosscompile && tc_version_is_at_least 15.0.1_pre20250316 ${PV}; then
# PR19266 (bug #948394) # PR19266 (bug #948394)
sed -i -e "s,\.\./lib/gcc/${CHOST}/${GCCMAJOR}/include/,include/," \ find "${ED}"/usr/lib/gcc/${CHOST}/${GCCMAJOR} -name libstdc++.modules.json \
"${ED}"/usr/lib/gcc/${CHOST}/${GCCMAJOR}/libstdc++.modules.json || die -exec sed -i -e "s,\"source-path\": \".*gcc/${CHOST}/${GCCMAJOR}/include/,\"source-path\": \"include/," "{}" + || die
fi fi
# As gcc installs object files built against both ${CHOST} and ${CTARGET} # As gcc installs object files built against both ${CHOST} and ${CTARGET}
@ -2780,6 +2802,8 @@ toolchain_src_install() {
# Don't scan .gox files for executable stacks - false positives # Don't scan .gox files for executable stacks - false positives
export QA_EXECSTACK="usr/lib*/go/*/*.gox" export QA_EXECSTACK="usr/lib*/go/*/*.gox"
export QA_WX_LOAD="usr/lib*/go/*/*.gox" export QA_WX_LOAD="usr/lib*/go/*/*.gox"
# Workaround bug #793770
export QA_PRESTRIPPED="usr/lib*/go/*/*/*.gox"
# Disable RANDMMAP so PCH works, bug #301299 # Disable RANDMMAP so PCH works, bug #301299
pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1" pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"