LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
@ 2021-08-14 23:41 Masahiro Yamada
  2021-08-15  1:15 ` Nathan Chancellor
  2021-08-15  3:37 ` Nicolas Pitre
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2021-08-14 23:41 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Masahiro Yamada, Nathan Chancellor,
	Nick Desaulniers, Nicolas Pitre, clang-built-linux

When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:

  nm: arch/x86/entry/vdso/vdso32/note.o: no symbols

$NM (both GNU nm and llvm-nm) warns when no symbol is found in the
object. Suppress the stderr.

Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/gen_ksymdeps.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh
index 1324986e1362..5493124e8ee6 100755
--- a/scripts/gen_ksymdeps.sh
+++ b/scripts/gen_ksymdeps.sh
@@ -4,7 +4,10 @@
 set -e
 
 # List of exported symbols
-ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
+#
+# If the object has no symbol, $NM warns 'no symbols'.
+# Suppress the stdout.
+ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
 
 if [ -z "$ksyms" ]; then
 	exit 0
-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
  2021-08-14 23:41 [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y Masahiro Yamada
@ 2021-08-15  1:15 ` Nathan Chancellor
  2021-08-15  3:18   ` Fāng-ruì Sòng
  2021-08-15  3:37 ` Nicolas Pitre
  1 sibling, 1 reply; 6+ messages in thread
From: Nathan Chancellor @ 2021-08-15  1:15 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild
  Cc: linux-kernel, Nick Desaulniers, Nicolas Pitre, clang-built-linux

On 8/14/2021 4:41 PM, Masahiro Yamada wrote:
> When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:
> 
>    nm: arch/x86/entry/vdso/vdso32/note.o: no symbols
> 
> $NM (both GNU nm and llvm-nm) warns when no symbol is found in the
> object. Suppress the stderr.
> 
> Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>   scripts/gen_ksymdeps.sh | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh
> index 1324986e1362..5493124e8ee6 100755
> --- a/scripts/gen_ksymdeps.sh
> +++ b/scripts/gen_ksymdeps.sh
> @@ -4,7 +4,10 @@
>   set -e
>   
>   # List of exported symbols
> -ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
> +#
> +# If the object has no symbol, $NM warns 'no symbols'.
> +# Suppress the stdout.
> +ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
>   
>   if [ -z "$ksyms" ]; then
>   	exit 0
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
  2021-08-15  1:15 ` Nathan Chancellor
@ 2021-08-15  3:18   ` Fāng-ruì Sòng
  2021-08-18  4:28     ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Fāng-ruì Sòng @ 2021-08-15  3:18 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Nathan Chancellor, linux-kernel, Nick Desaulniers,
	Nicolas Pitre, clang-built-linux

On Sat, Aug 14, 2021 at 6:15 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On 8/14/2021 4:41 PM, Masahiro Yamada wrote:
> > When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:
> >
> >    nm: arch/x86/entry/vdso/vdso32/note.o: no symbols
> >
> > $NM (both GNU nm and llvm-nm) warns when no symbol is found in the
> > object. Suppress the stderr.
> >
> > Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

LGTM.

FWIW binutils>=2.37 `nm -q` can be used to suppress "no symbols"
https://sourceware.org/bugzilla/show_bug.cgi?id=27408

llvm-nm>=13.0.0 supports -q as well.

> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> > ---
> >
> >   scripts/gen_ksymdeps.sh | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh
> > index 1324986e1362..5493124e8ee6 100755
> > --- a/scripts/gen_ksymdeps.sh
> > +++ b/scripts/gen_ksymdeps.sh
> > @@ -4,7 +4,10 @@
> >   set -e
> >
> >   # List of exported symbols
> > -ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
> > +#
> > +# If the object has no symbol, $NM warns 'no symbols'.
> > +# Suppress the stdout.
> > +ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
> >
> >   if [ -z "$ksyms" ]; then
> >       exit 0
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/3afe5054-8129-fe42-b5a4-00bd091b1a0c%40kernel.org.



-- 
宋方睿

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
  2021-08-14 23:41 [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y Masahiro Yamada
  2021-08-15  1:15 ` Nathan Chancellor
@ 2021-08-15  3:37 ` Nicolas Pitre
  2021-08-18  4:28   ` Masahiro Yamada
  1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Pitre @ 2021-08-15  3:37 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-kernel, Nathan Chancellor, Nick Desaulniers,
	clang-built-linux

On Sun, 15 Aug 2021, Masahiro Yamada wrote:

> When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:
> 
>   nm: arch/x86/entry/vdso/vdso32/note.o: no symbols
> 
> $NM (both GNU nm and llvm-nm) warns when no symbol is found in the
> object. Suppress the stderr.
> 
> Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/gen_ksymdeps.sh | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh
> index 1324986e1362..5493124e8ee6 100755
> --- a/scripts/gen_ksymdeps.sh
> +++ b/scripts/gen_ksymdeps.sh
> @@ -4,7 +4,10 @@
>  set -e
>  
>  # List of exported symbols
> -ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
> +#
> +# If the object has no symbol, $NM warns 'no symbols'.
> +# Suppress the stdout.
> +ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)

You mean stderr.


Nicolas



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
  2021-08-15  3:18   ` Fāng-ruì Sòng
@ 2021-08-18  4:28     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2021-08-18  4:28 UTC (permalink / raw)
  To: Fāng-ruì Sòng
  Cc: Linux Kbuild mailing list, Nathan Chancellor,
	Linux Kernel Mailing List, Nick Desaulniers, Nicolas Pitre,
	clang-built-linux

On Sun, Aug 15, 2021 at 12:18 PM Fāng-ruì Sòng <maskray@google.com> wrote:
>
> On Sat, Aug 14, 2021 at 6:15 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > On 8/14/2021 4:41 PM, Masahiro Yamada wrote:
> > > When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:
> > >
> > >    nm: arch/x86/entry/vdso/vdso32/note.o: no symbols
> > >
> > > $NM (both GNU nm and llvm-nm) warns when no symbol is found in the
> > > object. Suppress the stderr.
> > >
> > > Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> LGTM.
>
> FWIW binutils>=2.37 `nm -q` can be used to suppress "no symbols"
> https://sourceware.org/bugzilla/show_bug.cgi?id=27408
>
> llvm-nm>=13.0.0 supports -q as well.


Thanks for the info.
Perhaps, I can note the future migration to -q
in a comment.






-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
  2021-08-15  3:37 ` Nicolas Pitre
@ 2021-08-18  4:28   ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2021-08-18  4:28 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Linux Kbuild mailing list, Linux Kernel Mailing List,
	Nathan Chancellor, Nick Desaulniers, clang-built-linux

On Sun, Aug 15, 2021 at 12:37 PM Nicolas Pitre <nico@fluxnic.net> wrote:
>
> On Sun, 15 Aug 2021, Masahiro Yamada wrote:
>
> > When CONFIG_TRIM_UNUSED_KSYMS is enabled, I see some warnings like this:
> >
> >   nm: arch/x86/entry/vdso/vdso32/note.o: no symbols
> >
> > $NM (both GNU nm and llvm-nm) warns when no symbol is found in the
> > object. Suppress the stderr.
> >
> > Fixes: bbda5ec671d3 ("kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS")
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  scripts/gen_ksymdeps.sh | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/gen_ksymdeps.sh b/scripts/gen_ksymdeps.sh
> > index 1324986e1362..5493124e8ee6 100755
> > --- a/scripts/gen_ksymdeps.sh
> > +++ b/scripts/gen_ksymdeps.sh
> > @@ -4,7 +4,10 @@
> >  set -e
> >
> >  # List of exported symbols
> > -ksyms=$($NM $1 | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
> > +#
> > +# If the object has no symbol, $NM warns 'no symbols'.
> > +# Suppress the stdout.
> > +ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p' | tr A-Z a-z)
>
> You mean stderr.


My bad - I will fix it in v2.
Thanks.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-18  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14 23:41 [PATCH] kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y Masahiro Yamada
2021-08-15  1:15 ` Nathan Chancellor
2021-08-15  3:18   ` Fāng-ruì Sòng
2021-08-18  4:28     ` Masahiro Yamada
2021-08-15  3:37 ` Nicolas Pitre
2021-08-18  4:28   ` Masahiro Yamada

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).