libbpf: Add kernel module BTF support for CO-RE relocations
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 3 Dec 2020 20:46:25 +0000 (12:46 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 4 Dec 2020 01:38:20 +0000 (17:38 -0800)
commit4f33a53d56000cfa67e2e4e8a5dac08f084a979b
treedb7cfd0be58bf112064c9e9b65b9f6dc4e51d9a6
parent0f7515ca7cddadabe04e28e20a257b1bbb6cb98a
libbpf: Add kernel module BTF support for CO-RE relocations

Teach libbpf to search for candidate types for CO-RE relocations across kernel
modules BTFs, in addition to vmlinux BTF. If at least one candidate type is
found in vmlinux BTF, kernel module BTFs are not iterated. If vmlinux BTF has
no matching candidates, then find all kernel module BTFs and search for all
matching candidates across all of them.

Kernel's support for module BTFs are inferred from the support for BTF name
pointer in BPF UAPI.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201203204634.1325171-6-andrii@kernel.org
tools/lib/bpf/libbpf.c