summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-10-30 10:59:17 +0000
committerMark Brown <broonie@kernel.org>2026-10-30 10:59:17 +0000
commitc56685eb76c7bd9b38ab4fe2c1ebfebc8bf83104 (patch)
tree7014bc8e5603448418a0f673cfc354d6af854ab1
parentb76eb7c1d52e4b26ad6db30fc90b5d81d1fe6455 (diff)
parent83deedcf85af511dc120b3cd8ee597d211cdf2fb (diff)
downloadlinux-next-c56685eb76c7bd9b38ab4fe2c1ebfebc8bf83104.tar.gz
linux-next-c56685eb76c7bd9b38ab4fe2c1ebfebc8bf83104.zip
Merge branch 'kbuild-fixes-for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git
-rw-r--r--Makefile3
-rw-r--r--scripts/Kconfig.toolchain23
2 files changed, 21 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 7e6baa461b91..451e35112238 100644
--- a/Makefile
+++ b/Makefile
@@ -1059,7 +1059,8 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
endif
endif
ifdef CONFIG_HAVE_FENTRY
- ifdef CONFIG_CC_HAS_MFENTRY
+ # s390-linux-gnu-gcc did not support -mfentry until gcc-9.
+ ifeq ($(call cc-option-yn, -mfentry),y)
CC_FLAGS_FTRACE += -mfentry
CC_FLAGS_USING += -DCC_USING_FENTRY
endif
diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
index 4b962831d62a..2acbd40a38f1 100644
--- a/scripts/Kconfig.toolchain
+++ b/scripts/Kconfig.toolchain
@@ -144,6 +144,25 @@ config CC_HAS_ASSUME
config CC_HAS_NO_PROFILE_FN_ATTR
def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror)
+# Beware of two problems when using cc-option in Kconfig compared to Kbuild
+#
+# 1. cc-option in Kbuild tests the provided flags with all previously added
+# CFLAGS, whereas cc-option in Kconfig only tests the provided flags with a
+# small, constant set of additional flags. If a flag (e.g., '-mfoo')
+# depends on another (e.g, '-fbar') to function properly, the dependency
+# must be included in the cc-option call (e.g, '-fbar -mfoo').
+#
+# 2. Bit and endianness flags ('-m32', '-m64', '-mbig-endian', and
+# '-mlittle-endian') are not present in Kconfig cc-option checks because
+# they may be included in KBUILD_CFLAGS / KBUILD_CPPFLAGS based on the
+# finalized configuration result. This can result in inconsistent results
+# when probing toolchains that support either option, as the toolchain's
+# configured default tested in Kconfig may not support the tested flag but
+# the post-configuration result in Kbuild would.
+#
+# In general, prefer adding truly generic compiler flags to avoid this
+# pitfall.
+
config CC_OPT_ZERO_INIT_PADDING_BITS
def_string "$(cc-option-str,-fzero-init-padding-bits=all)"
@@ -169,10 +188,6 @@ config CC_OPT_NO_ALLOW_STORE_DATA_RACES
config CC_HAS_MNOP_MCOUNT
def_bool $(cc-option,-mnop-mcount)
-# s390-linux-gnu-gcc did not support -mfentry until gcc-9.
-config CC_HAS_MFENTRY
- def_bool $(cc-option,-mfentry)
-
config LD_OPT_FORCE_GROUP_ALLOCATION
def_string "$(ld-option-str,--force-group-allocation)"