libbpf: Fix VERSIONED_SYM_COUNT number parsing
Subsystems (4)
Jiri Olsa
reviewerPATCH 1/1 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] aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")
[2] 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")
--- tools/lib/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/lib/bpf/Makefile +2 -0
@@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ sort -u | wc -l) VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
@@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
Signature · 1 line
2.26.2
Quoted 16 lines · Jiri Olsa
We remove "other info" from "readelf -s --wide" output when parsing
GLOBAL_SYM_COUNTvariable, which was added in [1]. But we don't do that forVERSIONED_SYM_COUNTand it's failing thecheck_abitarget on powerpc Fedora 33.The extra "other info" wasn't problem for
VERSIONED_SYM_COUNTparsing 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_COUNTthe same way as we did forGLOBAL_SYM_COUNTparsing.[1]
aa915931ac3e("libbpf: Fix readelf output parsing for Fedora")
[2]746f534a4809("tools/libbpf: Avoid counting local symbols in ABI check")
Quoted 6 lines
Cc Tony Ambardar <[email protected]>Cc Thadeu Lima de Souza Cascardo <[email protected]>Cc Aurelien Jarno <[email protected]>Fixes 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")Signed-off-by Jiri Olsa <[email protected]>---
LGTM. For the future, though, please specify the destination tree: [PATCH bpf].
Quoted 26 lines
tools/lib/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/lib/bpf/Makefile +2
-1@@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ sort -u | wc -l) VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)@@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \ --2.26.2
Quoted 17 lines · Andrii Nakryiko
Quoted 16 lines · Jiri Olsa
We remove "other info" from "readelf -s --wide" output when parsing
GLOBAL_SYM_COUNTvariable, which was added in [1]. But we don't do that forVERSIONED_SYM_COUNTand it's failing thecheck_abitarget on powerpc Fedora 33.The extra "other info" wasn't problem for
VERSIONED_SYM_COUNTparsing 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_COUNTthe same way as we did forGLOBAL_SYM_COUNTparsing.[1]
aa915931ac3e("libbpf: Fix readelf output parsing for Fedora")
[2]746f534a4809("tools/libbpf: Avoid counting local symbols in ABI check")
Quoted 8 lines
Quoted 6 lines
Cc Tony Ambardar <[email protected]>Cc Thadeu Lima de Souza Cascardo <[email protected]>Cc Aurelien Jarno <[email protected]>Fixes 746f534a4809 ("tools/libbpf: Avoid counting local symbols in ABI check")Signed-off-by Jiri Olsa <[email protected]>---
LGTM. For the future, though, please specify the destination tree: [PATCH bpf].
ugh, sry will do
jirka
Quoted 31 lines
Acked-by Andrii Nakryiko <[email protected]>Quoted 26 lines
tools/lib/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/lib/bpf/Makefile +2
-1@@ -146,6 +146,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ sort -u | wc -l) VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)@@ -214,6 +215,7 @@ check_abi: $(OUTPUT)libbpf.so awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ + sed 's/\[.*\]//' | \ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \ --2.26.2
This patch was applied to bpf/bpf.git (refs/heads/master):
Hello:
This patch was applied to bpf/bpf.git (refs/heads/master):
Quoted 10 lines · On Wed, 18 Nov 2020 22:13:50 +0100 you wrote:
We remove "other info" from "readelf -s --wide" output when parsing
GLOBAL_SYM_COUNTvariable, which was added in [1]. But we don't do that forVERSIONED_SYM_COUNTand it's failing thecheck_abitarget on powerpc Fedora 33.The extra "other info" wasn't problem for
VERSIONED_SYM_COUNTparsing until commit [2] added awk in the pipe, which assumes that the last column is symbol, but it can be "other info".[...]
Here is the summary with links:
- libbpf: Fix VERSIONED_SYM_COUNT number parsing
https://git.kernel.org/bpf/bpf/c/1fd6cee127e2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html