Commit bff9c62b authored by Masahiro Yamada's avatar Masahiro Yamada

modpost: do not invoke extra modpost for nsdeps

'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 not efficient.

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: default avatarMatthias Maennich <maennich@google.com>
Reviewed-by: default avatarMatthias Maennich <maennich@google.com>
parent faade961
...@@ -1684,10 +1684,9 @@ tags TAGS cscope gtags: FORCE ...@@ -1684,10 +1684,9 @@ tags TAGS cscope gtags: FORCE
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
PHONY += nsdeps PHONY += nsdeps
nsdeps: export KBUILD_NSDEPS=1
nsdeps: modules nsdeps: modules
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps $(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
# Scripts to check various things for consistency # Scripts to check various things for consistency
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -53,8 +53,7 @@ MODPOST = scripts/mod/modpost \ ...@@ -53,8 +53,7 @@ MODPOST = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \ $(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
$(if $(KBUILD_MODPOST_WARN),-w) \ $(if $(KBUILD_MODPOST_WARN),-w)
$(if $(filter nsdeps,$(MAKECMDGOALS)),-d)
ifdef MODPOST_VMLINUX ifdef MODPOST_VMLINUX
...@@ -66,7 +65,8 @@ __modpost: ...@@ -66,7 +65,8 @@ __modpost:
else 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),) ifeq ($(KBUILD_EXTMOD),)
MODPOST += $(wildcard vmlinux) MODPOST += $(wildcard vmlinux)
...@@ -96,8 +96,6 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1) ...@@ -96,8 +96,6 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
endif endif
nsdeps: __modpost
endif endif
.PHONY: $(PHONY) .PHONY: $(PHONY)
...@@ -2221,8 +2221,7 @@ static int check_exports(struct module *mod) ...@@ -2221,8 +2221,7 @@ static int check_exports(struct module *mod)
add_namespace(&mod->required_namespaces, add_namespace(&mod->required_namespaces,
exp->namespace); exp->namespace);
if (!write_namespace_deps && if (!module_imports_namespace(mod, exp->namespace)) {
!module_imports_namespace(mod, exp->namespace)) {
warn("module %s uses symbol %s from namespace %s, but does not import it.\n", warn("module %s uses symbol %s from namespace %s, but does not import it.\n",
basename, exp->name, exp->namespace); basename, exp->name, exp->namespace);
} }
...@@ -2642,8 +2641,6 @@ int main(int argc, char **argv) ...@@ -2642,8 +2641,6 @@ int main(int argc, char **argv)
err |= check_modname_len(mod); err |= check_modname_len(mod);
err |= check_exports(mod); err |= check_exports(mod);
if (write_namespace_deps)
continue;
add_header(&buf, mod); add_header(&buf, mod);
add_intree_flag(&buf, !external_module); add_intree_flag(&buf, !external_module);
...@@ -2658,10 +2655,8 @@ int main(int argc, char **argv) ...@@ -2658,10 +2655,8 @@ int main(int argc, char **argv)
write_if_changed(&buf, fname); write_if_changed(&buf, fname);
} }
if (write_namespace_deps) { if (write_namespace_deps)
write_namespace_deps_files(); write_namespace_deps_files();
return 0;
}
if (dump_write) if (dump_write)
write_dump(dump_write); write_dump(dump_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment