netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing
@ 2020-11-18 21:13 Jiri Olsa
  2020-11-19  1:57 ` Andrii Nakryiko
  2020-11-19 17:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Olsa @ 2020-11-18 21:13 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Tony Ambardar, Thadeu Lima de Souza Cascardo, Aurelien Jarno,
	netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh

We remove "other info" from "readelf -s --wide" output when
parsing GLOBAL_SYM_COUNT variable, which was added in [1].
But we don't do that for VERSIONED_SYM_COUNT and it's failing
the check_abi target on powerpc Fedora 33.

The extra "other info" wasn't problem for VERSIONED_SYM_COUNT
parsing until commit [2] added awk in the pipe, which assumes
that the last column is symbol, but it can be "other info".

Adding "other info" removal for VERSIONED_SYM_COUNT the same
way as we did for GLOBAL_SYM_COUNT parsing.

[1] aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")
[2] 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")

Cc: Tony Ambardar <tony.ambardar@gmail.com>
Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Fixes: 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/bpf/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 5f9abed3e226..55bd78b3496f 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
 			   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
 			   sort -u | wc -l)
 VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
+			      sed 's/\[.*\]//' | \
 			      awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
 			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
@@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so
 		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
 		    sort -u > $(OUTPUT)libbpf_global_syms.tmp;		 \
 		readelf --dyn-syms --wide $(OUTPUT)libbpf.so |		 \
+		    sed 's/\[.*\]//' |					 \
 		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
 		    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |		 \
 		    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; 	 \
-- 
2.26.2


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

* Re: [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing
  2020-11-18 21:13 [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing Jiri Olsa
@ 2020-11-19  1:57 ` Andrii Nakryiko
  2020-11-19  9:48   ` Jiri Olsa
  2020-11-19 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Andrii Nakryiko @ 2020-11-19  1:57 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Tony Ambardar, Thadeu Lima de Souza Cascardo, Aurelien Jarno,
	Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh

On Wed, Nov 18, 2020 at 1:15 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> We remove "other info" from "readelf -s --wide" output when
> parsing GLOBAL_SYM_COUNT variable, which was added in [1].
> But we don't do that for VERSIONED_SYM_COUNT and it's failing
> the check_abi target on powerpc Fedora 33.
>
> The extra "other info" wasn't problem for VERSIONED_SYM_COUNT
> parsing until commit [2] added awk in the pipe, which assumes
> that the last column is symbol, but it can be "other info".
>
> Adding "other info" removal for VERSIONED_SYM_COUNT the same
> way as we did for GLOBAL_SYM_COUNT parsing.
>
> [1] aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")
> [2] 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
>
> Cc: Tony Ambardar <tony.ambardar@gmail.com>
> Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Fixes: 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---

LGTM. For the future, though, please specify the destination tree: [PATCH bpf].

Acked-by: Andrii Nakryiko <andrii@kernel.org>


>  tools/lib/bpf/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index 5f9abed3e226..55bd78b3496f 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
>                            awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
>                            sort -u | wc -l)
>  VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
> +                             sed 's/\[.*\]//' | \
>                               awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
>                               grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>
> @@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so
>                     awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
>                     sort -u > $(OUTPUT)libbpf_global_syms.tmp;           \
>                 readelf --dyn-syms --wide $(OUTPUT)libbpf.so |           \
> +                   sed 's/\[.*\]//' |                                   \
>                     awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
>                     grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |             \
>                     sort -u > $(OUTPUT)libbpf_versioned_syms.tmp;        \
> --
> 2.26.2
>

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

* Re: [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing
  2020-11-19  1:57 ` Andrii Nakryiko
@ 2020-11-19  9:48   ` Jiri Olsa
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2020-11-19  9:48 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Tony Ambardar, Thadeu Lima de Souza Cascardo, Aurelien Jarno,
	Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh

On Wed, Nov 18, 2020 at 05:57:25PM -0800, Andrii Nakryiko wrote:
> On Wed, Nov 18, 2020 at 1:15 PM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > We remove "other info" from "readelf -s --wide" output when
> > parsing GLOBAL_SYM_COUNT variable, which was added in [1].
> > But we don't do that for VERSIONED_SYM_COUNT and it's failing
> > the check_abi target on powerpc Fedora 33.
> >
> > The extra "other info" wasn't problem for VERSIONED_SYM_COUNT
> > parsing until commit [2] added awk in the pipe, which assumes
> > that the last column is symbol, but it can be "other info".
> >
> > Adding "other info" removal for VERSIONED_SYM_COUNT the same
> > way as we did for GLOBAL_SYM_COUNT parsing.
> >
> > [1] aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")
> > [2] 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
> >
> > Cc: Tony Ambardar <tony.ambardar@gmail.com>
> > Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> > Cc: Aurelien Jarno <aurelien@aurel32.net>
> > Fixes: 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> 
> LGTM. For the future, though, please specify the destination tree: [PATCH bpf].

ugh, sry will do

jirka

> 
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> 
> 
> >  tools/lib/bpf/Makefile | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index 5f9abed3e226..55bd78b3496f 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
> >                            awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
> >                            sort -u | wc -l)
> >  VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
> > +                             sed 's/\[.*\]//' | \
> >                               awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
> >                               grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
> >
> > @@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so
> >                     awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
> >                     sort -u > $(OUTPUT)libbpf_global_syms.tmp;           \
> >                 readelf --dyn-syms --wide $(OUTPUT)libbpf.so |           \
> > +                   sed 's/\[.*\]//' |                                   \
> >                     awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
> >                     grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |             \
> >                     sort -u > $(OUTPUT)libbpf_versioned_syms.tmp;        \
> > --
> > 2.26.2
> >
> 


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

* Re: [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing
  2020-11-18 21:13 [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing Jiri Olsa
  2020-11-19  1:57 ` Andrii Nakryiko
@ 2020-11-19 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-19 17:00 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: ast, daniel, andriin, tony.ambardar, cascardo, aurelien, netdev,
	bpf, kafai, songliubraving, yhs, john.fastabend, kpsingh

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Wed, 18 Nov 2020 22:13:50 +0100 you wrote:
> We remove "other info" from "readelf -s --wide" output when
> parsing GLOBAL_SYM_COUNT variable, which was added in [1].
> But we don't do that for VERSIONED_SYM_COUNT and it's failing
> the check_abi target on powerpc Fedora 33.
> 
> The extra "other info" wasn't problem for VERSIONED_SYM_COUNT
> parsing until commit [2] added awk in the pipe, which assumes
> that the last column is symbol, but it can be "other info".
> 
> [...]

Here is the summary with links:
  - libbpf: Fix VERSIONED_SYM_COUNT number parsing
    https://git.kernel.org/bpf/bpf/c/1fd6cee127e2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-11-19 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 21:13 [PATCH] libbpf: Fix VERSIONED_SYM_COUNT number parsing Jiri Olsa
2020-11-19  1:57 ` Andrii Nakryiko
2020-11-19  9:48   ` Jiri Olsa
2020-11-19 17:00 ` patchwork-bot+netdevbpf

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