Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1996114rwd; Sun, 21 May 2023 10:27:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RgohrxSxEf/AHK9rB9ZCPMlEUQKO8QGVO1D46abp6nXtInKHh3Uu2KYKTFPYnzfpsyyAI X-Received: by 2002:a05:6a20:144e:b0:10b:97c8:2e16 with SMTP id a14-20020a056a20144e00b0010b97c82e16mr1145498pzi.29.1684690077836; Sun, 21 May 2023 10:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684690077; cv=none; d=google.com; s=arc-20160816; b=gJwCbhDJ2iyPrQyozDwelMBce9Ip6oNojcTDbvhlWLvujEgbSLLzHzmW4ikbI87siD d0rn0D5HKBaKfQabCJZlEoOFA4yNGY9MulkcwLLdbD4ZulI1p2ivpH9/+mo6TJQWs4Ey LCA2zi38m1NWH/5kP6F/5Ja1iQjWPoHtF+Hf76jsI2c3iuP9LW/qjwF4AoMSOxtML9sZ GMdgQKeE6Lko25bPp/xeg6DIUizeSDeaL9b5pMIO/aPLUzV4iw/Jv5sS4bcBZZy5uhOv IIcL1tSJ7uXh6h9NKfPE9kJnUgQ5b6Z+GaZgcKVFQPVOQ+SdkH8FPO/38jFSFxfzg9NG bc3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ScNKVUu/0PWyCim83i6T3/3ADPcLOReootUWzYrhYTA=; b=Ldb2trWsk+FNRh8IOxBCCxhhTN7Z+U27WCwZDKKj5+Ljhi+LdX1cPTkpSTa8HuN0GM ql6+kmGL+DfGbMayMoUxzwFwcCVZAFmJAJeWBhjdkNqfOaXen4wBpi/W5PF+036gTwYN zwfuHgFj2D0S3ibYozZmrgDtuUiTxcgb0eqL2b77P/FZNYiJ6gDdnD4K3tfxmqNOufqq jlKZLe9PHYNKPFHceHl3Z7cy2UMfhErSeNBNYklIqiwDoADt57Z2EFsMsLnUCi2fZwFf n4lJ9hchu+TJa7yXVp80avnoRjxqEwyCpIAiBAtSg/m404a6p3P5AyuNnDFENzhnSRR6 SefA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ICceVZTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w186-20020a6382c3000000b005348a306abcsi3214286pgd.755.2023.05.21.10.18.57; Sun, 21 May 2023 10:27:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ICceVZTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230414AbjEUQGd (ORCPT + 99 others); Sun, 21 May 2023 12:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjEUQGI (ORCPT ); Sun, 21 May 2023 12:06:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20248118; Sun, 21 May 2023 09:05:45 -0700 (PDT) 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 C0F7E60FAC; Sun, 21 May 2023 16:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1D51C433EF; Sun, 21 May 2023 16:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684685138; bh=Irn8s+5UgFMeFebwkxke8zqHLikSaF4AyAgWT+2aYBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICceVZTSu3z1ir8GvjVJApiD7PzYwHGmFkdrP3xw09UR2BaYM/a7LEpWIbLe77eJu CWePIZBTSUFLEftBlphUFf0dM+h4pVQwgxQB8fKjva4Z01zyFcJmfVzbVv9Hni2LrN JSBRR6cAgbEawSyRab65dt05G4F/Y1L/uPldOeo6PIeJQ7BhsSldm1U/JPmdg06J6k xUImyjm7tmBjAAydWlh/gwCtW0Y7l/9R1/JMjjFC+jda/UVdaOoNwAybEslC3+y8O9 rahLv5afZUy2nIJ8DoYolXGrJBvskFiPdBCTUcvgZZFEwRyVSZlNJy68PByKwPpCJ2 7et/6ExVxDJmg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Masahiro Yamada Subject: [PATCH v6 13/20] modpost: squash sym_update_namespace() into sym_add_exported() Date: Mon, 22 May 2023 01:04:18 +0900 Message-Id: <20230521160426.1881124-14-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230521160426.1881124-1-masahiroy@kernel.org> References: <20230521160426.1881124-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pass a set of the name, license, and namespace to sym_add_exported(). sym_update_namespace() is unneeded. Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada --- 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 dd1d066f1214..8fe2aa7bf71b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -353,26 +353,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); @@ -385,6 +367,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); @@ -1248,8 +1231,7 @@ static void check_export_symbol(struct module *mod, struct elf_info *elf, return; } - s = sym_add_exported(name, mod, is_gpl); - sym_update_namespace(name, sym_get_data(elf, label)); + s = sym_add_exported(name, mod, is_gpl, sym_get_data(elf, label)); /* * We need to be aware whether we are exporting a function or @@ -2126,9 +2108,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; -- 2.39.2