Message ID | 20230308115243.82592-3-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp297596wrd; Wed, 8 Mar 2023 04:20:41 -0800 (PST) X-Google-Smtp-Source: AK7set/zBAp7DmfIkbI2ZA5OklRCBxB9xvqcgpY+X+IpCRtKhAGcv0cooBpBx+gZj5w0AokT+8+B X-Received: by 2002:a05:6a20:66a4:b0:bc:8b91:69a3 with SMTP id o36-20020a056a2066a400b000bc8b9169a3mr15001685pzh.46.1678278041497; Wed, 08 Mar 2023 04:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678278041; cv=none; d=google.com; s=arc-20160816; b=ZOl3sVXw4E4GOYOfhHh0IISql/AkDMhZ86ffRUCD4TVkgOIwJOkd35bsLG+0TcDVJA Wy9L1NR9iiubnVHnIuMHPnSEzjuJphLFzuO8d/+K0Rcvo56qlRz/qkVwwn1ZOhVPAWPF 8UkB7X0MdpQxe1MQ9baik1jtvOLwKY8QE5H30gwxwmyq5XXOxQfZYEiPh1aqN1djodHS VV87xdESuF94mwYDhi0Fja6yesme+JFB0YF3KT0wi15sF9WfntlCRy01mrLt+tEbYhP8 IMpDPPiBjr42Z2rNBMl402GT+TpwW9ynk5VnG0Iigy8wjX1F9zLLldCq42g9zdf9YmIN r1Fg== 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=PKZKp4CyHRaJotl76z/reysfB7rCzDaugwqqtEsPN5M=; b=tMhJ6F31YJ0nNjPZgga2yI0IigrOQYGHJsrPft2yzoEQ0UGW1bxAxpyigzteNtjhxc F958TLKPRGTt58L/fa1d0rbMJ0Kkuai8oIfWcAn3TrDcV4Fcjvb297Zp1/tyCH4JcqAy Zrpkn7yV7BgKVH0MrVYZJs4tGf19WCGz29Zsc59vImCZbYJv2jY9LNonHScy02WCC5ar lPgF88JOZ57TpuJzcrnFYs3eNJKnZpMVi2DpH0bJKgOKaaKKibULuZw+FmoQQsdxJmg5 zKc4iU81Wi/Yc/q3QyouACThm0vtOXgyOmi091vEURSg8Ug1rzc5IyM8Co/1taRlmojE dGjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pgJsNJ9N; 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 184-20020a6300c1000000b00502d7cd012csi14775996pga.378.2023.03.08.04.20.28; Wed, 08 Mar 2023 04:20:41 -0800 (PST) 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=pgJsNJ9N; 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 S230379AbjCHLxH (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 8 Mar 2023 06:53:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjCHLxC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Mar 2023 06:53:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC419ED7; Wed, 8 Mar 2023 03:52:59 -0800 (PST) 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 819206176B; Wed, 8 Mar 2023 11:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F03BC4339E; Wed, 8 Mar 2023 11:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276378; bh=DuoivBb2Ni55n4AFx8endkrW+/Kl+HHtMvz18aW6xeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pgJsNJ9NGSDlsj5g3Jb9yWN/CmyktGdnhQLccuksOSSvVLHuF/Q9OmsQgSPK/9ZWa G5zOdxaSw4exdJAs4NaMs14+e40IZqK7M70W3Bu+peo7HGqVzCLZQh7mngJVHa0bYO 2opFAp188IG94eJEzEzASwVaEDkf090H1QcIrskjSF88xTcRmyaKpJWDm28SrAjm3Y 8OncH3KIp6MIOZ9/JQa23fWX9oYJEA4WrchQnO+CympTiPdsTEiNe4jtS22CBUHEce Xw0tH+/ZemKrJIkxKOQeYaEe+n9G5RF/L8ZRIalcgnOCZqUv2iVc+e/5cppw8meEDK garFmig1nkMtA== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei <thunder.leizhen@huawei.com>, Arnd Bergmann <arnd@arndb.de>, Masahiro Yamada <masahiroy@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu> Subject: [PATCH 3/8] scripts/mksysmap: use sed with in-line comments Date: Wed, 8 Mar 2023 20:52:38 +0900 Message-Id: <20230308115243.82592-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-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,URIBL_BLOCKED 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?1759802075251514212?= X-GMAIL-MSGID: =?utf-8?q?1759802075251514212?= |
Series |
[1/8] scripts/kallsyms: remove redundant code for omitting U and N
|
|
Commit Message
Masahiro Yamada
March 8, 2023, 11:52 a.m. UTC
Move comments close to the code.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/mksysmap | 61 +++++++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 24 deletions(-)
Comments
On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > Move comments close to the code. Consider adding to the commit message why you switch from grep to sed; that's currently unclear. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Orthogonal to this patch, don't .L prefixed local symbols not have entries in the symbol table? If they're not printed with nm, why filter them out (since they're impossible). > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > scripts/mksysmap | 61 +++++++++++++++++++++++++++++------------------- > 1 file changed, 37 insertions(+), 24 deletions(-) > > diff --git a/scripts/mksysmap b/scripts/mksysmap > index 697fc6653953..8ea1955e03c6 100755 > --- a/scripts/mksysmap > +++ b/scripts/mksysmap > @@ -10,32 +10,45 @@ > ##### > # Generate System.map (actual filename passed as second argument) > > -# For System.map filter away: > -# a - local absolute symbols > -# U - undefined global symbols > -# N - debugging symbols > -# w - local weak symbols > - > # readprofile starts reading symbols when _stext is found, and > # continue until it finds a symbol which is not either of 'T', 't', > # 'W' or 'w'. > # > -# Ignored prefixes: > -# $ - local symbols for ARM, MIPS, etc. > -# .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. > -# __crc_ - modversions > -# __kstrtab_ - EXPORT_SYMBOL (symbol name) > -# __kstrtabns_ - EXPORT_SYMBOL (namespace) > + > +${NM} -n ${1} | sed >${2} -e " > +# --------------------------------------------------------------------------- > +# Ignored symbol types > # > -# Ignored symbols: > -# L0 - for LoongArch? > - > -$NM -n $1 | grep -v \ > - -e ' [aNUw] ' \ > - -e ' \$' \ > - -e ' \.L' \ > - -e ' __crc_' \ > - -e ' __kstrtab_' \ > - -e ' __kstrtabns_' \ > - -e ' L0$' \ > -> $2 > + > +# a: local absolute symbols > +# N: debugging symbols > +# U: undefined global symbols > +# w: local weak symbols > +/ [aNUw] /d > + > +# --------------------------------------------------------------------------- > +# Ignored prefixes > +# (do not forget a space before each pattern) > + > +# local symbols for ARM, MIPS, etc. > +/ \$/d > + > +# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. > +/ \.L/d > + > +# CRC from modversions > +/ __crc_/d > + > +# EXPORT_SYMBOL (symbol name) > +/ __kstrtab_/d > + > +# EXPORT_SYMBOL (namespace) > +/ __kstrtabns_/d > + > +# --------------------------------------------------------------------------- > +# Ignored symbols (exact match) > +# (do not forget a space before and '$' after each pattern) > + > +# for LoongArch? > +/ L0$/d > +" > -- > 2.34.1 >
On Fri, Apr 7, 2023 at 11:59 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > Move comments close to the code. > > Consider adding to the commit message why you switch from grep to sed; > that's currently unclear. > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Also, perhaps scripts/mksysmap could just be replaced with a sed input-file? Then scripts/link-vmlinux.sh would invoke nm and pipe it into that sed script? > > Orthogonal to this patch, don't .L prefixed local symbols not have > entries in the symbol table? If they're not printed with nm, why > filter them out (since they're impossible). > > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > --- > > > > scripts/mksysmap | 61 +++++++++++++++++++++++++++++------------------- > > 1 file changed, 37 insertions(+), 24 deletions(-) > > > > diff --git a/scripts/mksysmap b/scripts/mksysmap > > index 697fc6653953..8ea1955e03c6 100755 > > --- a/scripts/mksysmap > > +++ b/scripts/mksysmap > > @@ -10,32 +10,45 @@ > > ##### > > # Generate System.map (actual filename passed as second argument) > > > > -# For System.map filter away: > > -# a - local absolute symbols > > -# U - undefined global symbols > > -# N - debugging symbols > > -# w - local weak symbols > > - > > # readprofile starts reading symbols when _stext is found, and > > # continue until it finds a symbol which is not either of 'T', 't', > > # 'W' or 'w'. > > # > > -# Ignored prefixes: > > -# $ - local symbols for ARM, MIPS, etc. > > -# .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. > > -# __crc_ - modversions > > -# __kstrtab_ - EXPORT_SYMBOL (symbol name) > > -# __kstrtabns_ - EXPORT_SYMBOL (namespace) > > + > > +${NM} -n ${1} | sed >${2} -e " > > +# --------------------------------------------------------------------------- > > +# Ignored symbol types > > # > > -# Ignored symbols: > > -# L0 - for LoongArch? > > - > > -$NM -n $1 | grep -v \ > > - -e ' [aNUw] ' \ > > - -e ' \$' \ > > - -e ' \.L' \ > > - -e ' __crc_' \ > > - -e ' __kstrtab_' \ > > - -e ' __kstrtabns_' \ > > - -e ' L0$' \ > > -> $2 > > + > > +# a: local absolute symbols > > +# N: debugging symbols > > +# U: undefined global symbols > > +# w: local weak symbols > > +/ [aNUw] /d > > + > > +# --------------------------------------------------------------------------- > > +# Ignored prefixes > > +# (do not forget a space before each pattern) > > + > > +# local symbols for ARM, MIPS, etc. > > +/ \$/d > > + > > +# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. > > +/ \.L/d > > + > > +# CRC from modversions > > +/ __crc_/d > > + > > +# EXPORT_SYMBOL (symbol name) > > +/ __kstrtab_/d > > + > > +# EXPORT_SYMBOL (namespace) > > +/ __kstrtabns_/d > > + > > +# --------------------------------------------------------------------------- > > +# Ignored symbols (exact match) > > +# (do not forget a space before and '$' after each pattern) > > + > > +# for LoongArch? > > +/ L0$/d > > +" > > -- > > 2.34.1 > > > > > -- > Thanks, > ~Nick Desaulniers
On Sat, Apr 8, 2023 at 4:00 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > Move comments close to the code. > > Consider adding to the commit message why you switch from grep to sed; > that's currently unclear. I just thought "Move comments close to the code" explained my motivation., I want to insert in-line comments. Something like the following. Apparently, it does not work. $NM -n $1 | grep -v \ # comment1 -e ' [aNUw] ' \ # comment2 -e ' \$' \ # comment3 -e ' \.L' \ # comment4 -e ' __crc_' \ # comment5 -e ' __kstrtab_' \ # comment6 -e ' __kstrtabns_' \ # comment7 -e ' L0$' \ > $2 > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > Orthogonal to this patch, don't .L prefixed local symbols not have > entries in the symbol table? If they're not printed with nm, why > filter them out (since they're impossible). Sorry, I could not understand your question, but you may get something from d4c858643263cfde13f7d937eaff95c2ed87cdf1 (you reviewed it)
On Sat, Apr 8, 2023 at 4:01 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Fri, Apr 7, 2023 at 11:59 AM Nick Desaulniers > <ndesaulniers@google.com> wrote: > > > > On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > Move comments close to the code. > > > > Consider adding to the commit message why you switch from grep to sed; > > that's currently unclear. > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > > Also, perhaps scripts/mksysmap could just be replaced with a sed > input-file? Then > scripts/link-vmlinux.sh would invoke nm and pipe it into that sed script? I still need shell. The last line of the next commit 4/8 uses shell code.
On Sat, Apr 8, 2023 at 11:29 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Sat, Apr 8, 2023 at 4:00 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > > > On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > Move comments close to the code. > > > > Consider adding to the commit message why you switch from grep to sed; > > that's currently unclear. > > > > I just thought "Move comments close to the code" > explained my motivation., > > > I want to insert in-line comments. > Something like the following. > Apparently, it does not work. > > > $NM -n $1 | grep -v \ > # comment1 > -e ' [aNUw] ' \ > # comment2 > -e ' \$' \ > # comment3 > -e ' \.L' \ > # comment4 > -e ' __crc_' \ > # comment5 > -e ' __kstrtab_' \ > # comment6 > -e ' __kstrtabns_' \ > # comment7 > -e ' L0$' \ > > $2 > > > Anyway, I will rephase the commit description. """ It is not feasible to insert comments in a multi-line shell command. Use sed, and move comments close to the code. """ -- Best Regards Masahiro Yamada
diff --git a/scripts/mksysmap b/scripts/mksysmap index 697fc6653953..8ea1955e03c6 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -10,32 +10,45 @@ ##### # Generate System.map (actual filename passed as second argument) -# For System.map filter away: -# a - local absolute symbols -# U - undefined global symbols -# N - debugging symbols -# w - local weak symbols - # readprofile starts reading symbols when _stext is found, and # continue until it finds a symbol which is not either of 'T', 't', # 'W' or 'w'. # -# Ignored prefixes: -# $ - local symbols for ARM, MIPS, etc. -# .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. -# __crc_ - modversions -# __kstrtab_ - EXPORT_SYMBOL (symbol name) -# __kstrtabns_ - EXPORT_SYMBOL (namespace) + +${NM} -n ${1} | sed >${2} -e " +# --------------------------------------------------------------------------- +# Ignored symbol types # -# Ignored symbols: -# L0 - for LoongArch? - -$NM -n $1 | grep -v \ - -e ' [aNUw] ' \ - -e ' \$' \ - -e ' \.L' \ - -e ' __crc_' \ - -e ' __kstrtab_' \ - -e ' __kstrtabns_' \ - -e ' L0$' \ -> $2 + +# a: local absolute symbols +# N: debugging symbols +# U: undefined global symbols +# w: local weak symbols +/ [aNUw] /d + +# --------------------------------------------------------------------------- +# Ignored prefixes +# (do not forget a space before each pattern) + +# local symbols for ARM, MIPS, etc. +/ \$/d + +# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. +/ \.L/d + +# CRC from modversions +/ __crc_/d + +# EXPORT_SYMBOL (symbol name) +/ __kstrtab_/d + +# EXPORT_SYMBOL (namespace) +/ __kstrtabns_/d + +# --------------------------------------------------------------------------- +# Ignored symbols (exact match) +# (do not forget a space before and '$' after each pattern) + +# for LoongArch? +/ L0$/d +"