From patchwork Sun Jun 11 15:50:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1793584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=nEdUtNBp; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Kanvkj7v; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QfK712NCSz20Vx for ; Mon, 12 Jun 2023 01:51:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XOIiy79zjjYXMXPhiA0csXT8R8y3uDSmoa63OyglrnU=; b=nEdUtNBpoAhuZs AOMQcg0LX+vQ7LEawOGyeqyGlSaPiMRXCLR6jNWhdSn/sn8UU3zMWMW6TBqhK/K2sc+1stAh7iIAr XH374pmbwHwmWhc3av7o9U8NNK8OTdu0QzCbXNCOUbuOl3MEAaMfTM3K85k1yq4GenhM6E4YL15UU eit7Jsv9ngndotq7HG7P3ERdlKTWLmCZNhYIRO7RjYVw3kqRJF8tdHhCuuZmhVwwxOhUA+jGW6DSS hPjIXHv/LV8qKPALsGHr9RI5mylLbleYelBCGBytYqQpajJZVeGqT5zL5CGbCjgaj2IUHx1yCqmf8 1kaVfHa9pUDj0JObbgRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8NLf-001GQs-1N; Sun, 11 Jun 2023 15:51:23 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8NLc-001GOx-1s for linux-snps-arc@lists.infradead.org; Sun, 11 Jun 2023 15:51:21 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 112C361CAE; Sun, 11 Jun 2023 15:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E852C4339E; Sun, 11 Jun 2023 15:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686498679; bh=VKxHtXFVlcWySintpspJtZKTq9sWsgdCdx/RGyDBDos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kanvkj7vc+JNf9L9dC/ml1Ei1imjS+iSRoPVPi3XaubAJZJPZQQ59FLNWawZHz7lU boBH/4xl0ydm+lO27FUbJv/6dFR25K4dEk8atubEvp4+3zR7EDb3GJSEoSLfdxq6mO uaL4Z1ZRnC0d4k+Wj4s2rspD03XMA3B+VvPPjQQI2E5WQ3QH0jjBH4wV4/fLbMRXFj 19nFH9d3j/BG/s5HDKE6zwW4ICPM4oN7UXMLgkp7HgO+DZiZjb08/6az2CFuXvLua3 oXxd7SwYWswZYcZNEVbNK03/WR6UC0XFRHscO+rqVNVOsqYd4ppgjk+mMMKFWJYyTt IN97rVMOevhdQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , linux-snps-arc@lists.infradead.org, Masahiro Yamada Subject: [PATCH v9 06/11] modpost: squash sym_update_namespace() into sym_add_exported() Date: Mon, 12 Jun 2023 00:50:55 +0900 Message-Id: <20230611155100.2553804-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230611155100.2553804-1-masahiroy@kernel.org> References: <20230611155100.2553804-1-masahiroy@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230611_085120_655169_5C41BD90 X-CRM114-Status: GOOD ( 13.06 ) X-Spam-Score: -5.4 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Pass a set of the name, license, and namespace to sym_add_exported(). sym_update_namespace() is unneeded. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [139.178.84.217 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Pass a set of the name, license, and namespace to sym_add_exported(). sym_update_namespace() is unneeded. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/mod/modpost.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 10da82ad5874..79ad0a346a5c 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -355,26 +355,8 @@ static const char *sec_name(const struct elf_info *info, unsigned int secindex) #define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0) -static void sym_update_namespace(const char *symname, const char *namespace) -{ - struct symbol *s = find_symbol(symname); - - /* - * That symbol should have been created earlier and thus this is - * actually an assertion. - */ - if (!s) { - error("Could not update namespace(%s) for symbol %s\n", - namespace, symname); - return; - } - - free(s->namespace); - s->namespace = namespace[0] ? NOFAIL(strdup(namespace)) : NULL; -} - static struct symbol *sym_add_exported(const char *name, struct module *mod, - bool gpl_only) + bool gpl_only, const char *namespace) { struct symbol *s = find_symbol(name); @@ -387,6 +369,7 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod, s = alloc_symbol(name); s->module = mod; s->is_gpl_only = gpl_only; + s->namespace = namespace[0] ? NOFAIL(strdup(namespace)) : NULL; list_add_tail(&s->list, &mod->exported_symbols); hash_add_symbol(s); @@ -1236,8 +1219,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf, } data += strlen(data) + 1; /* namespace */ - s = sym_add_exported(name, mod, is_gpl); - sym_update_namespace(name, data); + s = sym_add_exported(name, mod, is_gpl, data); /* * We need to be aware whether we are exporting a function or @@ -2180,9 +2162,8 @@ static void read_dump(const char *fname) mod = new_module(modname, strlen(modname)); mod->from_dump = true; } - s = sym_add_exported(symname, mod, gpl_only); + s = sym_add_exported(symname, mod, gpl_only, namespace); sym_set_crc(s, crc); - sym_update_namespace(symname, namespace); } free(buf); return;