Commit 7ef9ab3b authored by Masahiro Yamada's avatar Masahiro Yamada

modpost: respect the previous export when 'exported twice' is warned

When 'exported twice' is warned, let sym_add_exported() return without
updating the symbol info. This respects the previous export, which is
ordered first in modules.order

This simplifies the code too.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent e4b26c9f
...@@ -211,13 +211,11 @@ static struct symbol *new_symbol(const char *name, struct module *module, ...@@ -211,13 +211,11 @@ static struct symbol *new_symbol(const char *name, struct module *module,
enum export export) enum export export)
{ {
unsigned int hash; unsigned int hash;
struct symbol *new;
hash = tdb_hash(name) % SYMBOL_HASH_SIZE; hash = tdb_hash(name) % SYMBOL_HASH_SIZE;
new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]);
new->module = module;
new->export = export; return symbolhash[hash];
return new;
} }
static struct symbol *find_symbol(const char *name) static struct symbol *find_symbol(const char *name)
...@@ -392,17 +390,15 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, ...@@ -392,17 +390,15 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
if (!s) { if (!s) {
s = new_symbol(name, mod, export); s = new_symbol(name, mod, export);
} else { } else if (!external_module || is_vmlinux(s->module->name) ||
if (!external_module || is_vmlinux(s->module->name) || s->module == mod) {
s->module == mod) { warn("%s: '%s' exported twice. Previous export was in %s%s\n",
warn("%s: '%s' exported twice. Previous export was in %s%s\n", mod->name, name, s->module->name,
mod->name, name, s->module->name, is_vmlinux(s->module->name) ? "" : ".ko");
is_vmlinux(s->module->name) ? "" : ".ko"); return s;
} else {
/* In case Module.symvers was out of date */
s->module = mod;
}
} }
s->module = mod;
s->vmlinux = is_vmlinux(mod->name); s->vmlinux = is_vmlinux(mod->name);
s->kernel = 0; s->kernel = 0;
s->export = export; s->export = export;
......
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