• Masahiro Yamada's avatar
    kbuild: define KBUILD_MODNAME even if multiple modules share objects · aeacb019
    Masahiro Yamada authored
    Currently, KBUILD_MODNAME is defined only when $(modname) contains
    just one word.  If an object is shared among multiple modules,
    undefined KBUILD_MODNAME could cause a build error.  For example,
    if CONFIG_DYNAMIC_DEBUG is enabled, any call of printk() populates
    .modname, then fails to build due to undefined KBUILD_MODNAME.
    
    Take the following code as an example:
    
      obj-m += foo.o
      obj-m += bar.o
      foo-objs := foo-bar-common.o foo-only.o
      bar-objs := foo-bar-common.o bar-only.o
    
    In this case, there is room for argument what to define for
    KBUILD_MODNAME when foo-bar-common.o is being compiled.
    "foo", "bar", or what else?
    
    One idea is to define colon-separated modules that share the object,
    in this case, "bar:foo" (modules are sorted alphabetically by
    $(sort ...)).
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Reviewed-by: default avatarCao jin <caoj.fnst@cn.fujitsu.com>
    aeacb019
Makefile.lib 15.4 KB