On Mon, Sep 13, 2021 at 06:47:31PM -0700, Andrii Nakryiko wrote: > 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 > > Cc: Martin KaFai Lau <kafai@xxxxxx> > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Acked-by: Martin KaFai Lau <kafai@xxxxxx>