aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-05-01 17:40:18 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-08 03:17:01 +0900
commite76cc48d8e6df5d949284132981db73d2dd8c6b5 (patch)
treeed301148e5ef73e945734f37aa5082da06fc18c7 /scripts/mod/modpost.c
parentmodpost: make multiple export error (diff)
downloadlinux-dev-e76cc48d8e6df5d949284132981db73d2dd8c6b5.tar.xz
linux-dev-e76cc48d8e6df5d949284132981db73d2dd8c6b5.zip
modpost: make sym_add_exported() always allocate a new symbol
Currently, sym_add_exported() does not allocate a symbol if the same name symbol already exists in the hash table. This does not reflect the real use cases. You can let an external module override the in-tree one. In this case, the external module will export the same name symbols as the in-tree one. However, modpost simply ignores those symbols, then Module.symvers for the external module loses its symbols. sym_add_exported() should allocate a new symbol. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to '')
-rw-r--r--scripts/mod/modpost.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 841f69475247..6024c668a07c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -412,19 +412,17 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
{
struct symbol *s = find_symbol(name);
- if (!s) {
- s = new_symbol(name, mod, export);
- list_add_tail(&s->list, &mod->exported_symbols);
- } else if (!external_module || s->module->is_vmlinux ||
- s->module == mod) {
+ if (s && (!external_module || s->module->is_vmlinux || s->module == mod)) {
error("%s: '%s' exported twice. Previous export was in %s%s\n",
mod->name, name, s->module->name,
s->module->is_vmlinux ? "" : ".ko");
- return s;
}
+ s = new_symbol(name, mod, export);
s->module = mod;
s->export = export;
+ list_add_tail(&s->list, &mod->exported_symbols);
+
return s;
}