Commit 9ae5bd18 authored by Matthias Maennich's avatar Matthias Maennich Committed by Jessica Yu

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: default avatarWill Deacon <will@kernel.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarMatthias Maennich <maennich@google.com>
Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
parent a2b11184
...@@ -385,8 +385,8 @@ static void sym_update_namespace(const char *symname, const char *namespace) ...@@ -385,8 +385,8 @@ static void sym_update_namespace(const char *symname, const char *namespace)
* Add an exported symbol - it may have already been added without a * Add an exported symbol - it may have already been added without a
* CRC, in this case just update the CRC * CRC, in this case just update the CRC
**/ **/
static struct symbol *sym_add_exported(const char *name, const char *namespace, static struct symbol *sym_add_exported(const char *name, struct module *mod,
struct module *mod, enum export export) enum export export)
{ {
struct symbol *s = find_symbol(name); struct symbol *s = find_symbol(name);
...@@ -402,7 +402,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, ...@@ -402,7 +402,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace,
s->module = mod; s->module = mod;
} }
} }
sym_update_namespace(name, namespace);
s->preloaded = 0; s->preloaded = 0;
s->vmlinux = is_vmlinux(mod->name); s->vmlinux = is_vmlinux(mod->name);
s->kernel = 0; s->kernel = 0;
...@@ -764,7 +763,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -764,7 +763,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
if (strstarts(symname, "__ksymtab_")) { if (strstarts(symname, "__ksymtab_")) {
name = symname + strlen("__ksymtab_"); name = symname + strlen("__ksymtab_");
namespace = sym_extract_namespace(&name); namespace = sym_extract_namespace(&name);
sym_add_exported(name, namespace, mod, export); sym_add_exported(name, mod, export);
sym_update_namespace(name, namespace);
free(namespace); free(namespace);
} }
if (strcmp(symname, "init_module") == 0) if (strcmp(symname, "init_module") == 0)
...@@ -2472,12 +2472,12 @@ static void read_dump(const char *fname, unsigned int kernel) ...@@ -2472,12 +2472,12 @@ static void read_dump(const char *fname, unsigned int kernel)
mod = new_module(modname); mod = new_module(modname);
mod->skip = 1; mod->skip = 1;
} }
s = sym_add_exported(symname, namespace, mod, s = sym_add_exported(symname, mod, export_no(export));
export_no(export));
s->kernel = kernel; s->kernel = kernel;
s->preloaded = 1; s->preloaded = 1;
s->is_static = 0; s->is_static = 0;
sym_update_crc(symname, mod, crc, export_no(export)); sym_update_crc(symname, mod, crc, export_no(export));
sym_update_namespace(symname, namespace);
} }
release_file(file, size); release_file(file, size);
return; return;
......
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