Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3482040ybc; Thu, 14 Nov 2019 09:44:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyutwdNAvfe2mHN0h7yFV1QObySlm/d7eC+MxMULZwBc3BPUk6CV+oimIgeNjDgkS6i0b+o X-Received: by 2002:aa7:d2cf:: with SMTP id k15mr2651710edr.267.1573753452117; Thu, 14 Nov 2019 09:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573753452; cv=none; d=google.com; s=arc-20160816; b=cJgJ5o9eJZqfUYAJ2hWQGWBVDPugn3sHAiTqLyxGV8asOxJcofu1oYtbgWE/CdrOVn 30zvMqKlnkQeg0BKO5unCGeEwv+vsvpv0ZlOloqES8Z3cBvpxIVRoYUzd6GMp/44zXL9 grBB2olIOrKwwEIIKDDBCS/y7xHW9WNl0j3I+cFNv3VihOGl6PFaLqLRTQRhui9a2gV0 /GLGcNnsRkBGcYs+IrMBBZEYgknkjNhtoeucJdH3V+w0RFqpn2YCyn6bZPnUdbwn7CXF yeuFhA9MdbQSnHRorUpkDBZHIl6UvzhYe3wRS1JFc3Ncl+mBa/eDLUQAnmwtpvslXLpk bD+Q== 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 d10si4834504edb.226.2019.11.14.09.43.47; Thu, 14 Nov 2019 09:44:12 -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 S1727032AbfKNRmk (ORCPT + 99 others); Thu, 14 Nov 2019 12:42:40 -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(-) 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; -- 2.17.1