summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMatthias Maennich <maennich@google.com>2019-10-18 05:31:41 -0400
committerJessica Yu <jeyu@kernel.org>2019-10-18 09:32:47 -0400
commit9ae5bd1847566e079ffb7607394389ac54815f2b (patch)
tree9a2498d3e40d52500e5701dc019862bf4e8a64e0 /scripts
parenta2b11184389489dcca4fa899b290fc2751ea55ac (diff)
modpost: make updating the symbol namespace explicit
Setting the symbol namespace of a symbol within sym_add_exported feels displaced and lead to issues in the current implementation of symbol namespaces. This patch makes updating the namespace an explicit call to decouple it from adding a symbol to the export list. Acked-by: Will Deacon <will@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 4041a265d2b6..c43f1b1532f7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -385,8 +385,8 @@ static void sym_update_namespace(const char *symname, const char *namespace)
385 * Add an exported symbol - it may have already been added without a 385 * Add an exported symbol - it may have already been added without a
386 * CRC, in this case just update the CRC 386 * CRC, in this case just update the CRC
387 **/ 387 **/
388static struct symbol *sym_add_exported(const char *name, const char *namespace, 388static struct symbol *sym_add_exported(const char *name, struct module *mod,
389 struct module *mod, enum export export) 389 enum export export)
390{ 390{
391 struct symbol *s = find_symbol(name); 391 struct symbol *s = find_symbol(name);
392 392
@@ -402,7 +402,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace,
402 s->module = mod; 402 s->module = mod;
403 } 403 }
404 } 404 }
405 sym_update_namespace(name, namespace);
406 s->preloaded = 0; 405 s->preloaded = 0;
407 s->vmlinux = is_vmlinux(mod->name); 406 s->vmlinux = is_vmlinux(mod->name);
408 s->kernel = 0; 407 s->kernel = 0;
@@ -764,7 +763,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
764 if (strstarts(symname, "__ksymtab_")) { 763 if (strstarts(symname, "__ksymtab_")) {
765 name = symname + strlen("__ksymtab_"); 764 name = symname + strlen("__ksymtab_");
766 namespace = sym_extract_namespace(&name); 765 namespace = sym_extract_namespace(&name);
767 sym_add_exported(name, namespace, mod, export); 766 sym_add_exported(name, mod, export);
767 sym_update_namespace(name, namespace);
768 free(namespace); 768 free(namespace);
769 } 769 }
770 if (strcmp(symname, "init_module") == 0) 770 if (strcmp(symname, "init_module") == 0)
@@ -2472,12 +2472,12 @@ static void read_dump(const char *fname, unsigned int kernel)
2472 mod = new_module(modname); 2472 mod = new_module(modname);
2473 mod->skip = 1; 2473 mod->skip = 1;
2474 } 2474 }
2475 s = sym_add_exported(symname, namespace, mod, 2475 s = sym_add_exported(symname, mod, export_no(export));
2476 export_no(export));
2477 s->kernel = kernel; 2476 s->kernel = kernel;
2478 s->preloaded = 1; 2477 s->preloaded = 1;
2479 s->is_static = 0; 2478 s->is_static = 0;
2480 sym_update_crc(symname, mod, crc, export_no(export)); 2479 sym_update_crc(symname, mod, crc, export_no(export));
2480 sym_update_namespace(symname, namespace);
2481 } 2481 }
2482 release_file(file, size); 2482 release_file(file, size);
2483 return; 2483 return;