Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+4 -6
+4 -6
scripts/mod/modpost.c
··· 412 412 { 413 413 struct symbol *s = find_symbol(name); 414 414 415 - if (!s) { 416 - s = new_symbol(name, mod, export); 417 - list_add_tail(&s->list, &mod->exported_symbols); 418 - } else if (!external_module || s->module->is_vmlinux || 419 - s->module == mod) { 415 + if (s && (!external_module || s->module->is_vmlinux || s->module == mod)) { 420 416 error("%s: '%s' exported twice. Previous export was in %s%s\n", 421 417 mod->name, name, s->module->name, 422 418 s->module->is_vmlinux ? "" : ".ko"); 423 - return s; 424 419 } 425 420 421 + s = new_symbol(name, mod, export); 426 422 s->module = mod; 427 423 s->export = export; 424 + list_add_tail(&s->list, &mod->exported_symbols); 425 + 428 426 return s; 429 427 } 430 428