diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-11-15 02:42:26 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-11-23 15:46:42 +0900 |
commit | 7ef9ab3b32b4bb72a7d70b832d2eb12ceb93d9fd (patch) | |
tree | 582933ecde0c01c0a304fdbd616840fca6163366 /scripts | |
parent | e4b26c9f75e48b5ef9e31ac6c8a445d4479b469c (diff) | |
download | lwn-7ef9ab3b32b4bb72a7d70b832d2eb12ceb93d9fd.tar.gz lwn-7ef9ab3b32b4bb72a7d70b832d2eb12ceb93d9fd.zip |
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: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/modpost.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2fa58fbbd10b..6e892c93d104 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -211,13 +211,11 @@ static struct symbol *new_symbol(const char *name, struct module *module, enum export export) { unsigned int hash; - struct symbol *new; hash = tdb_hash(name) % SYMBOL_HASH_SIZE; - new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); - new->module = module; - new->export = export; - return new; + symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); + + return symbolhash[hash]; } static struct symbol *find_symbol(const char *name) @@ -392,17 +390,15 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, if (!s) { s = new_symbol(name, mod, export); - } else { - if (!external_module || is_vmlinux(s->module->name) || - s->module == mod) { - warn("%s: '%s' exported twice. Previous export was in %s%s\n", - mod->name, name, s->module->name, - is_vmlinux(s->module->name) ? "" : ".ko"); - } else { - /* In case Module.symvers was out of date */ - s->module = mod; - } + } else if (!external_module || is_vmlinux(s->module->name) || + s->module == mod) { + warn("%s: '%s' exported twice. Previous export was in %s%s\n", + mod->name, name, s->module->name, + is_vmlinux(s->module->name) ? "" : ".ko"); + return s; } + + s->module = mod; s->vmlinux = is_vmlinux(mod->name); s->kernel = 0; s->export = export; |