]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kbuild: Remove 'kmod_' prefix from __KBUILD_MODNAME
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 17 Sep 2025 16:03:16 +0000 (09:03 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:45:22 +0000 (14:45 -0700)
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@kernel.org>
Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
include/linux/init.h
scripts/Makefile.lib

index 17c1bc712e234a63d16b2eaca373077bb3b3fcc5..40331923b9f4a85c215f6983fd69e28353956209 100644 (file)
@@ -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)                     \
index 1d581ba5df66f2b560e83d78bb8361bfef7e6bfc..b95560266124058b3b1bb224cdda3398e5e9a847 100644 (file)
@@ -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), \