Message ID | 20230514152739.962109-11-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6380706vqo; Sun, 14 May 2023 08:59:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44TXD0okoN5szTp600s1CjjzI7JVQUOdaqFKxzwHGcxKf/xV0/FEDfUclSOwDDOKwQ0gyF X-Received: by 2002:a17:90a:e645:b0:24e:3409:6112 with SMTP id ep5-20020a17090ae64500b0024e34096112mr32101690pjb.32.1684079973403; Sun, 14 May 2023 08:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684079973; cv=none; d=google.com; s=arc-20160816; b=XDTA3+6cuLAsusMwBSjH7U1kAatCroC5zfgWa1piCxUFdHr1amxgTBeMlflHJBHPTZ GYi3EpfKKls0Rlr0yVfClolaM4TjtN+wFYkKEvihtfgk0fD0ZQt/qlGqoitFvRDXvLsO jm1cosIWWYoBNvWB8Uvc42WkOz97ZujrekD4xI6yXcy0oVD6AzwuE6KdCikF+j/HfLxl R7imxH3jed4xLifhNe61kDniop2wAPJPF35c73ii3voJgi/G13BzyqIG/y9E0EIAGaxb 5T44mGWNuezLJBgBdcwFsJtHc/C0ovRPZu6z/+n3wMv2oP+hO299Vqn37ztFhVcyDSai h4rg== 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=d3z8MJf6di8vmBSGY88ZLtGgEgYNjCAA2dSbOxdxTaA=; b=SCm1hiUzZt1oE7fTUbPLzprfWgZRpwTdCfWmvOnbazk/NRPDc5R/hUeLw0irYZxHCs vP73r6iWiF0GYlwpoH+O0sq/Q4ASr1fFpc1hz22V0i3AjdXFq0YcuPEgTqjKYMB7A9TX Vz07Nq2NTk1yleURSUkQ6r/Zvce+1UpUgbG+Zi1ga/7ERtGuGQmef8m+XGjO3fZJVrom hJq1VHaxLOznP4sjM4QG0TqFPg5RWqlXFM6TdOUM+Qws/F9lB2j7yxc7kBLvnGiG1nqk sNdSjDuGwVBffiZ7STOkTif03x8twETvNxIHBYLYCSiUqyKrZ7PNl1CkvAqtu6+QpvxY Rwbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Kev9/qXT"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a17090a8d1400b0024df69fdff6si27527242pjo.168.2023.05.14.08.59.15; Sun, 14 May 2023 08:59:33 -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="Kev9/qXT"; 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 S238015AbjENP3J (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Sun, 14 May 2023 11:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237898AbjENP2o (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 14 May 2023 11:28:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9C4426BB; Sun, 14 May 2023 08:28:19 -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 21193617ED; Sun, 14 May 2023 15:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D070BC433A0; Sun, 14 May 2023 15:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684078088; bh=8ZBP8uGhdn6vymdReCFLqoFR/6d0pI8J40+zPKwqxLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kev9/qXTSyKaeSlY42WQz9vaY+u7B6/qITizsJc1S12FQ8OmG2JxdmXpIJ6DkA8eC TM4willLy7IYQGrRi6sNIDL9zL4cXbmJcn9J2iPj+EnVc95ru6iBcNpLLlKhTGh2uQ UtzZn5Q+Lr6LzP8WcYAVyGglC4un8IZHjngPPVU//yQ5k9WAcAR5VVXham6TKHhejQ u4ih9digWpY2dYt2H2pWkqDmW3+W7HqTtEZXAxJ0cz6rWjzEYUiAJqMLPW/RmE1IXO cS/6kLsTLnwQyg/HVkfmv6iT5HmT2IJO0I+lamUcQe6oCD4KI2IY9XPnPnne36eBuD 79h5tSbzIB6Wg== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Pitre <npitre@baylibre.com>, Nicolas Schier <nicolas@fjasle.eu>, Masahiro Yamada <masahiroy@kernel.org> Subject: [PATCH v5 10/21] modpost: rename find_elf_symbol() and find_elf_symbol2() Date: Mon, 15 May 2023 00:27:28 +0900 Message-Id: <20230514152739.962109-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230514152739.962109-1-masahiroy@kernel.org> References: <20230514152739.962109-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765885842664862930?= X-GMAIL-MSGID: =?utf-8?q?1765885842664862930?= |
Series |
Unify <linux/export.h> and <asm/export.h>, remove EXPORT_DATA_SYMBOL(), faster TRIM_UNUSED_KSYMS
|
|
Commit Message
Masahiro Yamada
May 14, 2023, 3:27 p.m. UTC
find_elf_symbol() and find_elf_symbol2() are not good names.
Rename them to find_tosym(), find_fromsym(), respectively.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Changes in v5:
- Change the names
scripts/mod/modpost.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Comments
On Sun, May 14, 2023 at 8:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > find_elf_symbol() and find_elf_symbol2() are not good names. > > Rename them to find_tosym(), find_fromsym(), respectively. The comments maybe could be updated, too. The end of the comment looks wrong for both. Thanks for the patch! Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > Changes in v5: > - Change the names > > scripts/mod/modpost.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 3b7b78e69137..0d2c2aff2c03 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -1124,8 +1124,8 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) > * In other cases the symbol needs to be looked up in the symbol table > * based on section and address. > * **/ > -static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > - Elf_Sym *relsym) > +static Elf_Sym *find_tosym(struct elf_info *elf, Elf64_Sword addr, > + Elf_Sym *relsym) > { > Elf_Sym *sym; > Elf_Sym *near = NULL; > @@ -1168,8 +1168,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > * The ELF format may have a better way to detect what type of symbol > * it is, but this works for now. > **/ > -static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, > - unsigned int secndx) > +static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, > + unsigned int secndx) > { > Elf_Sym *sym; > Elf_Sym *near = NULL; > @@ -1207,10 +1207,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, > const char *tosym; > const char *fromsym; > > - from = find_elf_symbol2(elf, r->r_offset, fsecndx); > + from = find_fromsym(elf, r->r_offset, fsecndx); > fromsym = sym_name(elf, from); > > - to = find_elf_symbol(elf, r->r_addend, sym); > + to = find_tosym(elf, r->r_addend, sym); > tosym = sym_name(elf, to); > > /* check whitelist - we may ignore it */ > -- > 2.39.2 >
On Thu, May 18, 2023 at 6:14 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Sun, May 14, 2023 at 8:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > find_elf_symbol() and find_elf_symbol2() are not good names. > > > > Rename them to find_tosym(), find_fromsym(), respectively. > > The comments maybe could be updated, too. The end of the comment looks > wrong for both. What do you mean? Please tell me which part should be changed, and how. > Thanks for the patch! > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > --- > > > > Changes in v5: > > - Change the names > > > > scripts/mod/modpost.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > index 3b7b78e69137..0d2c2aff2c03 100644 > > --- a/scripts/mod/modpost.c > > +++ b/scripts/mod/modpost.c > > @@ -1124,8 +1124,8 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) > > * In other cases the symbol needs to be looked up in the symbol table > > * based on section and address. > > * **/ > > -static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > > - Elf_Sym *relsym) > > +static Elf_Sym *find_tosym(struct elf_info *elf, Elf64_Sword addr, > > + Elf_Sym *relsym) > > { > > Elf_Sym *sym; > > Elf_Sym *near = NULL; > > @@ -1168,8 +1168,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > > * The ELF format may have a better way to detect what type of symbol > > * it is, but this works for now. > > **/ > > -static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, > > - unsigned int secndx) > > +static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, > > + unsigned int secndx) > > { > > Elf_Sym *sym; > > Elf_Sym *near = NULL; > > @@ -1207,10 +1207,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, > > const char *tosym; > > const char *fromsym; > > > > - from = find_elf_symbol2(elf, r->r_offset, fsecndx); > > + from = find_fromsym(elf, r->r_offset, fsecndx); > > fromsym = sym_name(elf, from); > > > > - to = find_elf_symbol(elf, r->r_addend, sym); > > + to = find_tosym(elf, r->r_addend, sym); > > tosym = sym_name(elf, to); > > > > /* check whitelist - we may ignore it */ > > -- > > 2.39.2 > > > > > -- > Thanks, > ~Nick Desaulniers
On Sat, May 20, 2023 at 6:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Thu, May 18, 2023 at 6:14 AM Nick Desaulniers > <ndesaulniers@google.com> wrote: > > > > On Sun, May 14, 2023 at 8:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > find_elf_symbol() and find_elf_symbol2() are not good names. > > > > > > Rename them to find_tosym(), find_fromsym(), respectively. > > > > The comments maybe could be updated, too. The end of the comment looks > > wrong for both. > > > What do you mean? > > Please tell me which part should be changed, and how. Attached the comment style changes. I didn't have precise wording in mind for the comments; I was suggesting to see if the comments could be updated to clarify what the functions are doing. > > > > > > > > Thanks for the patch! > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > > > > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > > --- > > > > > > Changes in v5: > > > - Change the names > > > > > > scripts/mod/modpost.c | 12 ++++++------ > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > > index 3b7b78e69137..0d2c2aff2c03 100644 > > > --- a/scripts/mod/modpost.c > > > +++ b/scripts/mod/modpost.c > > > @@ -1124,8 +1124,8 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) > > > * In other cases the symbol needs to be looked up in the symbol table > > > * based on section and address. > > > * **/ > > > -static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > > > - Elf_Sym *relsym) > > > +static Elf_Sym *find_tosym(struct elf_info *elf, Elf64_Sword addr, > > > + Elf_Sym *relsym) > > > { > > > Elf_Sym *sym; > > > Elf_Sym *near = NULL; > > > @@ -1168,8 +1168,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, > > > * The ELF format may have a better way to detect what type of symbol > > > * it is, but this works for now. > > > **/ > > > -static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, > > > - unsigned int secndx) > > > +static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, > > > + unsigned int secndx) > > > { > > > Elf_Sym *sym; > > > Elf_Sym *near = NULL; > > > @@ -1207,10 +1207,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, > > > const char *tosym; > > > const char *fromsym; > > > > > > - from = find_elf_symbol2(elf, r->r_offset, fsecndx); > > > + from = find_fromsym(elf, r->r_offset, fsecndx); > > > fromsym = sym_name(elf, from); > > > > > > - to = find_elf_symbol(elf, r->r_addend, sym); > > > + to = find_tosym(elf, r->r_addend, sym); > > > tosym = sym_name(elf, to); > > > > > > /* check whitelist - we may ignore it */ > > > -- > > > 2.39.2 > > > > > > > > > -- > > Thanks, > > ~Nick Desaulniers > > > > -- > Best Regards > Masahiro Yamada
On Tue, May 23, 2023 at 1:59 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Sat, May 20, 2023 at 6:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > On Thu, May 18, 2023 at 6:14 AM Nick Desaulniers > > <ndesaulniers@google.com> wrote: > > > > > > On Sun, May 14, 2023 at 8:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > > > find_elf_symbol() and find_elf_symbol2() are not good names. > > > > > > > > Rename them to find_tosym(), find_fromsym(), respectively. > > > > > > The comments maybe could be updated, too. The end of the comment looks > > > wrong for both. > > > > > > What do you mean? > > > > Please tell me which part should be changed, and how. > > Attached the comment style changes. I didn't have precise wording in > mind for the comments; I was suggesting to see if the comments could > be updated to clarify what the functions are doing. Ah, I understood what you meant. I think some parts of the comments are stale. Anyway, these comment blocks will be removed by a later commit. https://patchwork.kernel.org/project/linux-kbuild/patch/20230521160426.1881124-6-masahiroy@kernel.org/
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3b7b78e69137..0d2c2aff2c03 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1124,8 +1124,8 @@ static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) * In other cases the symbol needs to be looked up in the symbol table * based on section and address. * **/ -static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, - Elf_Sym *relsym) +static Elf_Sym *find_tosym(struct elf_info *elf, Elf64_Sword addr, + Elf_Sym *relsym) { Elf_Sym *sym; Elf_Sym *near = NULL; @@ -1168,8 +1168,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, * The ELF format may have a better way to detect what type of symbol * it is, but this works for now. **/ -static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, - unsigned int secndx) +static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, + unsigned int secndx) { Elf_Sym *sym; Elf_Sym *near = NULL; @@ -1207,10 +1207,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, const char *tosym; const char *fromsym; - from = find_elf_symbol2(elf, r->r_offset, fsecndx); + from = find_fromsym(elf, r->r_offset, fsecndx); fromsym = sym_name(elf, from); - to = find_elf_symbol(elf, r->r_addend, sym); + to = find_tosym(elf, r->r_addend, sym); tosym = sym_name(elf, to); /* check whitelist - we may ignore it */