diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 877c03d577dc8cc24ed6b106829635ad436f7ce4..aa2a7580973472e179d814ef50ba114d64935b0c 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -388,6 +388,7 @@ struct bpf_map { char *pin_path; bool pinned; bool reused; + bool skipped; }; enum extern_type { @@ -5041,8 +5042,10 @@ bpf_object__create_maps(struct bpf_object *obj) * kernels. */ if (bpf_map__is_internal(map) && - !kernel_supports(obj, FEAT_GLOBAL_DATA)) + !kernel_supports(obj, FEAT_GLOBAL_DATA)) { + map->skipped = true; continue; + } retried = false; retry: @@ -5671,8 +5674,7 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog) } else { const struct bpf_map *map = &obj->maps[relo->map_idx]; - if (bpf_map__is_internal(map) && - !kernel_supports(obj, FEAT_GLOBAL_DATA)) { + if (map->skipped) { pr_warn("prog '%s': relo #%d: kernel doesn't support global data\n", prog->name, i); return -ENOTSUP; @@ -7837,6 +7839,9 @@ int bpf_object__pin_maps(struct bpf_object *obj, const char *path) char *pin_path = NULL; char buf[PATH_MAX]; + if (map->skipped) + continue; + if (path) { int len;