Re: [PATCH v4 08/63] kbuild: Remove 'kmod_' prefix from __KBUILD_MODNAME
From: Anders Roxell
Date: Wed Oct 22 2025 - 05:53:58 EST
On 2025-10-20 10:22, Josh Poimboeuf wrote:
> On Mon, Oct 20, 2025 at 02:20:35PM +0200, Alexander Stein wrote:
> > Hi,
> >
> > Am Mittwoch, 17. September 2025, 18:03:16 CEST schrieb Josh Poimboeuf:
> > > In preparation for the objtool klp diff subcommand, remove the arbitrary
> > > 'kmod_' prefix from __KBUILD_MODNAME and instead add it explicitly in
> > > the __initcall_id() macro.
> > >
> > > This change supports the standardization of "unique" symbol naming by
> > > ensuring the non-unique portion of the name comes before the unique
> > > part. That will enable objtool to properly correlate symbols across
> > > builds.
> > >
> > > Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> > > Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> >
> > Starting with this commit 6717e8f91db71 ("kbuild: Remove 'kmod_' prefix
> > from __KBUILD_MODNAME") in next-20251020 I don't get any
> > module aliases anymore.
> > modinfo spi-fsl-dspi.ko returns:
> > > filename: /work/repo/linux/build_arm64/drivers/spi/spi-fsl-dspi.ko
> > > alias: platform:fsl-dspi
> > > license: GPL
> > > description: Freescale DSPI Controller Driver
> > > depends:
> > > intree: Y
> > > name: spi_fsl_dspi
> > > vermagic: 6.18.0-rc1+ SMP preempt mod_unload modversions aarch64
> >
> > but it should be like this:
> > > filename: /work/repo/linux/build_arm64/drivers/spi/spi-fsl-dspi.ko
> > > alias: platform:fsl-dspi
> > > license: GPL
> > > description: Freescale DSPI Controller Driver
> > > alias: of:N*T*Cnxp,s32g2-dspiC*
>
> Thanks, this patch broke the MODULE_DEVICE_TABLE() macro, as it no
> longer produces the format expected by scripts/mod/file2alias.c.
>
> I didn't see this in x86 testing since it doesn't have device tree.
>
> I will post the following fix shortly:
Tested-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
When can we expect it?
Cheers,
Anders
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index e135cc79aceea..d80c3ea574726 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -251,10 +251,11 @@ struct module_kobject *lookup_or_create_module_kobject(const char *name);
> */
> #define __mod_device_table(type, name) \
> __PASTE(__mod_device_table__, \
> + __PASTE(kmod_, \
> __PASTE(__KBUILD_MODNAME, \
> __PASTE(__, \
> __PASTE(type, \
> - __PASTE(__, name)))))
> + __PASTE(__, name))))))
>
> /* Creates an alias so file2alias.c can find device table. */
> #define MODULE_DEVICE_TABLE(type, name) \