diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-30 14:11:27 -1000 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-30 14:11:27 -1000 |
| commit | e823910506ff3a34fb2966a9ecccc4019b2154dd (patch) | |
| tree | 33de8e146b29204475466f65e976ef1d680cf89a | |
| parent | 453ebbefe2e504057cdcd0e422ba39ed8b99434f (diff) | |
| parent | e58096244338308dde3fa76982c8042981ddda52 (diff) | |
| download | linux-e823910506ff3a34fb2966a9ecccc4019b2154dd.tar.gz linux-e823910506ff3a34fb2966a9ecccc4019b2154dd.zip | |
Merge tag 'kbuild-fixes-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux
Pull Kbuild fixes from Nathan Chancellor:
- Move probing of '-mfentry' back into Makefile instead of Kconfig
because it does not interact well with toolchains that support
multiple bit widths
- Add a big comment in scripts/Kconfig.toolchain of two pitfalls when
moving cc-option checks from Kbuild to Kconfig
* tag 'kbuild-fixes-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
scripts/Kconfig.toolchain: Highlight cc-option differences between Kconfig and Kbuild
kbuild: Move testing of '-mfentry' back to Makefile from Kconfig
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | scripts/Kconfig.toolchain | 23 |
2 files changed, 21 insertions, 5 deletions
@@ -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)" |
