Skip to content

Commit aa91593

Browse files
Thadeu Lima de Souza CascardoAlexei Starovoitov
authored andcommitted
libbpf: Fix readelf output parsing for Fedora
Fedora binutils has been patched to show "other info" for a symbol at the end of the line. This was done in order to support unmaintained scripts that would break with the extra info. [1] [1] https://src.fedoraproject.org/rpms/binutils/c/b8265c46f7ddae23a792ee8306fbaaeacba83bf8 This in turn has been done to fix the build of ruby, because of checksec. [2] Thanks Michael Ellerman for the pointer. [2] https://bugzilla.redhat.com/show_bug.cgi?id=1479302 As libbpf Makefile is not unmaintained, we can simply deal with either output format, by just removing the "other info" field, as it always comes inside brackets. Fixes: 3464afd (libbpf: Fix readelf output parsing on powerpc with recent binutils) Reported-by: Justin Forbes <jmforbes@linuxtx.org> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Link: https://lore.kernel.org/bpf/20191213101114.GA3986@calabresa
1 parent a06ae6a commit aa91593

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎tools/lib/bpf/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
147147

148148
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
149149
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
150+
sed 's/\[.*\]//' | \
150151
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
151152
sort -u | wc -l)
152153
VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
@@ -213,6 +214,7 @@ check_abi: $(OUTPUT)libbpf.so
213214
"versioned in $(VERSION_SCRIPT)." >&2; \
214215
readelf -s --wide $(BPF_IN_SHARED) | \
215216
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
217+
sed 's/\[.*\]//' | \
216218
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
217219
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
218220
readelf -s --wide $(OUTPUT)libbpf.so | \

0 commit comments

Comments
 (0)