Skip to content

Commit 2ddcf49

Browse files
committed
Merge tag 'kbuild-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux
Pull Kbuild updates from Nicolas Schier: - Enable -fms-extensions, allowing anonymous use of tagged struct or union in struct/union (tag kbuild-ms-extensions-6.19). An exemplary conversion patch is added here, too (btrfs). [ Editor's note: the core of this actually came in early through a shared branch and a few other trees - Linus ] - Introduce architecture-specific CC_CAN_LINK and flags for userprogs - Add new packaging target 'modules-cpio-pkg' for building a initramfs cpio w/ kmods - Handle included .c files in gen_compile_commands - Minor kbuild changes: - Use objtree for module signing key path, fixing oot kmod signing - Improve documentation of KBUILD_BUILD_TIMESTAMP - Reuse KBUILD_USERCFLAGS for UAPI, instead of defining twice - Rename scripts/Makefile.extrawarn to Makefile.warn - Drop obsolete types.h check from headers_check.pl - Remove outdated config leak ignore entries * tag 'kbuild-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux: kbuild: add target to build a cpio containing modules initramfs: add gen_init_cpio to hostprogs unconditionally kbuild: allow architectures to override CC_CAN_LINK init: deduplicate cc-can-link.sh invocations kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings scripts: headers_install.sh: Remove two outdated config leak ignore entries scripts/clang-tools: Handle included .c files in gen_compile_commands kbuild: uapi: Drop types.h check from headers_check.pl kbuild: Rename Makefile.extrawarn to Makefile.warn MAINTAINERS, .mailmap: Update mail address for Nicolas Schier kbuild: uapi: reuse KBUILD_USERCFLAGS kbuild: doc: improve KBUILD_BUILD_TIMESTAMP documentation kbuild: Use objtree for module signing key path btrfs: send: make use of -fms-extensions for defining struct fs_path
2 parents 784faa8 + 2a9c8c0 commit 2ddcf49

File tree

17 files changed

+207
-115
lines changed

17 files changed

+207
-115
lines changed

.mailmap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ Nicolas Pitre <[email protected]> <[email protected]>
589589
590590
Nicolas Saenz Julienne <[email protected]> <[email protected]>
591591
Nicolas Saenz Julienne <[email protected]> <[email protected]>
592-
593-
592+
593+
594594
Niklas Söderlund <[email protected]>
595595
Nikolay Aleksandrov <[email protected]> <[email protected]>
596596
Nikolay Aleksandrov <[email protected]> <[email protected]>

Documentation/kbuild/kbuild.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,14 @@ KBUILD_BUILD_TIMESTAMP
328328
----------------------
329329
Setting this to a date string overrides the timestamp used in the
330330
UTS_VERSION definition (uname -v in the running kernel). The value has to
331-
be a string that can be passed to date -d. The default value
332-
is the output of the date command at one point during build.
331+
be a string that can be passed to date -d. E.g.::
332+
333+
$ KBUILD_BUILD_TIMESTAMP="Mon Oct 13 00:00:00 UTC 2025" make
334+
335+
The default value is the output of the date command at one point during
336+
build. If provided, this timestamp will also be used for mtime fields
337+
within any initramfs archive. Initramfs mtimes are 32-bit, so dates before
338+
the 1970 Unix epoch, or after 2106-02-07 06:28:15 UTC will fail.
333339

334340
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
335341
------------------------------------

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13498,7 +13498,7 @@ F: fs/autofs/
1349813498

1349913499
KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
1350013500
M: Nathan Chancellor <[email protected]>
13501-
M: Nicolas Schier <[email protected]>
13501+
M: Nicolas Schier <[email protected]>
1350213502
1350313503
S: Odd Fixes
1350413504
Q: https://patchwork.kernel.org/project/linux-kbuild/list/

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
10841084
endif
10851085

10861086
# include additional Makefiles when needed
1087-
include-y := scripts/Makefile.extrawarn
1087+
include-y := scripts/Makefile.warn
10881088
include-$(CONFIG_DEBUG_INFO) += scripts/Makefile.debug
10891089
include-$(CONFIG_DEBUG_INFO_BTF)+= scripts/Makefile.btf
10901090
include-$(CONFIG_KASAN) += scripts/Makefile.kasan
@@ -1137,8 +1137,17 @@ ifneq ($(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS),)
11371137
LDFLAGS_vmlinux += --emit-relocs --discard-none
11381138
endif
11391139

1140-
# Align the bit size of userspace programs with the kernel
1141-
USERFLAGS_FROM_KERNEL := -m32 -m64 --target=%
1140+
# Align the architecture of userspace programs with the kernel
1141+
USERFLAGS_FROM_KERNEL := --target=%
1142+
1143+
ifdef CONFIG_ARCH_USERFLAGS
1144+
KBUILD_USERCFLAGS += $(CONFIG_ARCH_USERFLAGS)
1145+
KBUILD_USERLDFLAGS += $(CONFIG_ARCH_USERFLAGS)
1146+
else
1147+
# If not overridden also inherit the bit size
1148+
USERFLAGS_FROM_KERNEL += -m32 -m64
1149+
endif
1150+
11421151
KBUILD_USERCFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
11431152
KBUILD_USERLDFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
11441153

drivers/gpu/drm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE
77

88
# Unconditionally enable W=1 warnings locally
9-
# --- begin copy-paste W=1 warnings from scripts/Makefile.extrawarn
9+
# --- begin copy-paste W=1 warnings from scripts/Makefile.warn
1010
subdir-ccflags-y += -Wextra -Wunused -Wno-unused-parameter
1111
subdir-ccflags-y += $(call cc-option, -Wrestrict)
1212
subdir-ccflags-y += -Wmissing-format-attribute

fs/btrfs/send.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,30 @@
4747
* It allows fast adding of path elements on the right side (normal path) and
4848
* fast adding to the left side (reversed path). A reversed path can also be
4949
* unreversed if needed.
50+
*
51+
* The definition of struct fs_path relies on -fms-extensions to allow
52+
* including a tagged struct as an anonymous member.
5053
*/
54+
struct __fs_path {
55+
char *start;
56+
char *end;
57+
58+
char *buf;
59+
unsigned short buf_len:15;
60+
unsigned short reversed:1;
61+
};
62+
static_assert(sizeof(struct __fs_path) < 256);
5163
struct fs_path {
52-
union {
53-
struct {
54-
char *start;
55-
char *end;
56-
57-
char *buf;
58-
unsigned short buf_len:15;
59-
unsigned short reversed:1;
60-
char inline_buf[];
61-
};
62-
/*
63-
* Average path length does not exceed 200 bytes, we'll have
64-
* better packing in the slab and higher chance to satisfy
65-
* an allocation later during send.
66-
*/
67-
char pad[256];
68-
};
64+
struct __fs_path;
65+
/*
66+
* Average path length does not exceed 200 bytes, we'll have
67+
* better packing in the slab and higher chance to satisfy
68+
* an allocation later during send.
69+
*/
70+
char inline_buf[256 - sizeof(struct __fs_path)];
6971
};
7072
#define FS_PATH_INLINE_SIZE \
71-
(sizeof(struct fs_path) - offsetof(struct fs_path, inline_buf))
73+
sizeof_field(struct fs_path, inline_buf)
7274

7375

7476
/* reused for each extent */
@@ -305,7 +307,6 @@ struct send_ctx {
305307
struct btrfs_lru_cache dir_created_cache;
306308
struct btrfs_lru_cache dir_utimes_cache;
307309

308-
/* Must be last as it ends in a flexible-array member. */
309310
struct fs_path cur_inode_path;
310311
};
311312

init/Kconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,14 @@ config RUSTC_LLVM_VERSION
8282
int
8383
default $(rustc-llvm-version)
8484

85+
config ARCH_HAS_CC_CAN_LINK
86+
bool
87+
8588
config CC_CAN_LINK
8689
bool
87-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
88-
default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))
90+
default ARCH_CC_CAN_LINK if ARCH_HAS_CC_CAN_LINK
91+
default $(cc_can_link_user,$(m64-flag)) if 64BIT
92+
default $(cc_can_link_user,$(m32-flag))
8993

9094
# Fixed in GCC 14, 13.3, 12.4 and 11.5
9195
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921

scripts/Kconfig.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$
6565
m32-flag := $(cc-option-bit,-m32)
6666
m64-flag := $(cc-option-bit,-m64)
6767

68+
# Test whether the compiler can link userspace applications
69+
cc_can_link_user = $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(1))
70+
6871
rustc-version := $(shell,$(srctree)/scripts/rustc-version.sh $(RUSTC))
6972
rustc-llvm-version := $(shell,$(srctree)/scripts/rustc-llvm-version.sh $(RUSTC))
7073

scripts/Makefile.modinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ endif
100100
# Don't stop modules_install even if we can't sign external modules.
101101
#
102102
ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)
103-
sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
103+
sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(objtree)/)$(CONFIG_MODULE_SIG_KEY)
104104
else
105105
sig-key := $(CONFIG_MODULE_SIG_KEY)
106106
endif

scripts/Makefile.package

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,25 @@ tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar
189189
tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
190190
@:
191191

192+
# modules-cpio-pkg - generate an initramfs with the modules
193+
# ---------------------------------------------------------------------------
194+
195+
.tmp_modules_cpio: FORCE
196+
$(Q)$(MAKE) -f $(srctree)/Makefile
197+
$(Q)rm -rf $@
198+
$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
199+
200+
quiet_cmd_cpio = CPIO $@
201+
cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
202+
203+
modules-$(KERNELRELEASE)-$(ARCH).cpio: .tmp_modules_cpio
204+
$(Q)$(MAKE) $(build)=usr usr/gen_init_cpio
205+
$(call cmd,cpio)
206+
207+
PHONY += modules-cpio-pkg
208+
modules-cpio-pkg: modules-$(KERNELRELEASE)-$(ARCH).cpio
209+
@:
210+
192211
# perf-tar*-src-pkg - generate a source tarball with perf source
193212
# ---------------------------------------------------------------------------
194213

@@ -245,6 +264,7 @@ help:
245264
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
246265
@echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
247266
@echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
267+
@echo ' modules-cpio-pkg - Build the kernel modules as cpio archive'
248268
@echo ' perf-tar-src-pkg - Build the perf source tarball with no compression'
249269
@echo ' perf-targz-src-pkg - Build the perf source tarball with gzip compression'
250270
@echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'

0 commit comments

Comments
 (0)