aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index d5b830d60601..5e977d2688da 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -835,12 +835,19 @@ static int bpf_object__elf_collect(struct bpf_object *obj, int flags)
835 obj->efile.maps_shndx = idx; 835 obj->efile.maps_shndx = idx;
836 else if (strcmp(name, BTF_ELF_SEC) == 0) { 836 else if (strcmp(name, BTF_ELF_SEC) == 0) {
837 obj->btf = btf__new(data->d_buf, data->d_size); 837 obj->btf = btf__new(data->d_buf, data->d_size);
838 if (IS_ERR(obj->btf) || btf__load(obj->btf)) { 838 if (IS_ERR(obj->btf)) {
839 pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n", 839 pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n",
840 BTF_ELF_SEC, PTR_ERR(obj->btf)); 840 BTF_ELF_SEC, PTR_ERR(obj->btf));
841 if (!IS_ERR(obj->btf))
842 btf__free(obj->btf);
843 obj->btf = NULL; 841 obj->btf = NULL;
842 continue;
843 }
844 err = btf__load(obj->btf);
845 if (err) {
846 pr_warning("Error loading %s into kernel: %d. Ignored and continue.\n",
847 BTF_ELF_SEC, err);
848 btf__free(obj->btf);
849 obj->btf = NULL;
850 err = 0;
844 } 851 }
845 } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) { 852 } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) {
846 btf_ext_data = data; 853 btf_ext_data = data;