Re: [PATCH v3 01/20] kbuild: do not allocate .modinfo in vmlinux
From: Lorenzo Stoakes (ARM)
Date: Sat Sep 19 2026 - 10:40:29 EST
On Fri, Sep 18, 2026 at 02:44:45PM -0700, Nathan Chancellor wrote:
> On Fri, Sep 18, 2026 at 07:09:30PM +0200, Nicolas Schier wrote:
> > 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>
>
> Thanks, I have pushed this to kbuild-next-speedups as
>
> 36d4a11b56aa ("kbuild: Remove alignment on .modinfo section")
>
> which Lorenzo can base on. I have also tentatively included the patches
Ack, will rebase future revisions on this patch.
> that are basically ready in my eyes based on consensus and review so far
> for initial build testing. I do see some comments on some of those
> patches though, so I will hold off on fully applying them until the next
> revision. If there are any other changes that we should consider taking
> quickly on the next revision, please feel free to point them out, it is
> a bit hard to follow these threads sometimes :)
Thanks :)
>
> [1]: https://git.kernel.org/kbuild/l/kbuild-next-speedups
>
> > [ 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?
>
> I am not sure it matters in this case since I don't think there are
> global OBJCOPYFLAGS, I only see instances that come from specific rules
> but I might be missing something.
OBJCOPYFLAGS is exported from the top level Makefile:
655:export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
And is set by various arches e.g.:
arch/csky/Makefile
2:OBJCOPYFLAGS :=-O binary
arch/mips/Makefile
348:OBJCOPYFLAGS += --remove-section=.reginfo
arch/openrisc/Makefile
20:OBJCOPYFLAGS := -O binary -R .note -R .comment -S
arch/sh/Makefile
79:OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment \
-R .stab -R .stabstr -S
arch/s390/Makefile
123:OBJCOPYFLAGS := -O binary
And none of this should impact .modinfo, and if it did it'd be broken as then
.modinfo would be different for one arch and not the others.
>
> --
> Cheers,
> Nathan
--
Cheers, Lorenzo