From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Jessica Yu <jeyu@kernel.org>,
Matthias Kaehlcke <mka@chromium.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] modpost: do not invoke extra modpost for nsdeps
Date: Tue, 29 Oct 2019 21:38:06 +0900 [thread overview]
Message-ID: <20191029123809.29301-2-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <20191029123809.29301-1-yamada.masahiro@socionext.com>
'make nsdeps' invokes the modpost three times at most; before linking
vmlinux, before building modules, and finally for generating .ns_deps
files. Running the modpost again and again is annoying.
The last two can be unified. When the -d option is given, the modpost
still does the usual job, and in addition, generates .ns_deps files.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Makefile | 5 ++---
scripts/Makefile.modpost | 8 +++-----
scripts/mod/modpost.c | 9 ++-------
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 4f4d8979bfce..0ef897fd9cfd 100644
--- a/Makefile
+++ b/Makefile
@@ -1682,10 +1682,9 @@ tags TAGS cscope gtags: FORCE
# ---------------------------------------------------------------------------
PHONY += nsdeps
-
+nsdeps: export KBUILD_NSDEPS=1
nsdeps: modules
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps
- $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 01c0a992d293..c9757b20b048 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -53,8 +53,7 @@ MODPOST = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
- $(if $(KBUILD_MODPOST_WARN),-w) \
- $(if $(filter nsdeps,$(MAKECMDGOALS)),-d)
+ $(if $(KBUILD_MODPOST_WARN),-w)
ifdef MODPOST_VMLINUX
@@ -66,7 +65,8 @@ __modpost:
else
-MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T -
+MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \
+ $(if $(KBUILD_NSDEPS),-d)
ifeq ($(KBUILD_EXTMOD),)
MODPOST += $(wildcard vmlinux)
@@ -97,8 +97,6 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
endif
-nsdeps: __modpost
-
endif
.PHONY: $(PHONY)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 26ba97245576..dcd90d563ce8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2221,8 +2221,7 @@ static int check_exports(struct module *mod)
add_namespace(&mod->required_namespaces,
exp->namespace);
- if (!write_namespace_deps &&
- !module_imports_namespace(mod, exp->namespace)) {
+ if (!module_imports_namespace(mod, exp->namespace)) {
warn("module %s uses symbol %s from namespace %s, but does not import it.\n",
basename, exp->name, exp->namespace);
}
@@ -2641,8 +2640,6 @@ int main(int argc, char **argv)
err |= check_modname_len(mod);
err |= check_exports(mod);
- if (write_namespace_deps)
- continue;
add_header(&buf, mod);
add_intree_flag(&buf, !external_module);
@@ -2657,10 +2654,8 @@ int main(int argc, char **argv)
write_if_changed(&buf, fname);
}
- if (write_namespace_deps) {
+ if (write_namespace_deps)
write_namespace_deps_files();
- return 0;
- }
if (dump_write)
write_dump(dump_write);
--
2.17.1
next prev parent reply other threads:[~2019-10-29 12:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 12:38 [PATCH 0/4] More nsdeps improvements Masahiro Yamada
2019-10-29 12:38 ` Masahiro Yamada [this message]
2019-11-05 16:37 ` [PATCH 1/4] modpost: do not invoke extra modpost for nsdeps Matthias Maennich
2019-10-29 12:38 ` [PATCH 2/4] modpost: dump missing namespaces into a single modules.nsdeps file Masahiro Yamada
2019-10-30 20:11 ` Jessica Yu
2019-10-31 11:20 ` Jessica Yu
2019-10-31 11:53 ` Masahiro Yamada
2019-11-06 15:24 ` Matthias Maennich
2019-10-29 12:38 ` [PATCH 3/4] scripts/nsdeps: support nsdeps for external module builds Masahiro Yamada
2019-10-30 17:02 ` Jessica Yu
2019-11-06 16:12 ` Matthias Maennich
2019-10-29 12:38 ` [PATCH 4/4] mospost: remove unneeded local variable in contains_namespace() Masahiro Yamada
2019-11-05 13:47 ` Matthias Maennich
2019-11-06 15:39 ` Masahiro Yamada
2019-10-30 20:14 ` [PATCH 0/4] More nsdeps improvements Jessica Yu
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=20191029123809.29301-2-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=jeyu@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mka@chromium.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).