From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Sam Ravnborg <sam@ravnborg.org>,
Michal Marek <michal.lkml@markovi.net>,
Govind Singh <govinds@codeaurora.org>,
Kalle Valo <kvalo@codeaurora.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/5] kbuild: define KBUILD_MODNAME even if multiple modules share objects
Date: Thu, 8 Mar 2018 19:21:14 +0900 [thread overview]
Message-ID: <CAK7LNARhhs4o-cKKzW9exRjbCYpTntdBvUgsx6o-egsTc2pQ0g@mail.gmail.com> (raw)
In-Reply-To: <4022257e-9ab0-b038-df0e-b15b98cb999f@cn.fujitsu.com>
2018-03-08 19:11 GMT+09:00 Cao jin <caoj.fnst@cn.fujitsu.com>:
>
>
> On 03/08/2018 09:05 AM, Masahiro Yamada wrote:
>> 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-main.o
>> bar-objs := foo-bar-common.o bar-main.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: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>> scripts/Makefile.lib | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>> index a7e315f..a1fbd6a 100644
>> --- a/scripts/Makefile.lib
>> +++ b/scripts/Makefile.lib
>> @@ -92,8 +92,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
>> # differ in different configs.
>> name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
>> basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
>> -modname_flags = $(if $(filter 1,$(words $(modname))),\
>> - -DKBUILD_MODNAME=$(call name-fix,$(modname)))
>> +modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname))
>>
>
> I guess there is comment also need to be modified above this code hunk:
>
> Note: Files that end up in two or more modules are compiled without the
> KBUILD_MODNAME definition. The reason is that any made-up name
> would differ in different configs.
Why do I have to add lying comments here?
The commit subject/log claims KBUILD_MODNAME should be _always_ defined.
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2018-03-08 10:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 1:04 [PATCH 0/5] kbuild: always define KBUILD_MODNAME, and clean-up/fix modname Masahiro Yamada
2018-03-08 1:04 ` [PATCH 1/5] kbuild: remove unnecessary $(subst $(obj)/,,...) in modname-multi Masahiro Yamada
2018-03-08 10:19 ` Cao jin
2018-03-08 10:24 ` Masahiro Yamada
2018-03-08 1:05 ` [PATCH 2/5] kbuild: define KBUILD_MODNAME even if multiple modules share objects Masahiro Yamada
2018-03-08 10:11 ` Cao jin
2018-03-08 10:21 ` Masahiro Yamada [this message]
2018-03-08 10:25 ` Cao jin
2018-03-08 10:29 ` Masahiro Yamada
2018-03-08 1:05 ` [PATCH 3/5] kbuild: fix modname for composite modules Masahiro Yamada
2018-03-08 1:05 ` [PATCH 4/5] kbuild: simplify modname calculation Masahiro Yamada
2018-03-09 3:12 ` Cao jin
2018-03-08 1:05 ` [PATCH 5/5] kbuild: move modname and modname-multi close to modname_flags Masahiro Yamada
2018-03-09 3:13 ` Cao jin
2018-03-09 7:33 ` [PATCH 0/5] kbuild: always define KBUILD_MODNAME, and clean-up/fix modname Cao jin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAK7LNARhhs4o-cKKzW9exRjbCYpTntdBvUgsx6o-egsTc2pQ0g@mail.gmail.com \
--to=yamada.masahiro@socionext.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=govinds@codeaurora.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).