diff mbox series

[v2,bpf-next,3/4] libbpf: allow specifying both ELF and raw BTF for CO-RE BTF override

Message ID 20201007202946.3684483-4-andrii@kernel.org
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series libbpf: auto-resize relocatable LOAD/STORE instructions | expand

Commit Message

Andrii Nakryiko Oct. 7, 2020, 8:29 p.m. UTC
From: Andrii Nakryiko <andriin@fb.com>

Use generalized BTF parsing logic, making it possible to parse BTF both from
ELF file, as well as a raw BTF dump. This makes it easier to write custom
tests with manually generated BTFs.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 032cf0049ddb..105cb8ad1d75 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5842,7 +5842,7 @@  bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path)
 		return 0;
 
 	if (targ_btf_path)
-		targ_btf = btf__parse_elf(targ_btf_path, NULL);
+		targ_btf = btf__parse(targ_btf_path, NULL);
 	else
 		targ_btf = obj->btf_vmlinux;
 	if (IS_ERR_OR_NULL(targ_btf)) {