|
Justin M. Forbes |
ddf2b5 |
From 3464afdf11f9a1e031e7858a05351ceca1792fea Mon Sep 17 00:00:00 2001
|
|
Justin M. Forbes |
ddf2b5 |
From: Aurelien Jarno <aurelien@aurel32.net>
|
|
Justin M. Forbes |
ddf2b5 |
Date: Sun, 1 Dec 2019 20:57:28 +0100
|
|
Justin M. Forbes |
ddf2b5 |
Subject: [PATCH] libbpf: Fix readelf output parsing on powerpc with recent
|
|
Justin M. Forbes |
ddf2b5 |
binutils
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
On powerpc with recent versions of binutils, readelf outputs an extra
|
|
Justin M. Forbes |
ddf2b5 |
field when dumping the symbols of an object file. For example:
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
35: 0000000000000838 96 FUNC LOCAL DEFAULT [<localentry>: 8] 1 btf_is_struct
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
The extra "[<localentry>: 8]" prevents the GLOBAL_SYM_COUNT variable to
|
|
Justin M. Forbes |
ddf2b5 |
be computed correctly and causes the check_abi target to fail.
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
Fix that by looking for the symbol name in the last field instead of the
|
|
Justin M. Forbes |
ddf2b5 |
8th one. This way it should also cope with future extra fields.
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
Justin M. Forbes |
ddf2b5 |
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
Justin M. Forbes |
ddf2b5 |
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
|
|
Justin M. Forbes |
ddf2b5 |
Link: https://lore.kernel.org/bpf/20191201195728.4161537-1-aurelien@aurel32.net
|
|
Justin M. Forbes |
ddf2b5 |
---
|
|
Justin M. Forbes |
ddf2b5 |
tools/lib/bpf/Makefile | 4 ++--
|
|
Justin M. Forbes |
ddf2b5 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
ddf2b5 |
index 37d7967aa166..3d3d024f7b94 100644
|
|
Justin M. Forbes |
ddf2b5 |
--- a/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
ddf2b5 |
+++ b/tools/lib/bpf/Makefile
|
|
Justin M. Forbes |
ddf2b5 |
@@ -147,7 +147,7 @@ TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
|
|
Justin M. Forbes |
ddf2b5 |
|
|
Justin M. Forbes |
ddf2b5 |
GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
|
|
Justin M. Forbes |
ddf2b5 |
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
|
|
Justin M. Forbes |
ddf2b5 |
- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \
|
|
Justin M. Forbes |
ddf2b5 |
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
|
|
Justin M. Forbes |
ddf2b5 |
sort -u | wc -l)
|
|
Justin M. Forbes |
ddf2b5 |
VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \
|
|
Justin M. Forbes |
ddf2b5 |
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
|
|
Justin M. Forbes |
ddf2b5 |
@@ -216,7 +216,7 @@ check_abi: $(OUTPUT)libbpf.so
|
|
Justin M. Forbes |
ddf2b5 |
"versioned in $(VERSION_SCRIPT)." >&2; \
|
|
Justin M. Forbes |
ddf2b5 |
readelf -s --wide $(BPF_IN_SHARED) | \
|
|
Justin M. Forbes |
ddf2b5 |
cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
|
|
Justin M. Forbes |
ddf2b5 |
- awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'| \
|
|
Justin M. Forbes |
ddf2b5 |
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
|
|
Justin M. Forbes |
ddf2b5 |
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
|
|
Justin M. Forbes |
ddf2b5 |
readelf -s --wide $(OUTPUT)libbpf.so | \
|
|
Justin M. Forbes |
ddf2b5 |
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
|
|
Justin M. Forbes |
ddf2b5 |
--
|
|
Justin M. Forbes |
ddf2b5 |
2.23.0
|
|
Justin M. Forbes |
ddf2b5 |
|