Re: [PATCH v3 01/20] kbuild: do not allocate .modinfo in vmlinux

From: Nicolas Schier

Date: Fri Sep 18 2026 - 13:47:56 EST


On Thu, Sep 17, 2026 at 05:51:42PM -0700, Nathan Chancellor wrote:
[...]
>
> From 008046b33ef4b476048e3ddb2c679a453254e535 Mon Sep 17 00:00:00 2001
> From: Nathan Chancellor <nathan@xxxxxxxxxx>
> Date: Thu, 17 Sep 2026 17:29:53 -0700
> Subject: [PATCH] kbuild: Remove alignment on .modinfo section
>
> Commit d50f21091358 ("kbuild: align modinfo section for Secureboot
> Authenticode EDK2 compat") aligned .modinfo because it appeared in the
> x86_64 compressed kernel image after commit 3e86e4d74c04 ("kbuild: keep
> .modinfo section in vmlinux.unstripped"), breaking boot.
>
> Commit 8678591b4746 ("kbuild: Split .modinfo out from ELF_DETAILS")
> properly addresses .modinfo appearing in unexpected contexts like
> compressed images by moving it out of ELF_DETAILS and explicitly
> specifying its location in every architecture's vmlinux linker script or
> discarding it where it may appear elsewhere.
>
> Effectively revert commit d50f21091358 ("kbuild: align modinfo section
> for Secureboot Authenticode EDK2 compat") and its follow up fix,
> commit a26a6c93edfe ("kbuild: Strip trailing padding bytes from
> modules.builtin.modinfo"), as they are no longer necessary in the
> current tree. This simplifies future cleanups.
>
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> ---

[...]
>
> Then this patch becomes much more obvious (at least to me)
>

Yes, thanks. Looks good to me and I think it's a good idea to apply
that patch first.

for Nathans patch: Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>


[ Lorenzo's patch, updated by Nathan ]
[...]
> diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux
> index 6833b517cacb..95b523fe4f9e 100644
> --- a/scripts/Makefile.vmlinux
> +++ b/scripts/Makefile.vmlinux

[...]
> @@ -103,10 +100,7 @@ vmlinux: vmlinux.unstripped FORCE
> # ---------------------------------------------------------------------------
>
> quiet_cmd_modules_builtin_modinfo = GEN $@
> - cmd_modules_builtin_modinfo = $(cmd_objcopy); \
> - chmod -x $@
> -
> -OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
> + cmd_modules_builtin_modinfo = $(OBJCOPY) -O binary -j .modinfo --dump-section .modinfo=$@ $< /dev/null

By shifting from "$(cmd_objcopy)" to "$(OBJCOPY) + args",
$(OBJCOPYFLAGS) is dropped. It this by intention?

Kind regards,
Nicolas