ANDROID: modpost: Forbid double exports

In the context of GKI we are exporting quite a few internal kernel
symbols, some of which may be static functions (yes this is bad, but
technically it works). As such, we need to be careful about conflicts
and we really should not allow a symbol to be exported more than once.

To ensure this is the case, turn the modpost check 'fatal' to bail out
immediately when such a situation is detected.

Bug: 174214891
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I674c9c9c327849503e94d79654e6288411a830af
This commit is contained in:
Quentin Perret
2020-11-24 14:40:13 +00:00
parent db78f3b149
commit 479488f5bf

View File

@@ -426,10 +426,9 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
s = new_symbol(name, mod, export);
} else if (!external_module || s->module->is_vmlinux ||
s->module == mod) {
warn("%s: '%s' exported twice. Previous export was in %s%s\n",
mod->name, name, s->module->name,
s->module->is_vmlinux ? "" : ".ko");
return s;
fatal("%s: '%s' exported twice. Previous export was in %s%s\n",
mod->name, name, s->module->name,
s->module->is_vmlinux ? "" : ".ko");
}
s->module = mod;