mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 12:16:41 +02:00
eclass/toolchain: Sync with Gentoo
It's from Gentoo commit 729c11d560d55971b8f46295fce77afc4e895265.
This commit is contained in:
parent
c04ff0bb16
commit
f6fc178414
@ -333,6 +333,7 @@ if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] ; then
|
||||
# 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.2.1_p20241026 ${PV} && IUSE+=" time64"
|
||||
tc_version_is_at_least 15.0.0_pre20241124 ${PV} && IUSE+=" libdiagnostics"
|
||||
fi
|
||||
|
||||
if tc_version_is_at_least 10; then
|
||||
@ -575,6 +576,19 @@ toolchain_pkg_pretend() {
|
||||
_tc_use_if_iuse objc++ && \
|
||||
ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
|
||||
fi
|
||||
|
||||
# Do the check for pure source builds only, since the override
|
||||
# cannot work with binary packages, see https://bugs.gentoo.org/944198
|
||||
if [[ ${BUILD_TYPE} == source ]] && in_iuse time64 && ! use time64 &&
|
||||
has_version -r "${CATEGORY}/${PN}[time64(-)]" &&
|
||||
[[ ! ${TC_FORCE_TIME32} ]]
|
||||
then
|
||||
eerror "Attempting to build USE=-time64 version of gcc when at least"
|
||||
eerror "one USE=time64 version is installed. Did you accidentally"
|
||||
eerror "switch back to a non-time64 profile? If this is really"
|
||||
eerror "desirable, set TC_FORCE_TIME32=1 to force the build."
|
||||
die "Attempting to build USE=-time64 on a USE=time64 system"
|
||||
fi
|
||||
}
|
||||
|
||||
#---->> pkg_setup <<----
|
||||
@ -1065,7 +1079,7 @@ toolchain_src_configure() {
|
||||
|
||||
downgrade_arch_flags
|
||||
gcc_do_filter_flags
|
||||
if tc_version_is_at_least 14.2.1_p20241026 ${PV}; then
|
||||
if [[ ${PN} != kgcc64 && ${PN} != gcc-* ]] && tc_version_is_at_least 14.2.1_p20241026 ${PV}; then
|
||||
append-cppflags "-D_GENTOO_TIME64_FORCE=$(usex time64 1 0)"
|
||||
fi
|
||||
|
||||
@ -1185,11 +1199,13 @@ toolchain_src_configure() {
|
||||
if grep -q "experimental" gcc/DEV-PHASE ; then
|
||||
# Tell users about the non-obvious behavior here so they don't think
|
||||
# e.g. the next GCC release is super slow to compile things.
|
||||
ewarn "Unreleased GCCs default to extra runtime checks even with USE=-debug,"
|
||||
ewarn "matching upstream default behavior. We recommend keeping these enabled."
|
||||
ewarn "The checks (sometimes substantially) increase build time but provide important protection"
|
||||
ewarn "from potential miscompilations (wrong code) by turning them into build-time errors."
|
||||
ewarn "To override (not recommended), set: GCC_CHECKS_LIST=\"release\"."
|
||||
if ! use debug ; then
|
||||
ewarn "Unreleased GCCs default to extra runtime checks even with USE=-debug,"
|
||||
ewarn "matching upstream default behavior. We recommend keeping these enabled."
|
||||
ewarn "The checks (sometimes substantially) increase build time but provide important protection"
|
||||
ewarn "from potential miscompilations (wrong code) by turning them into build-time errors."
|
||||
ewarn "To override (not recommended), set: GCC_CHECKS_LIST=\"release\"."
|
||||
fi
|
||||
|
||||
# - USE=debug for pre-releases: yes,extra,rtl (stornger than USE=debug for releases)
|
||||
# - USE=-debug for pre-releases: yes,extra (following upstream default)
|
||||
@ -1588,6 +1604,7 @@ toolchain_src_configure() {
|
||||
|
||||
enable_cet_for 'x86_64' 'gnu' 'cet'
|
||||
enable_cet_for 'aarch64' 'gnu' 'standard-branch-protection'
|
||||
[[ ${CTARGET} == i[34567]86-* ]] && confgcc+=( --disable-cet )
|
||||
fi
|
||||
|
||||
if in_iuse systemtap ; then
|
||||
@ -1729,8 +1746,8 @@ toolchain_src_configure() {
|
||||
gcc_shell="${BROOT}"/bin/sh
|
||||
fi
|
||||
|
||||
if is_jit ; then
|
||||
einfo "Configuring JIT gcc"
|
||||
if is_jit || _tc_use_if_iuse libdiagnostics ; then
|
||||
einfo "Configuring shared gcc for JIT/libdiagnostics"
|
||||
|
||||
local confgcc_jit=(
|
||||
"${confgcc[@]}"
|
||||
@ -1754,8 +1771,10 @@ toolchain_src_configure() {
|
||||
--disable-nls
|
||||
--disable-objc-gc
|
||||
--disable-systemtap
|
||||
|
||||
--enable-host-shared
|
||||
--enable-languages=jit
|
||||
|
||||
# Might be used for the just-built GCC. Easier to just
|
||||
# respect USE=graphite here in case the user passes some
|
||||
# graphite flags rather than try strip them out.
|
||||
@ -1764,6 +1783,10 @@ toolchain_src_configure() {
|
||||
--with-system-zlib
|
||||
)
|
||||
|
||||
if tc_version_is_at_least 15.0.0_pre20241124 ${PV} ; then
|
||||
confgcc_jit+=( $(use_enable libdiagnostics) )
|
||||
fi
|
||||
|
||||
if tc_version_is_at_least 13.1 ; then
|
||||
confgcc_jit+=( --disable-fixincludes )
|
||||
fi
|
||||
@ -1956,6 +1979,7 @@ gcc_do_filter_flags() {
|
||||
|
||||
if ver_test -lt 15.1 ; then
|
||||
filter-flags -fdiagnostics-explain-harder -fdiagnostics-details
|
||||
filter-flags -fdiagnostics-set-output=text:experimental-nesting=yes
|
||||
fi
|
||||
|
||||
if is_d ; then
|
||||
@ -2267,10 +2291,6 @@ toolchain_src_test() {
|
||||
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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user