提交 b8422711 编写于 作者: M Masahiro Yamada

modpost: make multiple export error

This is currently a warning, but I think modpost should stop building
in this case.

If the same symbol is exported multiple times and we let it keep going,
the sanity check becomes difficult.

Only the legitimate case is that an external module overrides the
corresponding in-tree module to provide a different implementation
with the same interface.

Also, there exists an upstream example that exploits this feature.

  $ make M=tools/testing/nvdimm

... builds tools/testing/nvdimm/libnvdimm.ko. This is a mocked module
that overrides the symbols from drivers/nvdimm/libnvdimm.ko.
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
上级 f841536e
...@@ -417,7 +417,7 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, ...@@ -417,7 +417,7 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
list_add_tail(&s->list, &mod->exported_symbols); list_add_tail(&s->list, &mod->exported_symbols);
} else if (!external_module || s->module->is_vmlinux || } else if (!external_module || s->module->is_vmlinux ||
s->module == mod) { s->module == mod) {
warn("%s: '%s' exported twice. Previous export was in %s%s\n", error("%s: '%s' exported twice. Previous export was in %s%s\n",
mod->name, name, s->module->name, mod->name, name, s->module->name,
s->module->is_vmlinux ? "" : ".ko"); s->module->is_vmlinux ? "" : ".ko");
return s; return s;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册