Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: Sync kconfig when PAHOLE_VERSION changes

This patch implements kconfig re-sync when the pahole version changes
between builds, similar to how it happens for compiler version change
via CC_VERSION_TEXT.

Define PAHOLE_VERSION in the top-level Makefile and export it for
config builds. Set CONFIG_PAHOLE_VERSION default to the exported
variable.

Kconfig records the PAHOLE_VERSION value in
include/config/auto.conf.cmd [1].

The Makefile includes auto.conf.cmd, so if PAHOLE_VERSION changes
between builds, make detects a dependency change and triggers
syncconfig to update the kconfig [2].

For external module builds, add a warning message in the prepare
target, similar to the existing compiler version mismatch warning.

Note that if pahole is not installed or available, PAHOLE_VERSION is
set to 0 by pahole-version.sh, so the (un)installation of pahole is
treated as a version change.

See previous discussions for context [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/kconfig/preprocess.c?h=v6.18#n91
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile?h=v6.18#n815
[3] https://lore.kernel.org/bpf/8f946abf-dd88-4fac-8bb4-84fcd8d81cf0@oracle.com/

Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Alan Maguire <alan.maguire@oracle.com>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Link: https://lore.kernel.org/bpf/20251219181321.1283664-6-ihor.solodrai@linux.dev

authored by

Ihor Solodrai and committed by
Andrii Nakryiko
90e5b38a fb348d4f

+12 -5
+11 -4
Makefile
··· 708 708 709 709 # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included. 710 710 # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile. 711 - # CC_VERSION_TEXT and RUSTC_VERSION_TEXT are referenced from Kconfig (so they 712 - # need export), and from include/config/auto.conf.cmd to detect the compiler 713 - # upgrade. 711 + # CC_VERSION_TEXT, RUSTC_VERSION_TEXT and PAHOLE_VERSION are referenced from 712 + # Kconfig (so they need export), and from include/config/auto.conf.cmd to 713 + # detect the version changes between builds. 714 714 CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)) 715 715 RUSTC_VERSION_TEXT = $(subst $(pound),,$(shell $(RUSTC) --version 2>/dev/null)) 716 + PAHOLE_VERSION = $(shell $(srctree)/scripts/pahole-version.sh $(PAHOLE)) 716 717 717 718 ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) 718 719 include $(srctree)/scripts/Makefile.clang ··· 734 733 # KBUILD_DEFCONFIG may point out an alternative default configuration 735 734 # used for 'make defconfig' 736 735 include $(srctree)/arch/$(SRCARCH)/Makefile 737 - export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT RUSTC_VERSION_TEXT 736 + export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT RUSTC_VERSION_TEXT PAHOLE_VERSION 738 737 739 738 config: outputmakefile scripts_basic FORCE 740 739 $(Q)$(MAKE) $(build)=scripts/kconfig $@ ··· 1922 1921 PHONY += prepare 1923 1922 # now expand this into a simple variable to reduce the cost of shell evaluations 1924 1923 prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT) 1924 + prepare: PAHOLE_VERSION := $(PAHOLE_VERSION) 1925 1925 prepare: 1926 1926 @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \ 1927 1927 echo >&2 "warning: the compiler differs from the one used to build the kernel"; \ 1928 1928 echo >&2 " The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \ 1929 1929 echo >&2 " You are using: $(CC_VERSION_TEXT)"; \ 1930 + fi 1931 + @if [ "$(PAHOLE_VERSION)" != "$(CONFIG_PAHOLE_VERSION)" ]; then \ 1932 + echo >&2 "warning: pahole version differs from the one used to build the kernel"; \ 1933 + echo >&2 " The kernel was built with: $(CONFIG_PAHOLE_VERSION)"; \ 1934 + echo >&2 " You are using: $(PAHOLE_VERSION)"; \ 1930 1935 fi 1931 1936 1932 1937 PHONY += help
+1 -1
init/Kconfig
··· 171 171 172 172 config PAHOLE_VERSION 173 173 int 174 - default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE)) 174 + default "$(PAHOLE_VERSION)" 175 175 176 176 config CONSTRUCTORS 177 177 bool