]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: implement BPF CO-RE offset relocation algorithm
authorAndrii Nakryiko <andriin@fb.com>
Wed, 7 Aug 2019 21:39:51 +0000 (14:39 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Aug 2019 21:43:49 +0000 (14:43 -0700)
commit299b4e30e1c47406eb69f90b979a7399c03b4d98
tree9e80ac1aba335b955c31b13bd8f96bd960957576
parent6d1eea294618ca32d6c34afbc3aacff92e5f7afc
libbpf: implement BPF CO-RE offset relocation algorithm

This patch implements the core logic for BPF CO-RE offsets relocations.
Every instruction that needs to be relocated has corresponding
bpf_offset_reloc as part of BTF.ext. Relocations are performed by trying
to match recorded "local" relocation spec against potentially many
compatible "target" types, creating corresponding spec. Details of the
algorithm are noted in corresponding comments in the code.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h