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 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: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

+3 -3
+3 -3
scripts/mod/modpost.c
··· 417 417 list_add_tail(&s->list, &mod->exported_symbols); 418 418 } else if (!external_module || s->module->is_vmlinux || 419 419 s->module == mod) { 420 - warn("%s: '%s' exported twice. Previous export was in %s%s\n", 421 - mod->name, name, s->module->name, 422 - s->module->is_vmlinux ? "" : ".ko"); 420 + error("%s: '%s' exported twice. Previous export was in %s%s\n", 421 + mod->name, name, s->module->name, 422 + s->module->is_vmlinux ? "" : ".ko"); 423 423 return s; 424 424 } 425 425