summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@gentoo.org>2024-10-01 16:07:21 -0400
committerEli Schwartz <eschwartz@gentoo.org>2024-10-01 19:04:04 -0400
commit9a089ae37edf29aa5956932209751379a1bceb21 (patch)
treeb5fa9d04fa419ccd8838797403e4caa30941bcf5 /eclass/toolchain.eclass
parenttoolchain.eclass: also reset STAGE1_CXXFLAGS for old compilers (diff)
downloadgentoo-9a089ae37edf29aa5956932209751379a1bceb21.tar.gz
gentoo-9a089ae37edf29aa5956932209751379a1bceb21.tar.bz2
gentoo-9a089ae37edf29aa5956932209751379a1bceb21.zip
toolchain.eclass: restrict *FLAGS for stage1 compiler when bootstrapping
e.g. if gnat1 from a bootstrap compiler is older than the host compiler itself, we are going to end up passing flags that the host compiler does understand, but gnat1 does not. This is trivially broken with -march=native (passes loads of flags) and also more plebeian things such as -march=x86-64-v3 which is sadly too new for gnat-10 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass7
1 files changed, 7 insertions, 0 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index d5570a746a2e..6a816a66275d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2077,6 +2077,13 @@ gcc_do_make() {
if ! tc-is-gcc || ver_test $(gcc-fullversion) -lt 10 ; then
STAGE1_CFLAGS="-O0"
STAGE1_CXXFLAGS="-O0"
+ # We have a very good host compiler but it may be a bit too good, and
+ # know about flags that the version we are compiling does not know
+ # about. In principle we could check e.g. which gnat1 we are using as
+ # a bootstrap. It's simpler to do it unconditionally for now.
+ elif _tc_use_if_iuse ada || _tc_use_if_iuse d; then
+ STAGE1_CFLAGS="-O2"
+ STAGE1_CXXFLAGS="-O2"
fi
# We only want to use the system's CFLAGS if not building a