Skip to content

Commit 9efc779

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
libbpf: emit diff of mismatched public API, if any
It's easy to have a mismatch of "intended to be public" vs really exposed API functions. While Makefile does check for this mismatch, if it actually occurs it's not trivial to determine which functions are accidentally exposed. This patch dumps out a diff showing what's not supposed to be exposed facilitating easier fixing. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 14a1eaa commit 9efc779

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/lib/bpf/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ check_abi: $(OUTPUT)libbpf.so
204204
"versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
205205
"Please make sure all LIBBPF_API symbols are" \
206206
"versioned in $(VERSION_SCRIPT)." >&2; \
207+
readelf -s --wide $(OUTPUT)libbpf-in.o | \
208+
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'| \
209+
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
210+
readelf -s --wide $(OUTPUT)libbpf.so | \
211+
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
212+
sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
213+
diff -u $(OUTPUT)libbpf_global_syms.tmp \
214+
$(OUTPUT)libbpf_versioned_syms.tmp; \
215+
rm $(OUTPUT)libbpf_global_syms.tmp \
216+
$(OUTPUT)libbpf_versioned_syms.tmp; \
207217
exit 1; \
208218
fi
209219

0 commit comments

Comments
 (0)