When building an object to be included in mod.a we cannot know the name of the module. So don't define KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error. Signed-off-by: NeilBrown <neilb@xxxxxxxx> --- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index c84167169a59..d09246474f2e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -96,7 +96,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. -modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used) modobj.o,\ $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) @@ -106,7 +106,7 @@ modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) # end up in (or would, if it gets compiled in) name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) -modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) +modname_flags = $(if $(filter-out modobj,$(modname)),-DKBUILD_MODNAME=$(call name-fix,$(modname))) orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o) -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html