Skip to content

Commit 1fd6cee

Browse files
olsajiriAlexei Starovoitov
authored andcommitted
libbpf: Fix VERSIONED_SYM_COUNT number parsing
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] aa91593 ("libbpf: Fix readelf output parsing for Fedora") [2] 746f534 ("tools/libbpf: Avoid counting local symbols in ABI check") Fixes: 746f534 ("tools/libbpf: Avoid counting local symbols in ABI check") Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 4363023 commit 1fd6cee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/lib/bpf/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
146146
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
147147
sort -u | wc -l)
148148
VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
149+
sed 's/\[.*\]//' | \
149150
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
150151
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
151152

@@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so
214215
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
215216
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
216217
readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
218+
sed 's/\[.*\]//' | \
217219
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
218220
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
219221
sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \

0 commit comments

Comments
 (0)