linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhen Lei <thunder.leizhen@huawei.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>
Subject: Re: [PATCH 3/8] scripts/mksysmap: use sed with in-line comments
Date: Fri, 7 Apr 2023 11:59:44 -0700	[thread overview]
Message-ID: <CAKwvOdnmiL_wDgzepYb+ZGgWt2xnsp48-awn0Cd0c4RDR43t_Q@mail.gmail.com> (raw)
In-Reply-To: <20230308115243.82592-3-masahiroy@kernel.org>

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
>


-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2023-04-07 19:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 11:52 [PATCH 1/8] scripts/kallsyms: remove redundant code for omitting U and N Masahiro Yamada
2023-03-08 11:52 ` [PATCH 2/8] scripts/mksysmap: remove comments described in nm(1) Masahiro Yamada
2023-04-07 18:46   ` Nick Desaulniers
2023-04-10  9:38     ` Masahiro Yamada
2023-03-08 11:52 ` [PATCH 3/8] scripts/mksysmap: use sed with in-line comments Masahiro Yamada
2023-04-07 18:59   ` Nick Desaulniers [this message]
2023-04-07 19:01     ` Nick Desaulniers
2023-04-08 15:01       ` Masahiro Yamada
2023-04-08 14:29     ` Masahiro Yamada
2023-04-10  9:38       ` Masahiro Yamada
2023-03-08 11:52 ` [PATCH 4/8] scripts/kallsyms: exclude symbols generated by itself dynamically Masahiro Yamada
2023-04-07 20:12   ` Nick Desaulniers
2023-04-10  9:38     ` Masahiro Yamada
2023-03-08 11:52 ` [PATCH 5/8] scripts/kallsyms: move compiler-generated symbol patterns to mksysmap Masahiro Yamada
2023-04-07 20:16   ` Nick Desaulniers
2023-03-08 11:52 ` [PATCH 6/8] scripts/kallsyms: change the output order Masahiro Yamada
2023-03-08 11:52 ` [PATCH 7/8] scripts/kallsyms: decrease expand_symbol() / cleanup_symbol_name() calls Masahiro Yamada
2023-03-08 11:52 ` [PATCH 8/8] scripts/kallsyms: update the usage in the comment block Masahiro Yamada
2023-04-07 20:25   ` Nick Desaulniers
2023-04-07 18:53 ` [PATCH 1/8] scripts/kallsyms: remove redundant code for omitting U and N Nick Desaulniers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdnmiL_wDgzepYb+ZGgWt2xnsp48-awn0Cd0c4RDR43t_Q@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=arnd@arndb.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=thunder.leizhen@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).