diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2020-11-08 10:56:44 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2020-11-08 11:40:32 +0000 |
commit | 41d8f38ef4686d1dff70fd651266ff57d56a7b06 (patch) | |
tree | 3e5f966e3ffa618fb419868c18360afe1b05e366 | |
parent | net-misc/icaclient: Removed old (diff) | |
download | gentoo-41d8f38ef4686d1dff70fd651266ff57d56a7b06.tar.gz gentoo-41d8f38ef4686d1dff70fd651266ff57d56a7b06.tar.bz2 gentoo-41d8f38ef4686d1dff70fd651266ff57d56a7b06.zip |
toolchain.eclass: add USE=custom-cflags for gcc-11
Sometimes it's useful to build gcc quickly with CFLAGS=-O0
as a smoke test for sanity. CFLAGS=-O3 should also generally
work as a code generation stres test. But not in general case.
Some options like -flto would probably not work as is.
Let's allow users to experiment with gcc flags if they really
want to.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rw-r--r-- | eclass/toolchain.eclass | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 32996a2f8f71..59f8660a3d90 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -181,6 +181,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then tc_version_is_at_least 9.1 && IUSE+=" lto" tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd) tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=(valgrind) + tc_version_is_at_least 11 && IUSE+=" custom-cflags" fi if tc_version_is_at_least 10; then @@ -1391,12 +1392,18 @@ downgrade_arch_flags() { } gcc_do_filter_flags() { - # 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 + # Allow users to explicitly avoid flag sanitization via + # USE=custom-cflags. + if ! _tc_use_if_iuse custom-cflags; then + # Over-zealous CFLAGS can often cause problems. What may work for one + # person may not work for another. To avoid a large influx of bugs + # relating to failed builds, we strip most CFLAGS out to ensure as few + # problems as possible. + strip-flags + # Lock gcc at -O2; we want to be conservative here. + filter-flags '-O?' + append-flags -O2 + fi # dont want to funk ourselves filter-flags '-mabi*' -m31 -m32 -m64 |