[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnmiL_wDgzepYb+ZGgWt2xnsp48-awn0Cd0c4RDR43t_Q@mail.gmail.com>
Date: Fri, 7 Apr 2023 11:59:44 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Zhen Lei <thunder.leizhen@...wei.com>,
Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Subject: Re: [PATCH 3/8] scripts/mksysmap: use sed with in-line comments
On Wed, Mar 8, 2023 at 3:53 AM Masahiro Yamada <masahiroy@...nel.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@...gle.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@...nel.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
Powered by blists - more mailing lists