Commit 55983299 authored by Yauheni Kaliuta's avatar Yauheni Kaliuta Committed by Alexei Starovoitov
Browse files

libbpf: Use .so dynamic symbols for abi check



Since dynamic symbols are used for dynamic linking it makes sense to
use them (readelf --dyn-syms) for abi check.

Found with some configuration on powerpc where linker puts
local *.plt_call.* symbols into .so.

Signed-off-by: default avatarYauheni Kaliuta <yauheni.kaliuta@redhat.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200525061846.16524-1-yauheni.kaliuta@redhat.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 0142dddc
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -151,7 +151,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
			   sed 's/\[.*\]//' | \
			   sed 's/\[.*\]//' | \
			   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
			   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
			   sort -u | wc -l)
			   sort -u | wc -l)
VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
			      grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)


CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -218,7 +218,7 @@ check_abi: $(OUTPUT)libbpf.so
		    sed 's/\[.*\]//' |					 \
		    sed 's/\[.*\]//' |					 \
		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
		    sort -u > $(OUTPUT)libbpf_global_syms.tmp;		 \
		    sort -u > $(OUTPUT)libbpf_global_syms.tmp;		 \
		readelf -s --wide $(OUTPUT)libbpf.so |			 \
		readelf --dyn-syms --wide $(OUTPUT)libbpf.so |		 \
		    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |		 \
		    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |		 \
		    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; 	 \
		    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; 	 \
		diff -u $(OUTPUT)libbpf_global_syms.tmp			 \
		diff -u $(OUTPUT)libbpf_global_syms.tmp			 \