From a664bdd217c8f4fbb108d6c2585425383b749b3b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 6 Mar 2020 18:29:12 +0000 Subject: [PATCH] toolchain.eclass: always use -O2, even when no -O is passed in. Mike noticed that CFLAGS without any optimization options still effectively are -O0. Let's follow glibc ebuild here and always use -O2. Suggested-by: Mike Gilbert Signed-off-by: Sergei Trofimovich --- eclass/toolchain.eclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index d69ce9503eaa..05d13189d3dd 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1494,8 +1494,12 @@ downgrade_arch_flags() { } gcc_do_filter_flags() { - replace-flags -O? -O2 # 701786 (-O3) + # Be conservative here: + # - don't allow -O3 and like to over-optimize libgcc # 701786 + # - don't allow -O0 to generate potentially invalid startup code strip-flags + filter-flags '-O?' + append-flags -O2 # dont want to funk ourselves filter-flags '-mabi*' -m31 -m32 -m64 -- 2.26.2