From patchwork Fri Nov 23 07:57:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151842 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1755260ljp; Thu, 22 Nov 2018 23:58:01 -0800 (PST) X-Google-Smtp-Source: AJdET5fokySEZ4espQRxq9dY9FABQplkWn5ZL+Chd3GRTcd8oLLgiO09CbLyQmwGNNeu48xIufqN X-Received: by 2002:a63:f74f:: with SMTP id f15mr13163940pgk.190.1542959881695; Thu, 22 Nov 2018 23:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542959881; cv=none; d=google.com; s=arc-20160816; b=VYZmPBlBXJLPfzVAj5D8HU9anmYACA4vel6ZV2APrpZqRO6zBfZYm0OtkvGMLXvrKh mmv1ouIH8TzfKkwoUFWj85cuYmHrcLUUKrWJBvmGAO6/Gn3idHSOTfoaqeCp2QJO7cWj 3+btVk5AKCPDpUx8ofeVu3T1xlXXowZwC7Q5T8raGS7l1x4JgTLYYUPzbmVwqJndW945 5sf56fttv1eX49RLowFRHUobgmwIKjCypJSolW+/SwNBGyqhJg4SuZfqfOnEkpuAJUHh 5Dddi4HRQ7mZWqUyU4lkYyL1OGyd4RGESBr+Jhcroy7T+pyf6tpM+awizYMP73yYyUq0 uuUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=lOj4lXrPAtpsd7/ex0Gl8dUQwYFD9eQxYWKByw5NgPM=; b=zZJecUybjBqNCwwUfFMnK/35LyKAOKQgxcH8k79733nWpDQTWQoE+RH15vYcn1YYkM Oy8jE/dnBxDxdbzATVwGKDLkaCJQylydIFccaduxyca6geZCr7jx1aBkWhVOIwwEroRn FB8l2QI1S8yG/URjoQRZzcAH3+KEKUko6YYOJChinNdpTo6k9EX/ni8BE/HlrZmkZaE9 g6Y4bZ1hoiTQPYCIoVxV1ad8Yfr7XsdRzdayBth8HB5tlj2zzi0RyL9ok2CxyYCHpRKF HDa0hPvFyb7aFMizg3K0g+7kPIyvMC7fMR+9GerJGEamsrd8WevFBPqLkczi6agZOmF5 QjVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Sx8OsZDz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12si28808247plc.0.2018.11.22.23.58.01; Thu, 22 Nov 2018 23:58:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Sx8OsZDz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405163AbeKWSlA (ORCPT + 32 others); Fri, 23 Nov 2018 13:41:00 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:55965 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390244AbeKWSk6 (ORCPT ); Fri, 23 Nov 2018 13:40:58 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAN7vWj4021058; Fri, 23 Nov 2018 16:57:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAN7vWj4021058 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542959854; bh=lOj4lXrPAtpsd7/ex0Gl8dUQwYFD9eQxYWKByw5NgPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sx8OsZDzhuTgWgFLlXbvFLWcV3pSYAVDEBgxFxVMS2LgCevnloYb2U7QEJwWz9MXv L/Upzk2qrX7mgA2zuPgd8nYtNohp9dKye07v8UCbsotgn8nsF4rhzWBACJ3t7qYFu0 JKNmHslMm6z6BLDHmESXA39h8ghc0ScPdvAs5Fy08/Nm3Yhj21Z3ZTlSSszjCnilq9 wIOHs8v/BhOxymxjyJ1vgrNHbD7Bsn6E88yv2xvTHGocNDub9TdVI/iRkOeWVcuJ41 edPVUxRB1yy0LfRixOgxh5H5yxoHqkrPKwhdNJWnWUUtR41vUVUpuoMn/AnPdOZQY0 1Z17/ydXedUSQ== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Leonardo Bras , Masahiro Yamada , Michal Marek , 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 Message-Id: <1542959843-16145-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542959843-16145-1-git-send-email-yamada.masahiro@socionext.com> References: <1542959843-16145-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will fit better in check_exports() than add_versions(). Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) -- 2.7.4 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);