From patchwork Thu Nov 14 17:42:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 179458 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp10954277ocf; Thu, 14 Nov 2019 09:42:47 -0800 (PST) X-Google-Smtp-Source: APXvYqw1mcP8LOBt4siYt+dvs+QK7f6VcED2OHbreyFRU6Ro3wdD/ygM+2Y6PZhFpUaNkZBEUh7B X-Received: by 2002:a05:6402:168b:: with SMTP id a11mr2649745edv.107.1573753366941; Thu, 14 Nov 2019 09:42:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573753366; cv=none; d=google.com; s=arc-20160816; b=UDRMMJfeRbz3SycXtzgOCACsiFryI/iM1BZI+VtmCcF0RsvBRr+G6k7jOKT2POMVNi s2oxgI97xSQYGhUthVPfr5y2uicFZ6kUuoNNNQDqWOuGiETlwpDm+fpxvXE18CrNyU4n lLYAhlnM2DMLiFJ0Il3ekh36lqGy5j+fSf3/6lwvR/Ol3RAt9m5hClo4A3lFao7NiNwu 2qIhTMDQt1JFB+CEUe4hmXVI7/IKJjOBfC7/18I8HfadendThGcxqwMEcEZuCuZUlPax IHdgFKCVtF9T/WURMXr54fVi1CSueNOLMEIDjBbnoeSY28+JIxadl+/EtNWdfCEnzf32 jAMw== 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=fUBxXICdayMSot+TU06/7Ds+CnTO5ybIlw5ICaeyTpM=; b=vk1UTho1EQc3Bu+ErYcs/MMRYFytKNP4iDah6MOwGqxEdw3EGf2WlIyjFCmbvRCIYd rhWPrqOVmkTjEaNA+4cT+c8+7WviNICmtGfIVz3lRPj4y6sszDG9pFZOaq+aOHyl03N4 j+kTsbQ7zQ2pBElnLvKBo2267pS7okvca04VnAEEqY1lHuWfFMsiiqvsx8l/1VPVLfQ1 pNYGkwmkumVd6h/TJK2HKrDmUwpEjiTWwA3Y+OmOn0z9MGXbQIbchsZmE8XOhPt6BM9K Jhca7i2nAd8mTv4funymE5VYNu8UTkXCB8opjoAk5H+CrjgTiAUx6ydbhDd+mtt57GNz WquA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CjDBNJoQ; 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 re9si3955681ejb.332.2019.11.14.09.42.46; Thu, 14 Nov 2019 09:42:46 -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=CjDBNJoQ; 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 S1727048AbfKNRml (ORCPT + 26 others); Thu, 14 Nov 2019 12:42:41 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:64767 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbfKNRmh (ORCPT ); Thu, 14 Nov 2019 12:42:37 -0500 Received: from grover.flets-west.jp (softbank126021098169.bbtec.net [126.21.98.169]) (authenticated) by conuserg-09.nifty.com with ESMTP id xAEHgSo6028428; Fri, 15 Nov 2019 02:42:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com xAEHgSo6028428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1573753351; bh=fUBxXICdayMSot+TU06/7Ds+CnTO5ybIlw5ICaeyTpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjDBNJoQ1nFHK4r4CLKmPL1Jn0sCTmTUQp802gD4dmqGZ0GxE/pGDuq2sx3/33pY6 K7t9nxIiS2w/keZd7gwq/hJbzESVtEBRwiQBSQCsjLx1jPARHdYyq+4B+93QyjK3BB Dwx3FkGg3jOx3vbJuvPHSwUuac9bTx0S/CVfSey1gIpIopP15PT9Ni1TK9Y356WvhA 9aRFtC0Ja8r4QPid+ztjELX4X8/AtJozLZJQBzNA6XoODUaKjqXp9g1BWEWhmiukjp SPUI+8c92LCaDx6a8RpPHrh/Svk1BCk8SPXg/Bp7FTZUrk9X54GP/S6wRNUkevZGMk qreEmMHLVJHvw== X-Nifty-SrcIP: [126.21.98.169] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] modpost: respect the previous export when 'exported twice' is warned Date: Fri, 15 Nov 2019 02:42:26 +0900 Message-Id: <20191114174226.7201-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191114174226.7201-1-yamada.masahiro@socionext.com> References: <20191114174226.7201-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When 'exported twice' is warned, let sym_add_exported() return without updating the symbol info. This respects the previous export, which is ordered first in modules.order This simplifies the code too. Signed-off-by: Masahiro Yamada --- scripts/mod/modpost.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 06086105011f..d9a92fbe1146 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -211,13 +211,11 @@ static struct symbol *new_symbol(const char *name, struct module *module, enum export export) { unsigned int hash; - struct symbol *new; hash = tdb_hash(name) % SYMBOL_HASH_SIZE; - new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); - new->module = module; - new->export = export; - return new; + symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); + + return symbolhash[hash]; } static struct symbol *find_symbol(const char *name) @@ -392,17 +390,15 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, if (!s) { s = new_symbol(name, mod, export); - } else { - if (!external_module || is_vmlinux(s->module->name) || - s->module == mod) { - warn("%s: '%s' exported twice. Previous export was in %s%s\n", - mod->name, name, s->module->name, - is_vmlinux(s->module->name) ? "" : ".ko"); - } else { - /* In case Module.symvers was out of date */ - s->module = mod; - } + } else if (!external_module || is_vmlinux(s->module->name) || + s->module == mod) { + warn("%s: '%s' exported twice. Previous export was in %s%s\n", + mod->name, name, s->module->name, + is_vmlinux(s->module->name) ? "" : ".ko"); + return s; } + + s->module = mod; s->vmlinux = is_vmlinux(mod->name); s->kernel = 0; s->export = export;