From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Leonardo Bras <leobras.c@gmail.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] modpost: move unresolved symbol checks to check_exports()
Date: Fri, 23 Nov 2018 16:57:23 +0900 [thread overview]
Message-ID: <1542959843-16145-3-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1542959843-16145-1-git-send-email-yamada.masahiro@socionext.com>
This will fit better in check_exports() than add_versions().
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/mod/modpost.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 05e41eb..32e5026 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2085,15 +2085,27 @@ static void check_for_unused(enum export exp, const char *m, const char *s)
}
}
-static void check_exports(struct module *mod)
+static int check_exports(struct module *mod)
{
struct symbol *s, *exp;
+ int err = 0;
for (s = mod->unres; s; s = s->next) {
const char *basename;
exp = find_symbol(s->name);
- if (!exp || exp->module == mod)
+ if (!exp || exp->module == mod) {
+ if (have_vmlinux && !s->weak) {
+ if (warn_unresolved) {
+ warn("\"%s\" [%s.ko] undefined!\n",
+ s->name, mod->name);
+ } else {
+ merror("\"%s\" [%s.ko] undefined!\n",
+ s->name, mod->name);
+ err = 1;
+ }
+ }
continue;
+ }
basename = strrchr(mod->name, '/');
if (basename)
basename++;
@@ -2103,6 +2115,8 @@ static void check_exports(struct module *mod)
check_for_gpl_usage(exp->export, basename, exp->name);
check_for_unused(exp->export, basename, exp->name);
}
+
+ return err;
}
static int check_modname_len(struct module *mod)
@@ -2180,19 +2194,8 @@ static int add_versions(struct buffer *b, struct module *mod)
for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name);
- if (!exp || exp->module == mod) {
- if (have_vmlinux && !s->weak) {
- if (warn_unresolved) {
- warn("\"%s\" [%s.ko] undefined!\n",
- s->name, mod->name);
- } else {
- merror("\"%s\" [%s.ko] undefined!\n",
- s->name, mod->name);
- err = 1;
- }
- }
+ if (!exp || exp->module == mod)
continue;
- }
s->module = exp->module;
s->crc_valid = exp->crc_valid;
s->crc = exp->crc;
@@ -2495,7 +2498,7 @@ int main(int argc, char **argv)
buf.pos = 0;
err |= check_modname_len(mod);
- check_exports(mod);
+ err |= check_exports(mod);
add_header(&buf, mod);
add_intree_flag(&buf, !external_module);
add_retpoline(&buf);
--
2.7.4
next prev parent reply other threads:[~2018-11-23 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 7:57 [PATCH 1/3] modpost: refactor seen flag clearing in add_depends() Masahiro Yamada
2018-11-23 7:57 ` [PATCH 2/3] modpost: merge module iterations Masahiro Yamada
2018-11-23 7:57 ` Masahiro Yamada [this message]
2018-12-01 14:54 ` [PATCH 1/3] modpost: refactor seen flag clearing in add_depends() Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1542959843-16145-3-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=leobras.c@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).