| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| From: Quentin Perret <qperret@google.com> |
| Date: Tue, 24 Nov 2020 14:40:13 +0000 |
| Subject: NOUPSTREAM: 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. |
| |
| [CPNOTE: 03/06/21] Lee: Fatal only makes sense for GKI based builds |
| |
| Bug: 174214891 |
| Signed-off-by: Quentin Perret <qperret@google.com> |
| Change-Id: I674c9c9c327849503e94d79654e6288411a830af |
| --- |
| scripts/mod/modpost.c | 7 +++---- |
| 1 file changed, 3 insertions(+), 4 deletions(-) |
| |
| diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c |
| --- a/scripts/mod/modpost.c |
| +++ b/scripts/mod/modpost.c |
| @@ -418,10 +418,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; |