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 <[email protected]>
> Signed-off-by: Josh Poimboeuf <[email protected]>

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*
> alias:          of:N*T*Cnxp,s32g2-dspi
> alias:          of:N*T*Cfsl,lx2160a-dspiC*
> alias:          of:N*T*Cfsl,lx2160a-dspi
> alias:          of:N*T*Cfsl,ls2085a-dspiC*
> alias:          of:N*T*Cfsl,ls2085a-dspi
> alias:          of:N*T*Cfsl,ls2080a-dspiC*
> alias:          of:N*T*Cfsl,ls2080a-dspi
> alias:          of:N*T*Cfsl,ls1046a-dspiC*
> alias:          of:N*T*Cfsl,ls1046a-dspi
> alias:          of:N*T*Cfsl,ls1043a-dspiC*
> alias:          of:N*T*Cfsl,ls1043a-dspi
> alias:          of:N*T*Cfsl,ls1028a-dspiC*
> alias:          of:N*T*Cfsl,ls1028a-dspi
> alias:          of:N*T*Cfsl,ls1012a-dspiC*
> alias:          of:N*T*Cfsl,ls1012a-dspi
> alias:          of:N*T*Cfsl,ls1021a-v1.0-dspiC*
> alias:          of:N*T*Cfsl,ls1021a-v1.0-dspi
> alias:          of:N*T*Cfsl,vf610-dspiC*
> alias:          of:N*T*Cfsl,vf610-dspi
> depends:
> intree:         Y
> name:           spi_fsl_dspi
> vermagic:       6.18.0-rc1+ SMP preempt mod_unload modversions aarch64

Reverting does not work on all building platforms, it works on one but fails
on another one.

Best regards
Alexander
> ---
>  include/linux/init.h | 3 ++-
>  scripts/Makefile.lib | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/init.h b/include/linux/init.h
> index 17c1bc712e234..40331923b9f4a 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -200,12 +200,13 @@ extern struct module __this_module;
>  
>  /* Format: <modname>__<counter>_<line>_<fn> */
>  #define __initcall_id(fn)                                    \
> +     __PASTE(kmod_,                                          \
>       __PASTE(__KBUILD_MODNAME,                               \
>       __PASTE(__,                                             \
>       __PASTE(__COUNTER__,                                    \
>       __PASTE(_,                                              \
>       __PASTE(__LINE__,                                       \
> -     __PASTE(_, fn))))))
> +     __PASTE(_, fn)))))))
>  
>  /* Format: __<prefix>__<iid><id> */
>  #define __initcall_name(prefix, __iid, id)                   \
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 1d581ba5df66f..b955602661240 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -20,7 +20,7 @@ name-fix-token = $(subst $(comma),_,$(subst -,_,$1))
>  name-fix = $(call stringify,$(call name-fix-token,$1))
>  basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
>  modname_flags  = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
> -              -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
> +              -D__KBUILD_MODNAME=$(call name-fix-token,$(modname))
>  modfile_flags  = -DKBUILD_MODFILE=$(call stringify,$(modfile))
>  
>  _c_flags       = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



Reply via email to