eclass/toolchain: Sync with Gentoo

It's from Gentoo commit 5bb51e9a29ab1683a36ed45c5aa56228b6968d3f.
This commit is contained in:
Flatcar Buildbot 2022-12-05 07:14:44 +00:00
parent 8d4dd68e0a
commit df3b1543d7

View File

@ -277,6 +277,9 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind )
tc_version_is_at_least 11 && IUSE+=" custom-cflags"
tc_version_is_at_least 12 && IUSE+=" ieee-long-double"
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"
fi
if tc_version_is_at_least 10; then
@ -289,7 +292,8 @@ fi
#---->> DEPEND <<----
RDEPEND="sys-libs/zlib
RDEPEND="
sys-libs/zlib
virtual/libiconv
nls? ( virtual/libintl )
"
@ -320,7 +324,8 @@ BDEPEND="
test? (
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
)"
)
"
DEPEND="${RDEPEND}"
if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then
@ -798,8 +803,18 @@ make_gcc_hard() {
if _tc_use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
if _tc_use_if_iuse default-stack-clash-protection ; then
# The define DEF_GENTOO_SCP is checked in 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
einfo "Updating gcc to use automatic stack clash protection ..."
gcc_hard_flags+=" -DDEF_GENTOO_SCP"
fi
if _tc_use_if_iuse default-znow ; then
# The define DEF_GENTOO_ZNOW is checked in 23_all_DEF_GENTOO_ZNOW-z-now.patch
einfo "Updating gcc to request symbol resolution at start (-z now) ..."
gcc_hard_flags+=" -DDEF_GENTOO_ZNOW"
fi
if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, like:
# Will add some hardened options as default, e.g. for gcc-12
# * -fstack-clash-protection
# * -z now
# See gcc *_all_extra-options.patch patches.
@ -1312,6 +1327,13 @@ toolchain_src_configure() {
# - bug #704784
# - https://gcc.gnu.org/PR93157
[[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
if in_iuse ieee-long-double; then
# musl requires 64-bit long double, not IBM double-double or IEEE quad.
if [[ ${CTARGET} == powerpc64le-*-gnu ]]; then
use ieee-long-double && confgcc+=( --with-long-double-format=ieee )
fi
fi
;;
riscv)
# Add --with-abi flags to set default ABI