summaryrefslogtreecommitdiff
path: root/eclass/toolchain.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-09-30 11:39:43 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-09-30 11:39:43 +0100
commitc417025a2ab386cddabb71ad598a9b75b47af313 (patch)
tree65963e1f2e99ed22f278cdb819bb1d0892062731 /eclass/toolchain.eclass
parent49fadb6686800eac5ce039896df6437ac7240c8c (diff)
gentoo auto-resync : 30:09:2023 - 11:39:43
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass124
1 files changed, 85 insertions, 39 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d93068619cf9..90576f2067ea 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -753,6 +753,9 @@ setup_multilib_osdirnames() {
#---->> src_configure <<----
toolchain_src_configure() {
+ BUILD_CONFIG_TARGETS=()
+ is-flagq '-O3' && BUILD_CONFIG_TARGETS+=( bootstrap-O3 )
+
downgrade_arch_flags
gcc_do_filter_flags
@@ -772,8 +775,6 @@ toolchain_src_configure() {
local confgcc=( --host=${CHOST} )
- local build_config_targets=()
-
if is_crosscompile || tc-is-cross-compiler ; then
# Straight from the GCC install doc:
# "GCC has code to correctly determine the correct value for target
@@ -898,11 +899,11 @@ toolchain_src_configure() {
# Build compiler itself using LTO
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
if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
- build_config_targets+=( bootstrap-cet )
+ BUILD_CONFIG_TARGETS+=( bootstrap-cet )
fi
# Support to disable PCH when building libstdcxx
@@ -1321,9 +1322,9 @@ toolchain_src_configure() {
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'
- confgcc+=( --with-build-config="${build_config_targets[*]}" )
+ confgcc+=( --with-build-config="${BUILD_CONFIG_TARGETS[*]}" )
fi
# Nothing wrong with a good dose of verbosity
@@ -1353,20 +1354,43 @@ toolchain_src_configure() {
if is_jit ; then
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
pushd "${WORKDIR}"/build-jit > /dev/null || die
- CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure \
- "${confgcc[@]}" \
- --disable-libada \
- --disable-libsanitizer \
- --disable-libvtv \
- --disable-libgomp \
- --disable-libquadmath \
- --disable-libatomic \
- --disable-lto \
- --disable-bootstrap \
- --enable-host-shared \
- --enable-languages=jit
+
+ CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure "${confgcc_jit[@]}"
popd > /dev/null || die
fi
@@ -1501,7 +1525,14 @@ gcc_do_filter_flags() {
# Lock gcc at -O2; we want to be conservative here.
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
# Please use USE=lto instead (bug #906007).
@@ -1647,44 +1678,59 @@ gcc_do_make() {
fi
fi
- if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
- STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
- fi
+ local emakeargs=(
+ LDFLAGS="${LDFLAGS}"
+ LIBPATH="${LIBPATH}"
+ )
if is_crosscompile; then
# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
# but I'll leave this in anyways as someone might have had
# some reason for putting it in here... --eradicator
BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
+ emakeargs+=( BOOT_CFLAGS="${BOOT_CFLAGS}" )
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})"
+ printf -v abi_ldflags -- "-Wl,%s " ${abi_ldflags}
+
+ # 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.
+ 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_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
if is_jit ; then
# TODO: docs for jit?
- pushd "${WORKDIR}"/build-jit > /dev/null || die
-
einfo "Building JIT"
- emake \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}"
- popd > /dev/null || die
+ emake -C "${WORKDIR}"/build-jit "${emakeargs[@]}"
fi
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
-
pushd "${WORKDIR}"/build >/dev/null || die
-
- emake \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}" \
- ${GCC_MAKE_TARGET}
+ emake "${emakeargs[@]}" ${GCC_MAKE_TARGET}
if is_ada; then
# Without these links, it is not getting the good compiler