Skip to content

Commit 83cd5fd

Browse files
committed
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
2 parents f3bbac3 + 13e1df0 commit 83cd5fd

File tree

9 files changed

+35
-12
lines changed

9 files changed

+35
-12
lines changed

Documentation/kbuild/makefiles.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ $(clean-files).
10421042

10431043
When executing "make clean", the file "crc32table.h" will be deleted.
10441044
Kbuild will assume files to be in the same relative directory as the
1045-
Makefile, except if prefixed with $(objtree).
1045+
Makefile.
10461046

10471047
To exclude certain files or directories from make clean, use the
10481048
$(no-clean-files) variable.

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ LDFLAGS_MODULE =
549549
CFLAGS_KERNEL =
550550
RUSTFLAGS_KERNEL =
551551
AFLAGS_KERNEL =
552-
export LDFLAGS_vmlinux =
552+
LDFLAGS_vmlinux =
553553

554554
# Use USERINCLUDE when you must reference the UAPI directories only.
555555
USERINCLUDE := \
@@ -1248,6 +1248,18 @@ vmlinux.o modules.builtin.modinfo modules.builtin: vmlinux_o
12481248
@:
12491249

12501250
PHONY += vmlinux
1251+
# LDFLAGS_vmlinux in the top Makefile defines linker flags for the top vmlinux,
1252+
# not for decompressors. LDFLAGS_vmlinux in arch/*/boot/compressed/Makefile is
1253+
# unrelated; the decompressors just happen to have the same base name,
1254+
# arch/*/boot/compressed/vmlinux.
1255+
# Export LDFLAGS_vmlinux only to scripts/Makefile.vmlinux.
1256+
#
1257+
# _LDFLAGS_vmlinux is a workaround for the 'private export' bug:
1258+
# https://savannah.gnu.org/bugs/?61463
1259+
# For Make > 4.4, the following simple code will work:
1260+
# vmlinux: private export LDFLAGS_vmlinux := $(LDFLAGS_vmlinux)
1261+
vmlinux: private _LDFLAGS_vmlinux := $(LDFLAGS_vmlinux)
1262+
vmlinux: export LDFLAGS_vmlinux = $(_LDFLAGS_vmlinux)
12511263
vmlinux: vmlinux.o $(KBUILD_LDS) modpost
12521264
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
12531265

@@ -1533,6 +1545,7 @@ endif
15331545
# *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES
15341546
# is an exception.
15351547
ifdef CONFIG_DEBUG_INFO_BTF_MODULES
1548+
KBUILD_BUILTIN := 1
15361549
modules: vmlinux
15371550
endif
15381551

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ config LOCALVERSION_AUTO
204204
appended after any matching localversion* files, and after the value
205205
set in CONFIG_LOCALVERSION.
206206

207-
(The actual string used here is the first eight characters produced
207+
(The actual string used here is the first 12 characters produced
208208
by running the command:
209209

210210
$ git rev-parse --verify HEAD

init/version-timestamp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <generated/compile.h>
44
#include <generated/utsrelease.h>
5-
#include <linux/version.h>
65
#include <linux/proc_ns.h>
76
#include <linux/refcount.h>
87
#include <linux/uts.h>

kernel/gen_kheaders.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ include/
1414
arch/$SRCARCH/include/
1515
"
1616

17+
type cpio > /dev/null
18+
1719
# Support incremental builds by skipping archive generation
1820
# if timestamps of files being archived are not changed.
1921

scripts/jobserver-exec

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,20 @@ try:
2626
# If the MAKEFLAGS variable contains multiple instances of the
2727
# --jobserver-auth= option, the last one is relevant.
2828
fds = opts[-1].split("=", 1)[1]
29-
reader, writer = [int(x) for x in fds.split(",", 1)]
30-
# Open a private copy of reader to avoid setting nonblocking
31-
# on an unexpecting process with the same reader fd.
32-
reader = os.open("/proc/self/fd/%d" % (reader),
33-
os.O_RDONLY | os.O_NONBLOCK)
29+
30+
# Starting with GNU Make 4.4, named pipes are used for reader and writer.
31+
# Example argument: --jobserver-auth=fifo:/tmp/GMfifo8134
32+
_, _, path = fds.partition('fifo:')
33+
34+
if path:
35+
reader = os.open(path, os.O_RDONLY | os.O_NONBLOCK)
36+
writer = os.open(path, os.O_WRONLY)
37+
else:
38+
reader, writer = [int(x) for x in fds.split(",", 1)]
39+
# Open a private copy of reader to avoid setting nonblocking
40+
# on an unexpecting process with the same reader fd.
41+
reader = os.open("/proc/self/fd/%d" % (reader),
42+
os.O_RDONLY | os.O_NONBLOCK)
3443

3544
# Read out as many jobserver slots as possible.
3645
while True:

scripts/kconfig/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
/conf
33
/[gmnq]conf
4+
/[gmnq]conf-bin
45
/[gmnq]conf-cflags
56
/[gmnq]conf-libs
6-
/qconf-bin
77
/qconf-moc.cc

scripts/kconfig/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ $(obj)/gconf: | $(obj)/gconf-libs
209209
$(obj)/gconf.o: | $(obj)/gconf-cflags
210210

211211
# check if necessary packages are available, and configure build flags
212-
cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin)
212+
cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin
213213

214214
$(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh
215215
$(call cmd,conf_cfg)

scripts/package/mkspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
#
33
# Output a simple RPM spec file.
4-
# This version assumes a minimum of RPM 4.0.3.
4+
# This version assumes a minimum of RPM 4.13
55
#
66
# The only gothic bit here is redefining install_post to avoid
77
# stripping the symbols from files in the kernel which we want

0 commit comments

Comments
 (0)