[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
On Wed, Jun 27 2018, Masahiro Yamada wrote:

> 2018-06-18 13:55 GMT+09:00 NeilBrown <>:
>> 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.

I think this is only true if you have something like

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

in your .c files. Developers who use modobj-m could be advised not to
do this.

> but people often miss to notice that, then cause build errors.

Yes, I can see that.
We could change it to use a default ("no-name") if KBUILD_MODNAME isn't
defined. Or we could require that KBUILD_MODNAME always be defined.

Where I've been using these patches I've sometimes been adding

ccflags-y += -DKBUILD_MODNAME='"FOO"'

to Makefiles so that modules_params get handled correctly on non-module
builds. I've thought about instead allowing "modobj-name" to be defined
and requiring that it be set if either modobj-[yn] is set. Then it gets
used for the KBUILD_MODNAME when building modobj modules.

Would you prefer to always require KBUILD_MODNAME, or to use a default
name for dynamic-debug?

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2018-07-04 00:15    [W:0.106 / U:1.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site