|
Justin M. Forbes |
261681 |
From 746f534a4809e07f427f7d13d10f3a6a9641e5c3 Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
261681 |
From: Tony Ambardar <tony.ambardar@gmail.com>
|
|
Justin M. Forbes |
261681 |
Date: Sat, 5 Sep 2020 14:48:31 -0700
|
|
Justin M. Forbes |
261681 |
Subject: [PATCH] tools/libbpf: Avoid counting local symbols in ABI check
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
Encountered the following failure building libbpf from kernel 5.8.5 sources
|
|
Justin M. Forbes |
261681 |
with GCC 8.4.0 and binutils 2.34: (long paths shortened)
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
Investigation shows _fini and _init are actually local symbols counted
|
|
Justin M. Forbes |
261681 |
amongst global ones:
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
$ readelf --dyn-syms --wide libbpf.so|head -10
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
Symbol table '.dynsym' contains 343 entries:
|
|
Justin M. Forbes |
261681 |
Num: Value Size Type Bind Vis Ndx Name
|
|
Justin M. Forbes |
261681 |
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
|
Justin M. Forbes |
261681 |
1: 00004098 0 SECTION LOCAL DEFAULT 11
|
|
Justin M. Forbes |
261681 |
2: 00004098 8 FUNC LOCAL DEFAULT 11 _init@@LIBBPF_0.0.1
|
|
Justin M. Forbes |
261681 |
3: 00023040 8 FUNC LOCAL DEFAULT 14 _fini@@LIBBPF_0.0.1
|
|
Justin M. Forbes |
261681 |
4: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.4
|
|
Justin M. Forbes |
261681 |
5: 00000000 0 OBJECT GLOBAL DEFAULT ABS LIBBPF_0.0.1
|
|
Justin M. Forbes |
261681 |
6: 0000ffa4 8 FUNC GLOBAL DEFAULT 12 bpf_object__find_map_by_offset@@LIBBPF_0.0.1
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
A previous commit filtered global symbols in sharedobjs/libbpf-in.o. Do the
|
|
Justin M. Forbes |
261681 |
same with the libbpf.so DSO for consistent comparison.
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
Fixes: 306b267cb3c4 ("libbpf: Verify versioned symbols")
|
|
Justin M. Forbes |
261681 |
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
|
|
Justin M. Forbes |
261681 |
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
|
Justin M. Forbes |
261681 |
Acked-by: Andrii Nakryiko <andriin@fb.com>
|
|
Justin M. Forbes |
261681 |
Link: https://lore.kernel.org/bpf/20200905214831.1565465-1-Tony.Ambardar@gmail.com
|
|
Justin M. Forbes |
261681 |
---
|
|
Justin M. Forbes |
261681 |
tools/lib/bpf/Makefile | 2 ++
|
|
Justin M. Forbes |
261681 |
1 file changed, 2 insertions(+)
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
261681 |
index b78484e7a608..9ae8f4ef0aac 100644
|
|
Justin M. Forbes |
261681 |
--- a/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
261681 |
+++ b/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
261681 |
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
|
|
Justin M. Forbes |
261681 |
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
|
|
Justin M. Forbes |
261681 |
sort -u | wc -l)
|
|
Justin M. Forbes |
261681 |
VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
|
|
Justin M. Forbes |
261681 |
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
|
|
Justin M. Forbes |
261681 |
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
|
|
Justin M. Forbes |
261681 |
|
|
Justin M. Forbes |
261681 |
CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
|
|
Justin M. Forbes |
261681 |
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so
|
|
Justin M. Forbes |
261681 |
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
|
|
Justin M. Forbes |
261681 |
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
|
|
Justin M. Forbes |
261681 |
readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
|
|
Justin M. Forbes |
261681 |
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
|
|
Justin M. Forbes |
261681 |
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
|
|
Justin M. Forbes |
261681 |
sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
|
|
Justin M. Forbes |
261681 |
diff -u $(OUTPUT)libbpf_global_syms.tmp \
|
|
Justin M. Forbes |
261681 |
--
|
|
Justin M. Forbes |
261681 |
2.28.0
|
|
Justin M. Forbes |
261681 |
|