eclass/toolchain: Sync with Gentoo

It's from Gentoo commit eb9d324cb45589e287e6cce64f3110acccf1e47c.
This commit is contained in:
Flatcar Buildbot 2024-08-12 07:17:32 +00:00 committed by Krzesimir Nowak
parent aeca7bf1c4
commit 88af8752d7

View File

@ -1214,7 +1214,14 @@ toolchain_src_configure() {
# - https://git.musl-libc.org/cgit/musl/tree/INSTALL
# - bug #704784
# - https://gcc.gnu.org/PR93157
[[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
# musl additionally does not support libquadmath. See:
# - https://gcc.gnu.org/PR116007
[[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=(
--with-abi=elfv2
--disable-libquadmath
--disable-libquadmath-support
--with-long-double-128=no
)
if in_iuse ieee-long-double; then
# musl requires 64-bit long double, not IBM double-double or IEEE quad.
@ -1654,9 +1661,6 @@ gcc_do_filter_flags() {
# New in GCC 14.
filter-flags -Walloc-size
else
# Makes things painfully slow and no real benefit for the compiler.
append-flags $(test-flags-CC -fno-harden-control-flow-redundancy)
fi
# Please use USE=lto instead (bug #906007).
@ -1894,7 +1898,6 @@ gcc_do_make() {
#---->> src_test <<----
# TODO: add JIT testing
# TODO: add multilib testing
toolchain_src_test() {
# GCC's testsuite is a special case.
#
@ -1917,11 +1920,79 @@ toolchain_src_test() {
local -x LD_PRELOAD=
# Controls running expensive tests in e.g. the torture testsuite.
# Note that 'TEST', not 'TESTS', is correct here as it's a GCC
# testsuite variable, not ours.
local -x GCC_TEST_RUN_EXPENSIVE=1
# Use a subshell to allow meddling with flags just for the testsuite
(
# Workaround our -Wformat-security default which breaks
# various tests as it adds unexpected warning output.
GCC_TESTS_CFLAGS+=" -Wno-format-security -Wno-format"
GCC_TESTS_CXXFLAGS+=" -Wno-format-security -Wno-format"
# Workaround our -Wtrampolines default which breaks
# tests too.
GCC_TESTS_CFLAGS+=" -Wno-trampolines"
GCC_TESTS_CXXFLAGS+=" -Wno-trampolines"
# A handful of Ada (and objc++?) tests need an executable stack
GCC_TESTS_LDFLAGS+=" -Wl,--no-warn-execstack"
# Avoid confusing tests like Fortran/C interop ones where
# CFLAGS are used.
GCC_TESTS_CFLAGS+=" -Wno-complain-wrong-lang"
GCC_TESTS_CXXFLAGS+=" -Wno-complain-wrong-lang"
# Issues with Ada tests:
# gnat.dg/align_max.adb
# gnat.dg/trampoline4.adb
#
# A handful of Ada tests use -fstack-check and conflict
# with -fstack-clash-protection.
#
# TODO: This isn't ideal given it obv. affects codegen
# and we want to be sure it works.
GCC_TESTS_CFLAGS+=" -fno-stack-clash-protection"
GCC_TESTS_CXXFLAGS+=" -fno-stack-clash-protection"
# configure defaults to '-O2 -g' and some tests expect it
# accordingly.
GCC_TESTS_CFLAGS+=" -g"
# TODO: Does this handle s390 (-m31) correctly?
# TODO: What if there are multiple ABIs like x32 too?
# XXX: Disabled until validate_failures.py can handle 'variants'
# XXX: https://gcc.gnu.org/PR116260
#is_multilib && GCC_TESTS_RUNTESTFLAGS+=" --target_board=unix{,-m32}"
# nonfatal here as we die if the comparison below fails. Also, note that
# the exit code of targets other than 'check' may be unreliable.
nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" RUNTESTFLAGS="${GCC_TESTS_RUNTESTFLAGS}"
#
# CFLAGS and so on are repeated here because of tests vs building test
# deps like libbacktrace.
#
# TODO: Should we try pass in the regular user flags for the non-RUNTESTFLAGS
# instances below for building e.g. libbacktrace?
nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \
RUNTESTFLAGS=" \
${GCC_TESTS_RUNTESTFLAGS} \
CFLAGS_FOR_TARGET='${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}' \
CXXFLAGS_FOR_TARGET='${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}' \
LDFLAGS_FOR_TARGET='${TEST_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}' \
CFLAGS='${GCC_TESTS_CFLAGS}' \
CXXFLAGS='${GCC_TESTS_CXXFLAGS}' \
FCFLAGS='${GCC_TESTS_FCFLAGS}' \
FFLAGS='${GCC_TESTS_FFLAGS}' \
LDFLAGS='${GCC_TESTS_LDFLAGS}' \
" \
CFLAGS_FOR_TARGET="${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}" \
CXXFLAGS_FOR_TARGET="${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}" \
LDFLAGS_FOR_TARGET="${GCC_TESTS_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}" \
CFLAGS="${GCC_TESTS_CFLAGS}" \
CXXFLAGS="${GCC_TESTS_CXXFLAGS}" \
FCFLAGS="${GCC_TESTS_FCFLAGS}" \
FFLAGS="${GCC_TESTS_FFLAGS}" \
LDFLAGS="${GCC_TESTS_LDFLAGS}"
)
# Produce an updated failure manifest.
einfo "Generating a new failure manifest ${T}/${CHOST}.xfail"