Third round of Kbuild fixes for 6.19

- Strip trailing padding bytes from modules.builtin.modinfo to fix error
   during modules_install with certain versions of kmod
 
 - Drop unused static inline function warning in .c files with clang from
   W=1 to W=2
 
 - Ensure kernel-doc.py invocations use the PYTHON3 make variable to
   ensure user's choice of Python interpreter is always respected
 
 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQR74yXHMTGczQHYypIdayaRccAalgUCaRABuwAKCRAdayaRccAa
 lpyDAQCiCQkpyG1JU2uKOaDTItA7BzK6iuCuqoePk0um+rIUKwEAq8fYCJU7kDM2
 N+uL8Gw03vryftPYMVcfdrO0WsCBwgM=
 =D8C8
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-fixes-6.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux

Pull Kbuild fixes from Nathan Chancellor:

 - Strip trailing padding bytes from modules.builtin.modinfo to fix
   error during modules_install with certain versions of kmod

 - Drop unused static inline function warning in .c files with clang
   from W=1 to W=2

 - Ensure kernel-doc.py invocations use the PYTHON3 make variable to
   ensure user's choice of Python interpreter is always respected

* tag 'kbuild-fixes-6.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux:
  kbuild: Let kernel-doc.py use PYTHON3 override
  compiler_types: Move unused static inline functions warning to W=2
  kbuild: Strip trailing padding bytes from modules.builtin.modinfo
This commit is contained in:
Linus Torvalds 2025-11-09 09:22:08 -08:00
commit 3461e958c1
6 changed files with 20 additions and 8 deletions

View File

@ -245,7 +245,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
cmd_hdrtest = \ cmd_hdrtest = \
$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
touch $@ touch $@
$(obj)/%.hdrtest: $(src)/%.h FORCE $(obj)/%.hdrtest: $(src)/%.h FORCE

View File

@ -413,7 +413,7 @@ obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmgt.o
# #
# Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build # Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build
ifdef CONFIG_DRM_I915_WERROR ifdef CONFIG_DRM_I915_WERROR
cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $< cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<
endif endif
# header test # header test

View File

@ -11,7 +11,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
cmd_hdrtest = \ cmd_hdrtest = \
$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
touch $@ touch $@
$(obj)/%.hdrtest: $(src)/%.h FORCE $(obj)/%.hdrtest: $(src)/%.h FORCE

View File

@ -250,10 +250,9 @@ struct ftrace_likely_data {
/* /*
* GCC does not warn about unused static inline functions for -Wunused-function. * GCC does not warn about unused static inline functions for -Wunused-function.
* Suppress the warning in clang as well by using __maybe_unused, but enable it * Suppress the warning in clang as well by using __maybe_unused, but enable it
* for W=1 build. This will allow clang to find unused functions. Remove the * for W=2 build. This will allow clang to find unused functions.
* __inline_maybe_unused entirely after fixing most of -Wunused-function warnings.
*/ */
#ifdef KBUILD_EXTRA_WARN1 #ifdef KBUILD_EXTRA_WARN2
#define __inline_maybe_unused #define __inline_maybe_unused
#else #else
#define __inline_maybe_unused __maybe_unused #define __inline_maybe_unused __maybe_unused

View File

@ -167,7 +167,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
endif endif
ifneq ($(KBUILD_EXTRA_WARN),) ifneq ($(KBUILD_EXTRA_WARN),)
cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \ cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
$(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \ $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
$< $<
endif endif

View File

@ -102,11 +102,24 @@ vmlinux: vmlinux.unstripped FORCE
# modules.builtin.modinfo # modules.builtin.modinfo
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# .modinfo in vmlinux.unstripped is aligned to 8 bytes for compatibility with
# tools that expect vmlinux to have sufficiently aligned sections but the
# additional bytes used for padding .modinfo to satisfy this requirement break
# certain versions of kmod with
#
# depmod: ERROR: kmod_builtin_iter_next: unexpected string without modname prefix
#
# Strip the trailing padding bytes after extracting .modinfo to comply with
# what kmod expects to parse.
quiet_cmd_modules_builtin_modinfo = GEN $@
cmd_modules_builtin_modinfo = $(cmd_objcopy); \
sed -i 's/\x00\+$$/\x00/g' $@
OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
targets += modules.builtin.modinfo targets += modules.builtin.modinfo
modules.builtin.modinfo: vmlinux.unstripped FORCE modules.builtin.modinfo: vmlinux.unstripped FORCE
$(call if_changed,objcopy) $(call if_changed,modules_builtin_modinfo)
# modules.builtin # modules.builtin
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------