[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAR2n_Kf7HEwWgLwH8sjyVAiJUWkvV7ZAbkNn0KgVTUx1Q@mail.gmail.com>
Date: Wed, 27 Jun 2018 14:52:33 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: NeilBrown <neilb@...e.com>
Cc: Michal Marek <michal.lkml@...kovi.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Subject: Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
2018-06-18 13:55 GMT+09:00 NeilBrown <neilb@...e.com>:
> 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.
Honestly, I hate KBUILD_MODNAME.
If KBUILD_MODNAME is undefined,
you cannot call pr_debug() in the sub-directory for example.
CONFIG_DYNAMIC_DEBUG requires KBUILD_MODNAME,
but people often miss to notice that, then cause build errors.
> Signed-off-by: NeilBrown <neilb@...e.com>
> ---
> 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@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists