summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-09-29 01:44:16 +0100
committerSam James <sam@gentoo.org>2023-09-30 10:38:40 +0100
commit5f54fc59c91393781a4fdace7e2cdc27f9651d15 (patch)
treefefe90317a965af47cbf6a9460a0f407b0a363c2
parenttoolchain.eclass: rework bootstrapping logic (diff)
downloadgentoo-5f54fc59c91393781a4fdace7e2cdc27f9651d15.tar.gz
gentoo-5f54fc59c91393781a4fdace7e2cdc27f9651d15.tar.bz2
gentoo-5f54fc59c91393781a4fdace7e2cdc27f9651d15.zip
toolchain.eclass: support bootstrap-O3
Upstream are fine with bootstrapping with -O3, so don't strip it out if the user set it, even with USE=-custom-cflags. Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--eclass/toolchain.eclass22
1 files changed, 15 insertions, 7 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index a145e74d5521..90a6098445f5 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
@@ -1501,7 +1502,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).