All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
Date: Mon, 18 Jun 2018 14:55:20 +1000	[thread overview]
Message-ID: <152929772052.17463.10728056000221362647.stgit@noble> (raw)
In-Reply-To: <152929708853.17463.17302660556961083137.stgit@noble>

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@suse.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)



  reply	other threads:[~2018-06-18  4:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  4:55 [RFC PATCH 0/5] kbuild: build modules from code in multiple directories NeilBrown
2018-06-18  4:55 ` NeilBrown [this message]
2018-06-27  5:52   ` [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a Masahiro Yamada
2018-07-03 22:14     ` NeilBrown
2018-07-04 12:08       ` Masahiro Yamada
2018-07-04 21:54         ` NeilBrown
2018-07-05  9:06           ` Masahiro Yamada
2018-07-05 23:03             ` NeilBrown
2018-06-18  4:55 ` [PATCH 3/5] kbuild: support building of per-directory mod.a NeilBrown
2018-06-19  3:57   ` [PATCH 3/5 - v2] " NeilBrown
2018-06-18  4:55 ` [PATCH 1/5] kbuild: detect directories in components of a module NeilBrown
2018-06-18  4:55 ` [PATCH 2/5] kbuild: treat a directory listed in a composite object as foo/mod.a NeilBrown
2018-06-18  9:14   ` kbuild test robot
2018-06-18 22:30     ` NeilBrown
2018-06-18 22:30       ` NeilBrown
2018-06-18  4:55 ` [PATCH 5/5] kbuild: Add documentation for modobj-m NeilBrown
2018-06-18  8:20 ` [RFC PATCH 0/5] kbuild: build modules from code in multiple directories Christoph Hellwig
2018-06-19  4:05   ` NeilBrown
2018-06-19  4:47     ` Christoph Hellwig
2018-06-19  5:03       ` Darrick J. Wong

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=152929772052.17463.10728056000221362647.stgit@noble \
    --to=neilb@suse.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=yamada.masahiro@socionext.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.