5 Commits
Author SHA1 Message Date
Linus Torvalds bb29b957ea Merge tag 'kbuild-7.4-1' of 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
  ...
2026-10-21 10:45:44 -10:00
Nathan Chancellor 7202c08793 kconfig: Improve ergonomics around disabling warnings with cc-option
This is essentially a port of commit 550ccb178d ("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-09 22:26:56 +02:00
Nathan Chancellor c4c24fd63a scripts/Kconfig.toolchain: Drop compiler symbols from dependencies
Commit 454e00cf8e ("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-10-09 22:26:56 +02:00
Lorenzo Stoakes (ARM) 454e00cf8e kbuild: avoid re-running compiler and linker probes
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-26 00:16:36 +01:00
Lorenzo Stoakes (ARM) f85147b291 kbuild: move the toolchain checks into scripts/Kconfig.toolchain
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>
2026-09-26 00:16:36 +01:00