diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-09-13 18:47:31 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-09-14 15:49:24 -0700 |
commit | 91b4d1d1d54431c72f3a7ff034f30a635f787426 (patch) | |
tree | 625a85f3f636516a10bbb813c9af279f78ed586f /tools/testing/selftests/bpf/prog_tests/perf_buffer.c | |
parent | 53df63ccdc0258118e53089197d0428c5330cc9c (diff) |
libbpf: Ensure BPF prog types are set before relocations
Refactor bpf_object__open() sequencing to perform BPF program type
detection based on SEC() definitions before we get to relocations
collection. This allows to have more information about BPF program by
the time we get to, say, struct_ops relocation gathering. This,
subsequently, simplifies struct_ops logic and removes the need to
perform extra find_sec_def() resolution.
With this patch libbpf will require all struct_ops BPF programs to be
marked with SEC("struct_ops") or SEC("struct_ops/xxx") annotations.
Real-world applications are already doing that through something like
selftests's BPF_STRUCT_OPS() macro. This change streamlines libbpf's
internal handling of SEC() definitions and is in the sprit of
upcoming libbpf-1.0 section strictness changes ([0]).
[0] https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0#stricter-and-more-uniform-bpf-program-section-name-sec-handling
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210914014733.2768-3-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/perf_buffer.c')
0 files changed, 0 insertions, 0 deletions