[PATCH v2 3/6] scripts/Kconfig.toolchain: Clean up '-fno-allow-store-data-races' handling

From: Nathan Chancellor

Date: Wed Nov 11 2026 - 19:55:44 EST


Commit 454e00cf8ee5 ("kbuild: avoid re-running compiler and linker
probes") added two separate symbols for the "no allow store data races"
GCC flags. These flags serve the same purpose, so combine them using the
second argument of cc-option-str to handle the old value. To avoid
setting the second value of cc-option-str for clang, add a GCC
dependency to the symbol. This will eventually allow the cc-option-str
call to be eliminated when GCC 10 is the minimum version for the kernel.

Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
Makefile | 5 -----
scripts/Kconfig.toolchain | 7 ++-----
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index d73f2bbd3b93..fb2490faa8d1 100644
--- a/Makefile
+++ b/Makefile
@@ -949,12 +949,7 @@ KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
KBUILD_RUSTFLAGS += -Coverflow-checks=$(if $(CONFIG_RUST_OVERFLOW_CHECKS),y,n)

# Tell gcc to never replace conditional load with a non-conditional one
-ifdef CONFIG_CC_IS_GCC
-# gcc-10 renamed --param=allow-store-data-races=0 to
-# -fno-allow-store-data-races.
-KBUILD_CFLAGS += $(CONFIG_CC_OPT_ALLOW_STORE_DATA_RACES_PARAM)
KBUILD_CFLAGS += $(CONFIG_CC_OPT_NO_ALLOW_STORE_DATA_RACES)
-endif

ifdef CONFIG_READABLE_ASM
# Disable optimizations that make assembler listings hard to read.
diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
index 570c5a31016c..6520a06a9103 100644
--- a/scripts/Kconfig.toolchain
+++ b/scripts/Kconfig.toolchain
@@ -176,12 +176,9 @@ config CC_OPT_DIAGNOSTICS_SHOW_INLINING_CHAIN
config CC_OPT_STRICT_FLEX_ARRAYS
def_string "$(cc-option-str,-fstrict-flex-arrays=3)"

-# gcc-10 renamed --param=allow-store-data-races=0 to -fno-allow-store-data-races
-config CC_OPT_ALLOW_STORE_DATA_RACES_PARAM
- def_string "$(cc-option-str,--param=allow-store-data-races=0)"
-
config CC_OPT_NO_ALLOW_STORE_DATA_RACES
- def_string "$(cc-option-str,-fno-allow-store-data-races)"
+ # gcc-10 renamed --param=allow-store-data-races=0 to -fno-allow-store-data-races
+ def_string "$(cc-option-str,-fno-allow-store-data-races,--param=allow-store-data-races=0)" if CC_IS_GCC

config CC_HAS_MNOP_MCOUNT
def_bool $(cc-option,-mnop-mcount)

--
2.56.0