mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 22:12:10 +01:00
eclass/toolchain: Sync with Gentoo
It's from Gentoo commit 7a1590d2e910c2a6d48aad377c34cf104cc486cb.
This commit is contained in:
parent
adfb4380c2
commit
80f54448f4
@ -753,6 +753,9 @@ setup_multilib_osdirnames() {
|
|||||||
#---->> src_configure <<----
|
#---->> src_configure <<----
|
||||||
|
|
||||||
toolchain_src_configure() {
|
toolchain_src_configure() {
|
||||||
|
BUILD_CONFIG_TARGETS=()
|
||||||
|
is-flagq '-O3' && BUILD_CONFIG_TARGETS+=( bootstrap-O3 )
|
||||||
|
|
||||||
downgrade_arch_flags
|
downgrade_arch_flags
|
||||||
gcc_do_filter_flags
|
gcc_do_filter_flags
|
||||||
|
|
||||||
@ -772,8 +775,6 @@ toolchain_src_configure() {
|
|||||||
|
|
||||||
local confgcc=( --host=${CHOST} )
|
local confgcc=( --host=${CHOST} )
|
||||||
|
|
||||||
local build_config_targets=()
|
|
||||||
|
|
||||||
if is_crosscompile || tc-is-cross-compiler ; then
|
if is_crosscompile || tc-is-cross-compiler ; then
|
||||||
# Straight from the GCC install doc:
|
# Straight from the GCC install doc:
|
||||||
# "GCC has code to correctly determine the correct value for target
|
# "GCC has code to correctly determine the correct value for target
|
||||||
@ -898,11 +899,11 @@ toolchain_src_configure() {
|
|||||||
|
|
||||||
# Build compiler itself using LTO
|
# Build compiler itself using LTO
|
||||||
if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
|
if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
|
||||||
build_config_targets+=( bootstrap-lto )
|
BUILD_CONFIG_TARGETS+=( bootstrap-lto )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
|
if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
|
||||||
build_config_targets+=( bootstrap-cet )
|
BUILD_CONFIG_TARGETS+=( bootstrap-cet )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Support to disable PCH when building libstdcxx
|
# Support to disable PCH when building libstdcxx
|
||||||
@ -1321,9 +1322,9 @@ toolchain_src_configure() {
|
|||||||
|
|
||||||
confgcc+=( "$@" ${EXTRA_ECONF} )
|
confgcc+=( "$@" ${EXTRA_ECONF} )
|
||||||
|
|
||||||
if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${build_config_targets} ]] ; then
|
if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${BUILD_CONFIG_TARGETS} ]] ; then
|
||||||
# e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet'
|
# e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet'
|
||||||
confgcc+=( --with-build-config="${build_config_targets[*]}" )
|
confgcc+=( --with-build-config="${BUILD_CONFIG_TARGETS[*]}" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Nothing wrong with a good dose of verbosity
|
# Nothing wrong with a good dose of verbosity
|
||||||
@ -1353,20 +1354,43 @@ toolchain_src_configure() {
|
|||||||
if is_jit ; then
|
if is_jit ; then
|
||||||
einfo "Configuring JIT gcc"
|
einfo "Configuring JIT gcc"
|
||||||
|
|
||||||
|
local confgcc_jit=(
|
||||||
|
"${confgcc[@]}"
|
||||||
|
|
||||||
|
--disable-analyzer
|
||||||
|
--disable-bootstrap
|
||||||
|
--disable-cet
|
||||||
|
--disable-default-pie
|
||||||
|
--disable-default-ssp
|
||||||
|
--disable-gcov
|
||||||
|
--disable-libada
|
||||||
|
--disable-libatomic
|
||||||
|
--disable-libgomp
|
||||||
|
--disable-libitm
|
||||||
|
--disable-libquadmath
|
||||||
|
--disable-libsanitizer
|
||||||
|
--disable-libssp
|
||||||
|
--disable-libstdcxx-pch
|
||||||
|
--disable-libvtv
|
||||||
|
--disable-lto
|
||||||
|
--disable-nls
|
||||||
|
--disable-objc-gc
|
||||||
|
--disable-systemtap
|
||||||
|
--enable-host-shared
|
||||||
|
--enable-languages=jit
|
||||||
|
--without-isl
|
||||||
|
--without-zstd
|
||||||
|
--with-system-zlib
|
||||||
|
)
|
||||||
|
|
||||||
|
if tc_version_is_at_least 13.1 ; then
|
||||||
|
confgcc_jit+=( --disable-fixincludes )
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "${WORKDIR}"/build-jit || die
|
mkdir -p "${WORKDIR}"/build-jit || die
|
||||||
pushd "${WORKDIR}"/build-jit > /dev/null || die
|
pushd "${WORKDIR}"/build-jit > /dev/null || die
|
||||||
CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure \
|
|
||||||
"${confgcc[@]}" \
|
CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure "${confgcc_jit[@]}"
|
||||||
--disable-libada \
|
|
||||||
--disable-libsanitizer \
|
|
||||||
--disable-libvtv \
|
|
||||||
--disable-libgomp \
|
|
||||||
--disable-libquadmath \
|
|
||||||
--disable-libatomic \
|
|
||||||
--disable-lto \
|
|
||||||
--disable-bootstrap \
|
|
||||||
--enable-host-shared \
|
|
||||||
--enable-languages=jit
|
|
||||||
popd > /dev/null || die
|
popd > /dev/null || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1501,7 +1525,14 @@ gcc_do_filter_flags() {
|
|||||||
|
|
||||||
# Lock gcc at -O2; we want to be conservative here.
|
# Lock gcc at -O2; we want to be conservative here.
|
||||||
filter-flags '-O?'
|
filter-flags '-O?'
|
||||||
append-flags -O2
|
|
||||||
|
# We allow -O3 given it's a supported option upstream.
|
||||||
|
# Only add -O2 if we're not doing -O3.
|
||||||
|
if [[ ${BUILD_CONFIG_TARGETS[@]} == *bootstrap-O3* ]] ; then
|
||||||
|
append-flags '-O3'
|
||||||
|
else
|
||||||
|
append-flags '-O2'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Please use USE=lto instead (bug #906007).
|
# Please use USE=lto instead (bug #906007).
|
||||||
@ -1647,44 +1678,61 @@ gcc_do_make() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
|
local emakeargs=(
|
||||||
STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
|
LDFLAGS="${LDFLAGS}"
|
||||||
fi
|
LIBPATH="${LIBPATH}"
|
||||||
|
)
|
||||||
|
|
||||||
if is_crosscompile; then
|
if is_crosscompile; then
|
||||||
# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
|
# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
|
||||||
# but I'll leave this in anyways as someone might have had
|
# but I'll leave this in anyways as someone might have had
|
||||||
# some reason for putting it in here... --eradicator
|
# some reason for putting it in here... --eradicator
|
||||||
BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
|
BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
|
||||||
|
emakeargs+=( BOOT_CFLAGS="${BOOT_CFLAGS}" )
|
||||||
else
|
else
|
||||||
# we only want to use the system's CFLAGS if not building a
|
# XXX: Hack for bug #914881, clean this up when fixed and go back
|
||||||
|
# to just calling get_abi_LDFLAGS as before.
|
||||||
|
local abi_ldflags="$(get_abi_LDFLAGS ${TARGET_DEFAULT_ABI})"
|
||||||
|
if [[ -n ${abi_ldflags} ]] ; then
|
||||||
|
printf -v abi_ldflags -- "-Wl,%s " ${abi_ldflags}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the host compiler is too old, let's use -O0 per the upstream
|
||||||
|
# default to be safe (to avoid a bootstrap comparison failure later).
|
||||||
|
#
|
||||||
|
# The last known issues are with < GCC 4.9 or so, but it's easier
|
||||||
|
# to keep this bound somewhat fresh just to avoid problems. Ultimately,
|
||||||
|
# using not-O0 is just a build-time speed improvement anyway.
|
||||||
|
if tc-is-gcc && ver_test $(gcc-fullversion) -lt 10 ; then
|
||||||
|
STAGE1_CFLAGS="-O0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We only want to use the system's CFLAGS if not building a
|
||||||
# cross-compiler.
|
# cross-compiler.
|
||||||
|
STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
|
||||||
|
STAGE1_LDFLAGS=${STAGE1_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
|
||||||
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
|
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
|
||||||
|
BOOT_LDFLAGS=${BOOT_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
|
||||||
|
LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}"
|
||||||
|
|
||||||
|
emakeargs+=(
|
||||||
|
STAGE1_CFLAGS="${STAGE1_CFLAGS}"
|
||||||
|
STAGE1_LDFLAGS="${STAGE1_LDFLAGS}"
|
||||||
|
BOOT_CFLAGS="${BOOT_CFLAGS}"
|
||||||
|
BOOT_LDFLAGS="${BOOT_LDFLAGS}"
|
||||||
|
LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}"
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_jit ; then
|
if is_jit ; then
|
||||||
# TODO: docs for jit?
|
# TODO: docs for jit?
|
||||||
pushd "${WORKDIR}"/build-jit > /dev/null || die
|
|
||||||
|
|
||||||
einfo "Building JIT"
|
einfo "Building JIT"
|
||||||
emake \
|
emake -C "${WORKDIR}"/build-jit "${emakeargs[@]}"
|
||||||
LDFLAGS="${LDFLAGS}" \
|
|
||||||
STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
|
|
||||||
LIBPATH="${LIBPATH}" \
|
|
||||||
BOOT_CFLAGS="${BOOT_CFLAGS}"
|
|
||||||
popd > /dev/null || die
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
|
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
|
||||||
|
|
||||||
pushd "${WORKDIR}"/build >/dev/null || die
|
pushd "${WORKDIR}"/build >/dev/null || die
|
||||||
|
emake "${emakeargs[@]}" ${GCC_MAKE_TARGET}
|
||||||
emake \
|
|
||||||
LDFLAGS="${LDFLAGS}" \
|
|
||||||
STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
|
|
||||||
LIBPATH="${LIBPATH}" \
|
|
||||||
BOOT_CFLAGS="${BOOT_CFLAGS}" \
|
|
||||||
${GCC_MAKE_TARGET}
|
|
||||||
|
|
||||||
if is_ada; then
|
if is_ada; then
|
||||||
# Without these links, it is not getting the good compiler
|
# Without these links, it is not getting the good compiler
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user