Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH bpf v1] tools/libbpf: avoid counting local symbols in ABI check
@ 2020-09-05 21:48 Tony Ambardar
2020-09-08 19:53 ` Andrii Nakryiko
0 siblings, 1 reply; 3+ messages in thread
From: Tony Ambardar @ 2020-09-05 21:48 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: Tony Ambardar, netdev, bpf, Andrey Ignatov
Encountered the following failure building libbpf from kernel 5.8.5 sources
with GCC 8.4.0 and binutils 2.34: (long paths shortened)
Warning: Num of global symbols in sharedobjs/libbpf-in.o (234) does NOT
match with num of versioned symbols in libbpf.so (236). Please make sure
all LIBBPF_API symbols are versioned in libbpf.map.
--- libbpf_global_syms.tmp 2020-09-02 07:30:58.920084380 +0000
+++ libbpf_versioned_syms.tmp 2020-09-02 07:30:58.924084388 +0000
@@ -1,3 +1,5 @@
+_fini
+_init
bpf_btf_get_fd_by_id
bpf_btf_get_next_id
bpf_create_map
make[4]: *** [Makefile:210: check_abi] Error 1
Investigation shows _fini and _init are actually local symbols counted
amongst global ones:
$ readelf --dyn-syms --wide libbpf.so|head -10
Symbol table '.dynsym' contains 343 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00004098 0 SECTION LOCAL DEFAULT 11
2: 00004098 8 FUNC LOCAL DEFAULT 11 _init@@LIBBPF_0.0.1
3: 00023040 8 FUNC LOCAL DEFAULT 14 _fini@@LIBBPF_0.0.1
4: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.4
5: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.1
6: 0000ffa4 8 FUNC GLOBAL DEFAULT 12 bpf_object__find_map_by_offset@@LIBBPF_0.0.1
A previous commit filtered global symbols in sharedobjs/libbpf-in.o. Do the
same with the libbpf.so DSO for consistent comparison.
Fixes: 306b267cb3c4 ("libbpf: Verify versioned symbols")
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
tools/lib/bpf/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index b78484e7a608..9ae8f4ef0aac 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -152,6 +152,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 | \
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,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 | \
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
diff -u $(OUTPUT)libbpf_global_syms.tmp \
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v1] tools/libbpf: avoid counting local symbols in ABI check
2020-09-05 21:48 [PATCH bpf v1] tools/libbpf: avoid counting local symbols in ABI check Tony Ambardar
@ 2020-09-08 19:53 ` Andrii Nakryiko
2020-09-08 23:27 ` Alexei Starovoitov
0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2020-09-08 19:53 UTC (permalink / raw)
To: Tony Ambardar
Cc: Alexei Starovoitov, Daniel Borkmann, Networking, bpf, Andrey Ignatov
On Sat, Sep 5, 2020 at 2:49 PM Tony Ambardar <tony.ambardar@gmail.com> wrote:
>
> Encountered the following failure building libbpf from kernel 5.8.5 sources
> with GCC 8.4.0 and binutils 2.34: (long paths shortened)
>
> Warning: Num of global symbols in sharedobjs/libbpf-in.o (234) does NOT
> match with num of versioned symbols in libbpf.so (236). Please make sure
> all LIBBPF_API symbols are versioned in libbpf.map.
> --- libbpf_global_syms.tmp 2020-09-02 07:30:58.920084380 +0000
> +++ libbpf_versioned_syms.tmp 2020-09-02 07:30:58.924084388 +0000
> @@ -1,3 +1,5 @@
> +_fini
> +_init
> bpf_btf_get_fd_by_id
> bpf_btf_get_next_id
> bpf_create_map
> make[4]: *** [Makefile:210: check_abi] Error 1
>
> Investigation shows _fini and _init are actually local symbols counted
> amongst global ones:
>
> $ readelf --dyn-syms --wide libbpf.so|head -10
>
> Symbol table '.dynsym' contains 343 entries:
> Num: Value Size Type Bind Vis Ndx Name
> 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
> 1: 00004098 0 SECTION LOCAL DEFAULT 11
> 2: 00004098 8 FUNC LOCAL DEFAULT 11 _init@@LIBBPF_0.0.1
> 3: 00023040 8 FUNC LOCAL DEFAULT 14 _fini@@LIBBPF_0.0.1
> 4: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.4
> 5: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.1
> 6: 0000ffa4 8 FUNC GLOBAL DEFAULT 12 bpf_object__find_map_by_offset@@LIBBPF_0.0.1
>
> A previous commit filtered global symbols in sharedobjs/libbpf-in.o. Do the
> same with the libbpf.so DSO for consistent comparison.
>
> Fixes: 306b267cb3c4 ("libbpf: Verify versioned symbols")
>
> Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
> ---
LGTM, thanks!
Acked-by: Andrii Nakryiko <andriin@fb.com>
> tools/lib/bpf/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> index b78484e7a608..9ae8f4ef0aac 100644
> --- a/tools/lib/bpf/Makefile
> +++ b/tools/lib/bpf/Makefile
> @@ -152,6 +152,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 | \
> + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
> grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
>
> CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
> @@ -219,6 +220,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 | \
> + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
> grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
> sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
> diff -u $(OUTPUT)libbpf_global_syms.tmp \
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v1] tools/libbpf: avoid counting local symbols in ABI check
2020-09-08 19:53 ` Andrii Nakryiko
@ 2020-09-08 23:27 ` Alexei Starovoitov
0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-09-08 23:27 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Tony Ambardar, Alexei Starovoitov, Daniel Borkmann, Networking,
bpf, Andrey Ignatov
On Tue, Sep 8, 2020 at 12:53 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Sat, Sep 5, 2020 at 2:49 PM Tony Ambardar <tony.ambardar@gmail.com> wrote:
> >
> > Encountered the following failure building libbpf from kernel 5.8.5 sources
> > with GCC 8.4.0 and binutils 2.34: (long paths shortened)
> >
> > Warning: Num of global symbols in sharedobjs/libbpf-in.o (234) does NOT
> > match with num of versioned symbols in libbpf.so (236). Please make sure
> > all LIBBPF_API symbols are versioned in libbpf.map.
> > --- libbpf_global_syms.tmp 2020-09-02 07:30:58.920084380 +0000
> > +++ libbpf_versioned_syms.tmp 2020-09-02 07:30:58.924084388 +0000
> > @@ -1,3 +1,5 @@
> > +_fini
> > +_init
> > bpf_btf_get_fd_by_id
> > bpf_btf_get_next_id
> > bpf_create_map
> > make[4]: *** [Makefile:210: check_abi] Error 1
> >
> > Investigation shows _fini and _init are actually local symbols counted
> > amongst global ones:
> >
> > $ readelf --dyn-syms --wide libbpf.so|head -10
> >
> > Symbol table '.dynsym' contains 343 entries:
> > Num: Value Size Type Bind Vis Ndx Name
> > 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
> > 1: 00004098 0 SECTION LOCAL DEFAULT 11
> > 2: 00004098 8 FUNC LOCAL DEFAULT 11 _init@@LIBBPF_0.0.1
> > 3: 00023040 8 FUNC LOCAL DEFAULT 14 _fini@@LIBBPF_0.0.1
> > 4: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.4
> > 5: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.1
> > 6: 0000ffa4 8 FUNC GLOBAL DEFAULT 12 bpf_object__find_map_by_offset@@LIBBPF_0.0.1
> >
> > A previous commit filtered global symbols in sharedobjs/libbpf-in.o. Do the
> > same with the libbpf.so DSO for consistent comparison.
> >
> > Fixes: 306b267cb3c4 ("libbpf: Verify versioned symbols")
> >
> > Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
Applied. Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-08 23:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05 21:48 [PATCH bpf v1] tools/libbpf: avoid counting local symbols in ABI check Tony Ambardar
2020-09-08 19:53 ` Andrii Nakryiko
2020-09-08 23:27 ` Alexei Starovoitov
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).