Kbuild fixes for v6.2 (3rd)

- Hide LDFLAGS_vmlinux from decompressor Makefiles to fix error messages
    when GNU Make 4.4 is used.
 
  - Fix 'make modules' build error when CONFIG_DEBUG_INFO_BTF_MODULES=y.
 
  - Fix warnings emitted by GNU Make 4.4 in scripts/kconfig/Makefile.
 
  - Support GNU Make 4.4 for scripts/jobserver-exec.
 
  - Show clearer error message when kernel/gen_kheaders.sh fails due to
    missing cpio.
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmPLnykVHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGQ6QQAK+nhDBi+2X2F6D/KP4hIHSawRAx
 oqbrYf+xfVB6sBpcqwlzW1jajqmHgwIYX0OmUMEGOoYsKcJ+ZtmMmGnBaukepXjt
 6KVyLghNNdGPYHGrwMrvNIB2qUHQhrCP82laU701adac+mRnEAnubvIk+nJl00mF
 g2gnlwtxqfH09xO2BICCMYzTnag63bIlNzkIFB4yz2LWGQZ3knHJ7THNOr9J3O3v
 lx5bsQOGJYqq7q8UiTM5Y5GiWKhzupF56Q86ppIduV6LmzD7aj5sQgieGcgbkLW9
 K2xXE/eIVKFPo5tazlDH5i/4oOo0ykjimt0qOd7ya1jHsgU1Qpst2cbe+evJP8fs
 FcorOaizpvGYEM4C5kBh9x4kGdu71Dx9T/+JWHZ1u4vxw78DD4CqhdcZE7sR5cVr
 A5RcbtIurNUka1GTllu27GqVrxLc8splMiyx9456MfHixywyvmpagW6DiU2MgLcx
 wrlwN4VMylCAEKWNHB2FyeHevJqwfZgqfLTXvNGN6xQ4hITuVwTFpO6RdzztXVba
 qIMMK6eK+6PKIidVDPb5dEJpkownlubccE84lYl55qSVo3CgKuweZOH1If78gGQU
 927fFDyVTFtJsf68EEUUGxUS8OgWBQD9daTbNqnK28PLWWG/wtEjgHipycE4/QWN
 lPMHP/qE7x3DLSB9
 =m1Ee
 -----END PGP SIGNATURE-----

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

Pull Kbuild fixes from Masahiro Yamada:

 - Hide LDFLAGS_vmlinux from decompressor Makefiles to fix error
   messages when GNU Make 4.4 is used.

 - Fix 'make modules' build error when CONFIG_DEBUG_INFO_BTF_MODULES=y.

 - Fix warnings emitted by GNU Make 4.4 in scripts/kconfig/Makefile.

 - Support GNU Make 4.4 for scripts/jobserver-exec.

 - Show clearer error message when kernel/gen_kheaders.sh fails due to
   missing cpio.

* tag 'kbuild-fixes-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kheaders: explicitly validate existence of cpio command
  scripts: support GNU make 4.4 in jobserver-exec
  kconfig: Update all declared targets
  scripts: rpm: make clear that mkspec script contains 4.13 feature
  init/Kconfig: fix LOCALVERSION_AUTO help text
  kbuild: fix 'make modules' error when CONFIG_DEBUG_INFO_BTF_MODULES=y
  kbuild: export top-level LDFLAGS_vmlinux only to scripts/Makefile.vmlinux
  init/version-timestamp.c: remove unneeded #include <linux/version.h>
  docs: kbuild: remove mention to dropped $(objtree) feature
This commit is contained in:
Linus Torvalds 2023-01-21 10:56:37 -08:00
commit 83cd5fd014
9 changed files with 35 additions and 12 deletions

View File

@ -1042,7 +1042,7 @@ $(clean-files).
When executing "make clean", the file "crc32table.h" will be deleted. When executing "make clean", the file "crc32table.h" will be deleted.
Kbuild will assume files to be in the same relative directory as the Kbuild will assume files to be in the same relative directory as the
Makefile, except if prefixed with $(objtree). Makefile.
To exclude certain files or directories from make clean, use the To exclude certain files or directories from make clean, use the
$(no-clean-files) variable. $(no-clean-files) variable.

View File

@ -549,7 +549,7 @@ LDFLAGS_MODULE =
CFLAGS_KERNEL = CFLAGS_KERNEL =
RUSTFLAGS_KERNEL = RUSTFLAGS_KERNEL =
AFLAGS_KERNEL = AFLAGS_KERNEL =
export LDFLAGS_vmlinux = LDFLAGS_vmlinux =
# Use USERINCLUDE when you must reference the UAPI directories only. # Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE := \ USERINCLUDE := \
@ -1248,6 +1248,18 @@ vmlinux.o modules.builtin.modinfo modules.builtin: vmlinux_o
@: @:
PHONY += vmlinux PHONY += vmlinux
# LDFLAGS_vmlinux in the top Makefile defines linker flags for the top vmlinux,
# not for decompressors. LDFLAGS_vmlinux in arch/*/boot/compressed/Makefile is
# unrelated; the decompressors just happen to have the same base name,
# arch/*/boot/compressed/vmlinux.
# Export LDFLAGS_vmlinux only to scripts/Makefile.vmlinux.
#
# _LDFLAGS_vmlinux is a workaround for the 'private export' bug:
# https://savannah.gnu.org/bugs/?61463
# For Make > 4.4, the following simple code will work:
# vmlinux: private export LDFLAGS_vmlinux := $(LDFLAGS_vmlinux)
vmlinux: private _LDFLAGS_vmlinux := $(LDFLAGS_vmlinux)
vmlinux: export LDFLAGS_vmlinux = $(_LDFLAGS_vmlinux)
vmlinux: vmlinux.o $(KBUILD_LDS) modpost vmlinux: vmlinux.o $(KBUILD_LDS) modpost
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
@ -1533,6 +1545,7 @@ endif
# *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES # *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES
# is an exception. # is an exception.
ifdef CONFIG_DEBUG_INFO_BTF_MODULES ifdef CONFIG_DEBUG_INFO_BTF_MODULES
KBUILD_BUILTIN := 1
modules: vmlinux modules: vmlinux
endif endif

View File

@ -204,7 +204,7 @@ config LOCALVERSION_AUTO
appended after any matching localversion* files, and after the value appended after any matching localversion* files, and after the value
set in CONFIG_LOCALVERSION. set in CONFIG_LOCALVERSION.
(The actual string used here is the first eight characters produced (The actual string used here is the first 12 characters produced
by running the command: by running the command:
$ git rev-parse --verify HEAD $ git rev-parse --verify HEAD

View File

@ -2,7 +2,6 @@
#include <generated/compile.h> #include <generated/compile.h>
#include <generated/utsrelease.h> #include <generated/utsrelease.h>
#include <linux/version.h>
#include <linux/proc_ns.h> #include <linux/proc_ns.h>
#include <linux/refcount.h> #include <linux/refcount.h>
#include <linux/uts.h> #include <linux/uts.h>

View File

@ -14,6 +14,8 @@ include/
arch/$SRCARCH/include/ arch/$SRCARCH/include/
" "
type cpio > /dev/null
# Support incremental builds by skipping archive generation # Support incremental builds by skipping archive generation
# if timestamps of files being archived are not changed. # if timestamps of files being archived are not changed.

View File

@ -26,11 +26,20 @@ try:
# If the MAKEFLAGS variable contains multiple instances of the # If the MAKEFLAGS variable contains multiple instances of the
# --jobserver-auth= option, the last one is relevant. # --jobserver-auth= option, the last one is relevant.
fds = opts[-1].split("=", 1)[1] fds = opts[-1].split("=", 1)[1]
reader, writer = [int(x) for x in fds.split(",", 1)]
# Open a private copy of reader to avoid setting nonblocking # Starting with GNU Make 4.4, named pipes are used for reader and writer.
# on an unexpecting process with the same reader fd. # Example argument: --jobserver-auth=fifo:/tmp/GMfifo8134
reader = os.open("/proc/self/fd/%d" % (reader), _, _, path = fds.partition('fifo:')
os.O_RDONLY | os.O_NONBLOCK)
if path:
reader = os.open(path, os.O_RDONLY | os.O_NONBLOCK)
writer = os.open(path, os.O_WRONLY)
else:
reader, writer = [int(x) for x in fds.split(",", 1)]
# Open a private copy of reader to avoid setting nonblocking
# on an unexpecting process with the same reader fd.
reader = os.open("/proc/self/fd/%d" % (reader),
os.O_RDONLY | os.O_NONBLOCK)
# Read out as many jobserver slots as possible. # Read out as many jobserver slots as possible.
while True: while True:

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
/conf /conf
/[gmnq]conf /[gmnq]conf
/[gmnq]conf-bin
/[gmnq]conf-cflags /[gmnq]conf-cflags
/[gmnq]conf-libs /[gmnq]conf-libs
/qconf-bin
/qconf-moc.cc /qconf-moc.cc

View File

@ -209,7 +209,7 @@ $(obj)/gconf: | $(obj)/gconf-libs
$(obj)/gconf.o: | $(obj)/gconf-cflags $(obj)/gconf.o: | $(obj)/gconf-cflags
# check if necessary packages are available, and configure build flags # check if necessary packages are available, and configure build flags
cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin) cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin
$(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh $(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh
$(call cmd,conf_cfg) $(call cmd,conf_cfg)

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Output a simple RPM spec file. # Output a simple RPM spec file.
# This version assumes a minimum of RPM 4.0.3. # This version assumes a minimum of RPM 4.13
# #
# The only gothic bit here is redefining install_post to avoid # The only gothic bit here is redefining install_post to avoid
# stripping the symbols from files in the kernel which we want # stripping the symbols from files in the kernel which we want