Skip to content

Handle no-BTF object files better

Andrii Nakryiko bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpftool: improve skeleton generation for objects without BTFtools/bpf/bpftool/gen.c+64 -170 replies
2/3libbpf: skip BTF fixup if object file has no BTFtools/lib/bpf/linker.c+3 -01 reply
3/3selftests/bpf: allow compiling BPF objects without BTFtools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/prog_tests/static_linked.c tools/testing/selftests/bpf/progs/test_static_linked3.nobtf.c+56 -710 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

PatchJiri Olsa
1/3
2/3T-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] Handle no-BTF object files better

Fix two issues caused by BPF object files with missing BTF type information:
1. BPF skeleton generated for BPF object files that use global variables but are compiled without BTF won't compile.
2. BPF static linker will crash attempting to fix up BTF for input object file with no BTF.

This patch set also extends static linking selftest to validate correct handling of both conditions now. For that, selftests Makefile is enhanced to allow selecting whether a given BPF object file should be compiled with BTF or not, based on naming convention (.nobtf.c suffix).

Andrii Nakryiko (3):
bpftool: improve skeleton generation for objects without BTF
libbpf: skip BTF fixup if object file has no BTF selftests/bpf: allow compiling BPF objects without BTF

 tools/bpf/bpftool/gen.c                       | 81 +++++++++++++++----
 tools/lib/bpf/linker.c                        |  3 +
 tools/testing/selftests/bpf/Makefile          | 21 +++--
 .../selftests/bpf/prog_tests/static_linked.c  |  6 +-
 .../bpf/progs/test_static_linked3.nobtf.c     | 36 +++++++++
 5 files changed, 123 insertions(+), 24 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_static_linked3.nobtf.c
Signature · 1 line
2.30.2