Commit 2b7d88c2 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

libbpf: Allow specifying both ELF and raw BTF for CO-RE BTF override

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: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201008001025.292064-4-andrii@kernel.org
parent a66345bc
...@@ -5842,7 +5842,7 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path) ...@@ -5842,7 +5842,7 @@ bpf_object__relocate_core(struct bpf_object *obj, const char *targ_btf_path)
return 0; return 0;
if (targ_btf_path) if (targ_btf_path)
targ_btf = btf__parse_elf(targ_btf_path, NULL); targ_btf = btf__parse(targ_btf_path, NULL);
else else
targ_btf = obj->btf_vmlinux; targ_btf = obj->btf_vmlinux;
if (IS_ERR_OR_NULL(targ_btf)) { if (IS_ERR_OR_NULL(targ_btf)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment