mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 17:09:10 -07:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user