Commit 39808e45 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: do not read $(KBUILD_EXTMOD)/Module.symvers

Since commit 040fcc81 ("kbuild: improved modversioning support for
external modules"), the external module build reads Module.symvers in
the directory of the module itself, then dumps symbols back into it.
It accumulates stale symbols in the file when you build an external
module incrementally.

The idea behind it was, as the commit log explained, you can copy
Modules.symvers from one module to another when you need to pass symbol
information between two modules. However, the manual copy of the file
sounds questionable to me, and containing stale symbols is a downside.

Some time later, commit 0d96fb20 ("kbuild: Add new Kbuild variable
KBUILD_EXTRA_SYMBOLS") introduced a saner approach.

So, this commit removes the former one. Going forward, the external
module build dumps symbols into Module.symvers to be carried via
KBUILD_EXTRA_SYMBOLS, but never reads it automatically.

With the -I option removed, there is no one to set the external_module
flag unless KBUILD_EXTRA_SYMBOLS is passed. Now the -i option does it
instead.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 1747269a
...@@ -492,11 +492,8 @@ build. ...@@ -492,11 +492,8 @@ build.
to the symbols from the kernel to check if all external symbols to the symbols from the kernel to check if all external symbols
are defined. This is done in the MODPOST step. modpost obtains are defined. This is done in the MODPOST step. modpost obtains
the symbols by reading Module.symvers from the kernel source the symbols by reading Module.symvers from the kernel source
tree. If a Module.symvers file is present in the directory tree. During the MODPOST step, a new Module.symvers file will be
where the external module is being built, this file will be written containing all exported symbols from that external module.
read too. During the MODPOST step, a new Module.symvers file
will be written containing all exported symbols that were not
defined in the kernel.
6.3 Symbols From Another External Module 6.3 Symbols From Another External Module
---------------------------------------- ----------------------------------------
...@@ -504,7 +501,7 @@ build. ...@@ -504,7 +501,7 @@ build.
Sometimes, an external module uses exported symbols from Sometimes, an external module uses exported symbols from
another external module. Kbuild needs to have full knowledge of another external module. Kbuild needs to have full knowledge of
all symbols to avoid spitting out warnings about undefined all symbols to avoid spitting out warnings about undefined
symbols. Three solutions exist for this situation. symbols. Two solutions exist for this situation.
NOTE: The method with a top-level kbuild file is recommended NOTE: The method with a top-level kbuild file is recommended
but may be impractical in certain situations. but may be impractical in certain situations.
...@@ -544,8 +541,8 @@ build. ...@@ -544,8 +541,8 @@ build.
all symbols defined and not part of the kernel. all symbols defined and not part of the kernel.
Use "make" variable KBUILD_EXTRA_SYMBOLS Use "make" variable KBUILD_EXTRA_SYMBOLS
If it is impractical to copy Module.symvers from If it is impractical to add a top-level kbuild file,
another module, you can assign a space separated list you can assign a space separated list
of files to KBUILD_EXTRA_SYMBOLS in your build file. of files to KBUILD_EXTRA_SYMBOLS in your build file.
These files will be loaded by modpost during the These files will be loaded by modpost during the
initialization of its symbol tables. initialization of its symbol tables.
......
...@@ -50,7 +50,6 @@ MODPOST = scripts/mod/modpost \ ...@@ -50,7 +50,6 @@ MODPOST = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODVERSIONS),-m) \
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(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) \
......
...@@ -2561,7 +2561,7 @@ int main(int argc, char **argv) ...@@ -2561,7 +2561,7 @@ int main(int argc, char **argv)
{ {
struct module *mod; struct module *mod;
struct buffer buf = { }; struct buffer buf = { };
char *kernel_read = NULL, *module_read = NULL; char *kernel_read = NULL;
char *dump_write = NULL, *files_source = NULL; char *dump_write = NULL, *files_source = NULL;
int opt; int opt;
int err; int err;
...@@ -2569,13 +2569,10 @@ int main(int argc, char **argv) ...@@ -2569,13 +2569,10 @@ int main(int argc, char **argv)
struct ext_sym_list *extsym_iter; struct ext_sym_list *extsym_iter;
struct ext_sym_list *extsym_start = NULL; struct ext_sym_list *extsym_start = NULL;
while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awEd")) != -1) { while ((opt = getopt(argc, argv, "i:e:mnsT:o:awEd")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
kernel_read = optarg; kernel_read = optarg;
break;
case 'I':
module_read = optarg;
external_module = 1; external_module = 1;
break; break;
case 'e': case 'e':
...@@ -2620,8 +2617,6 @@ int main(int argc, char **argv) ...@@ -2620,8 +2617,6 @@ int main(int argc, char **argv)
if (kernel_read) if (kernel_read)
read_dump(kernel_read, 1); read_dump(kernel_read, 1);
if (module_read)
read_dump(module_read, 0);
while (extsym_start) { while (extsym_start) {
read_dump(extsym_start->file, 0); read_dump(extsym_start->file, 0);
extsym_iter = extsym_start->next; extsym_iter = extsym_start->next;
......
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