Skip to contentSkip to conversation

samples: bpf: Suppress readelf stderr when probing for BTF support

PATCH In review Pu Lehui 3 participants 3 messages Oct 21, 2021 – Nov 3, 2021

Subsystems (3)
lore
Share & tools
lore

Pu Lehui

author
#0 lore raw

PATCH 1/1 samples: bpf: Suppress readelf stderr when probing for BTF support

When compiling bpf samples, the following warning appears:

readelf: Error: Missing knowledge of 32-bit reloc types used in DWARF sections of machine number 247
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 1 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info

Same problem was mentioned in commit 2f0921262ba9 ("selftests/bpf:
suppress readelf stderr when probing for BTF support"), let's use readelf that supports btf.

---
 samples/bpf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
samples/bpf/Makefile +2 -1
index 2366242edb7c..a886dff1ba89 100644
@@ -229,6 +229,7 @@ CLANG ?= clang
 OPT ?= opt
 LLVM_DIS ?= llvm-dis
 LLVM_OBJCOPY ?= llvm-objcopy
+LLVM_READELF ?= llvm-readelf
 BTF_PAHOLE ?= pahole
 
 # Detect that we're cross compiling and use the cross compiler
@@ -252,7 +253,7 @@ BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF)
 BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm')
 BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \
 			  $(CLANG) -target bpf -O2 -g -c -x c - -o ./llvm_btf_verify.o; \
-			  readelf -S ./llvm_btf_verify.o | grep BTF; \
+			  $(LLVM_READELF) -S ./llvm_btf_verify.o | grep BTF; \
 			  /bin/rm -f ./llvm_btf_verify.o)
 
 BPF_EXTRA_CFLAGS += -fno-stack-protector
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Pu Lehui

When compiling bpf samples, the following warning appears:

readelf: Error: Missing knowledge of 32-bit reloc types used in DWARF sections of machine number 247
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 1 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info

Quoted 6 lines

Same problem was mentioned in commit 2f0921262ba9 ("selftests/bpf:
suppress readelf stderr when probing for BTF support"), let's use readelf that supports btf.

---

Thanks.

Acked-by on v1 1/1
#2 lore raw
In reply to Pu Lehui
Quoted 11 lines · Pu Lehui

When compiling bpf samples, the following warning appears:

readelf: Error: Missing knowledge of 32-bit reloc types used in DWARF sections of machine number 247
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 1 to section .debug_info
readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info

Quoted 5 lines

Same problem was mentioned in commit 2f0921262ba9 ("selftests/bpf:
suppress readelf stderr when probing for BTF support"), let's use readelf that supports btf.