[PATCH v2 19/29] modpost: show warning if it fails to read symbol dump file
From: Masahiro Yamada
Date: Sun May 24 2020 - 11:44:29 EST
If modpost fails to load a symbol dump file, it cannot check unresolved
symbols, hence module dependency will not be added. Nor CRCs can be added.
Currently, external module builds check only $(objtree)/Module.symvers,
but it should check files specified by KBUILD_EXTRA_SYMBOLS as well.
Print the warnings in modpost. The warning in Makefile is unneeded.
Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
---
Changes in v2: None
Makefile | 10 +---------
scripts/mod/modpost.c | 11 +++++++++--
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index 48a2dfaf3bf3..3b25a51132ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1641,17 +1641,9 @@ else # KBUILD_EXTMOD
# We are always building modules
KBUILD_MODULES := 1
-PHONY += $(objtree)/Module.symvers
-$(objtree)/Module.symvers:
- @test -e $(objtree)/Module.symvers || ( \
- echo; \
- echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \
- echo " is missing; modules will have no dependencies and modversions."; \
- echo )
-
build-dirs := $(KBUILD_EXTMOD)
PHONY += modules
-modules: descend $(objtree)/Module.symvers
+modules: descend
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
PHONY += modules_install
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 638c45d35292..34f2aa3a021f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -41,6 +41,8 @@ static int sec_mismatch_fatal = 0;
static int ignore_missing_files;
/* If set to 1, only warn (instead of error) about missing ns imports */
static int allow_missing_ns_imports;
+/* Set when at list one dump file is missing */
+static int missing_dump_file;
enum export {
export_plain, export_unused, export_gpl,
@@ -2438,9 +2440,11 @@ static void read_dump(const char *fname)
char *buf, *pos, *line;
buf = read_text_file(fname);
- if (!buf)
- /* No symbol versions, silently ignore */
+ if (!buf) {
+ warn("failed to read '%s'\n", fname);
+ missing_dump_file = 1;
return;
+ }
pos = buf;
@@ -2625,6 +2629,9 @@ int main(int argc, char **argv)
if (files_source)
read_symbols_from_files(files_source);
+ if (missing_dump_file)
+ warn("Symbol dump file is missing. Modules may not have dependencies or movversions.\n");
+
/*
* When there's no vmlinux, don't print warnings about
* unresolved symbols (since there'll be too many ;)
--
2.25.1