summaryrefslogtreecommitdiff
path: root/scripts/Kconfig.toolchain
AgeCommit message (Collapse)Author
43 hoursMerge tag 'kbuild-fixes-7.4-1' of ↵Linus Torvalds
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
11 daysMerge tag 'kbuild-7.4-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux Pull Kbuild / Kconfig updates from Nathan Chancellor: "Kbuild: - Suppress compiler flags in debug info for external module builds - Use '-fmacro-prefix-map' in more places in the build - Merge initial set of changes from Lorenzo's speed up series, along with some fixes found through testing: - Avoid allocating .modinfo in vmlinux - Speed up kallsyms by indexing symbols by token and outputting binary data to disk directly then including in assembly via .incbin - Don't sort $(NM) output when unnecessary - Only emit relocations on the final vmlinx link - Reimplement mksysmap in C - Move many cc-option and ld-option calls into the Kconfig stage to cache their results - Use pigz for gzip compression when available - Move gen_init_cpio and gen_initramfs.sh from usr/ to scripts/ - Add a TOML configuration to scripts/container and update documentation accordingly - Add a generic, opt-in mechanism for checking that headers can compile standalone - Update machine function splitting argument for LLVM 24 rename in AutoFDO build - Miscellaneous minor clean ups, fixes, and hardening, mostly found/fixed via LLMs Kconfig: - Turn recursive ranges into an error - Fix savedefconfig for defaults that were adjusted for being out of range and revert a previously applied workaround - Improvements and hardening around integer and hexadecimal values - Emit a warning when selecting or implying a choice symbol, which has no effect - Emit a warning when KCONFIG_PROBABILITY is malformed - Introduce def_string / def_int / def_hex to mirror the existing def_bool / def_tristate to succinctly set a value and type at the same time. - Add cc-option-str and ld-option-str macros to act like Kbuild's cc-option and ld-option, returning the string when the option is supported, allowing many checks to be moved into Kconfig - Minor usability improvements to Kconfig tests" * tag 'kbuild-7.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: (59 commits) kbuild: AutoFDO: Update split machine function argument for upstream rename kbuild: Mark the initcall ordering recipe as recursive kbuild: Mark the gzip recipes as recursive localmodconfig: Explicitly report boolean configs during integrity check scripts/make_fit: Ignore schema checks when decomposing DTBs clang-tools: Import os for broken pipe handling kconfig: use the value argument in sym_get_near_range_bound() kconfig: fix infinite loop in conf_choice() when no choice value is visible kconfig: cleanup stale comment about 'keys' array kconfig: Improve ergonomics around disabling warnings with cc-option scripts/Kconfig.toolchain: Drop compiler symbols from dependencies checkkconfigsymbols.py: Parse Git status output line by line gen_init_cpio: stop parsing on lines with a missing argument list .gitignore: drop Module.markers .gitignore: ignore pacman package signatures kbuild: add header check facility as a manually run static analyzer Documentation: dev-tools: refer to user ID rather than id Documentation: dev-tools: update container.rst with config file scripts: add TOML config to container tool kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments ...
12 daysscripts/Kconfig.toolchain: Highlight cc-option differences between Kconfig ↵Nathan Chancellor
and Kbuild Performing cc-option checks in Kconfig instead of Kbuild can help speed up incremental builds where the configuration does not change, as the results of the probes can be easily cached. However, there are two potential issues that folks need to consider when using cc-option in Kconfig compared to Kbuild. The first is that in Kbuild, cc-option additions are cumulative, so KBUILD_CFLAGS += $(call cc-option,-mfoo) KBUILD_CFLAGS += $(call cc-option,-mbar) results in '-mbar' being tested with '-mfoo' if it was supported. In Kconfig, '-mbar' would be tested without '-mfoo', which could change the result if '-mbar' depends on '-mfoo' being present, so it would need to test support with $(cc-option,-mbar -mfoo) The second is that the Kconfig stage is where questions like "is the target architecture 32-bit or 64-bit" or "is the target architecture big or little endian" are answered, which very much matters for testing compiler options. Toolchains may be configured for either option, so the kernel needs to pass compiler flags like '-m32', '-m64', '-mlittle-endian', and '-mbig-endian' to properly match a user's configuration choices. Without these flags, '-mfoo' is tested against a toolchain's configured default, resulting in an inconsistent answer to whether the flag is actually supported for the requested configuration. This could manifest as a build breakage from an unexpectedly included but unsupported flag or missing functionality from an unexpected omitted flag. Add a big comment summarizing these two issues to help future travelers. Link: https://patch.msgid.link/20261020-kconfig-fix-mfentry-check-v1-2-428258bc0fc0@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
12 dayskbuild: Move testing of '-mfentry' back to Makefile from KconfigNathan Chancellor
Unlike cc-option in Kbuild, cc-option in Kconfig does not test options with either bit ('-m32' / '-m64') or endianness ('-mbig-endian' / '-mlittle-endian') flags because which flag to use may depend on the result of the configuration stage. This difference changes the result of testing for '-mfentry' support when using the kernel.org s390 cross compiler, which is configured for 32-bit by default. $ s390-linux-gcc -mfentry -o /dev/null -x c -c /dev/null cc1: error: '-mfentry' is supported only for 64-bit CPUs arch/s390/Makefile sets '-m64' in KBUILD_CPPFLAGS early, so '-mfentry' support was properly tested before the move to Kconfig. $ s390-linux-gcc -m64 -mfentry -o /dev/null -x c -c /dev/null Ricardo reported another issue with moving this check from Kbuild to Kconfig, as '-mfentry' is not supported for x86_32 without '-fno-pic', which affects GCC builds that are configured with PIE enabled by default. arch/x86/Makefile adds '-fno-pic' to KBUILD_CFLAGS, so this works properly in Kbuild. Move the '-mfentry' check back into Kbuild to avoid adding additional complexity to the Kconfig entry. Fixes: 454e00cf8ee5 ("kbuild: avoid re-running compiler and linker probes") Reported-by: Ricardo Ribalda <ribalda@chromium.org> Closes: https://lore.kernel.org/20261020-pie-v1-1-9be09f2324b1@chromium.org/ Link: https://patch.msgid.link/20261020-kconfig-fix-mfentry-check-v1-1-428258bc0fc0@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09kconfig: Improve ergonomics around disabling warnings with cc-optionNathan Chancellor
This is essentially a port of commit 550ccb178de2 ("Make 'cc-option' work correctly for the -Wno-xyzzy pattern") to scripts/Kconfig.include, which simplifies the definition of many of the newly added CC_OPT_WNO_ symbols in scripts/Kconfig.toolchain and matches cc-option's behavior in Kbuild. Reviewed-by: Nicolas Schier <nsc@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20261007-scripts-kconfig-toolchain-improvements-v1-2-1e524178da11@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-10-09scripts/Kconfig.toolchain: Drop compiler symbols from dependenciesNathan Chancellor
Commit 454e00cf8ee5 ("kbuild: avoid re-running compiler and linker probes") moved many cc-option calls from the main Makefile into Kconfig. In the process, code such as ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += $(call cc-option,-foo) endif was converted into Kconfig as config CC_OPT_FOO def_string "$(cc-option-str,-foo)" if CC_IS_GCC The 'if CC_IS_GCC' is generally unnecessary because it does not prevent the cc-option-str call from running (which is the primary reason the ifdef guards exists in the Makefile), as cc-option-str and the like are run before Kconfig even parses the dependency. It only impacts the symbol's visibility, which does not really matter in the general case, so remove these dependencies. Reviewed-by: Nicolas Schier <nsc@kernel.org> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://patch.msgid.link/20261007-scripts-kconfig-toolchain-improvements-v1-1-1e524178da11@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26kbuild: avoid re-running compiler and linker probesLorenzo Stoakes (ARM)
Each kernel make invocation begins with ~30 compiler and linker runs each of which performs duplicate probe for a number of compiler and linker options. This is useless work - the compiler and its version is known, so use these to determine which options are available, once. Using the newly introduced cc-option-str, track the result of each probe in CC_OPT_*, LD_OPT_* variables and have Makefile's simply append the symbol. Some care has to be taken around negative options, i.e. -Wno-xxx, as gcc accepts an unknown -Wno- without complaint and only complains later, so instead probe the positive form for these cases. Use CC_HAS_* For those probes that gate a Makefile conditional rather than a simple option, as per the established pattern for this. This change avoids a subtle issue with ppc32 (big endian) - clang doesn't accept -fno-stack-clash-protection on this sub-target, so keep this option in the Makefile. With gcc and clang, defconfig and allmodconfig, the recorded command lines are unchanged, a build with nothing to do rebuilds nothing and W=1 continues to function correctly. Doing this improves all builds, but has a particularly positive impact on no-op builds (builds where nothing has changed). Whole build, 128-thread Threadripper 9980X, best of N runs: before after delta ------------------------------- x86 defconfig, no-op make, gcc 0.78s 0.60s -0.18s (-23%) x86 defconfig, no-op make, clang 0.94s 0.66s -0.28s (-30%) x86 defconfig, touch mm/vma.c, gcc 8.6s 8.5s -0.16s (-2%) x86 defconfig, touch mm/vma.c, clang 8.0s 7.7s -0.24s (-3%) x86 defconfig, clean, clang 29.8s 29.4s -0.37s (-1%) x86 allmodconfig, no-op make, gcc 12.9s 12.7s -0.23s (-2%) x86 allmodconfig, no-op make, clang 14.2s 13.9s -0.29s (-2%) x86 allmodconfig, touch mm/vma.c, clang 32.2s 31.9s -0.30s (-1%) Assisted-by: LLM Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Link: https://patch.msgid.link/20260923-build-speedup-v4-12-73128809a4a4@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26kbuild: move the toolchain checks into scripts/Kconfig.toolchainLorenzo Stoakes (ARM)
init/Kconfig opens with two hundred lines identifying the compiler, assembler, linker and rustc and probing which options they support, none of it to do with init. Move them into their own file, sourced from the top of init/Kconfig, so that the next commit can add to them without growing init/Kconfig further. Also update MAINTAINERS to put the new file in the KCONFIG entry. No functional change intended. Assisted-by: LLM Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Link: https://patch.msgid.link/20260923-build-speedup-v4-11-73128809a4a4@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>