]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Parse multi-function sections into multiple BPF programs
authorAndrii Nakryiko <andriin@fb.com>
Thu, 3 Sep 2020 20:35:30 +0000 (13:35 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Sep 2020 00:14:39 +0000 (17:14 -0700)
commit6ed6027551aae5e6a8f3ef9fffc2c1fa702fc379
treea9c9783cbd84642ce17b548c58bf1416385fa7d6
parentc2b1da9056cb77d3f5003a1ca82baf53d1de1e0e
libbpf: Parse multi-function sections into multiple BPF programs

Teach libbpf how to parse code sections into potentially multiple bpf_program
instances, based on ELF FUNC symbols. Each BPF program will keep track of its
position within containing ELF section for translating section instruction
offsets into program instruction offsets: regardless of BPF program's location
in ELF section, it's first instruction is always at local instruction offset
0, so when libbpf is working with relocations (which use section-based
instruction offsets) this is critical to make proper translations.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200903203542.15944-3-andriin@fb.com
tools/lib/bpf/libbpf.c