toolchain.eclass: mangle -O3 down to -O2, not -O0
authorSergei Trofimovich <slyfox@gentoo.org>
Thu, 5 Mar 2020 23:52:26 +0000 (23:52 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Thu, 5 Mar 2020 23:52:26 +0000 (23:52 +0000)
In bug #701786 'strip-flags' removed all unsafe options
first including -O3 and only then mangled -O? to -O2.

This effectively made gcc to compalie wth -O0, generated
huge slow profile and confused LTO.

Let's default to safer -O3->-O2 transition.

Reported-by: jeff.lemos.a@gmail.com
Closes: https://bugs.gentoo.org/701786
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
eclass/toolchain.eclass

index 62520ae92dff26354a3c0f0626de10c4313a26a8..d69ce9503eaa93fd9b5d1f106a21c3424155ea44 100644 (file)
@@ -1494,8 +1494,8 @@ downgrade_arch_flags() {
 }
 
 gcc_do_filter_flags() {
+       replace-flags -O? -O2 # 701786 (-O3)
        strip-flags
-       replace-flags -O? -O2
 
        # dont want to funk ourselves
        filter-flags '-mabi*' -m31 -m32 -m64