Deal with static variables and maps better to make them work with BPF skeleton well. All static variables and maps are renamed in corresponding BTF information so as to have an "<obj_name>.." prefix, which allows to distinguish name-conflicting static entities between multiple linked files. Also make libbpf support static maps properly. Previously static map reference resulted in the most probably erroneous use of the very *first* defined map, because it was the one with offset 0. Now static map references are resolved properly and thus static maps are finally usable. BPF static linker already supports static maps and no further changes are required, beyond variable renaming. Patch #1 adds missed documentation of the latest Clang dependency. N.B. This patch set is based on top of patch set [0]. [0] https://patchwork.kernel.org/project/netdevbpf/list/?series=472405&state=* v1->v2: - rebased on top of v3 of BPF static linker extern support patch set; - dropped selftests doc update, which went into mentioned patch set; - added skip modifiers for .data/.bss which was missed on initial submission. Andrii Nakryiko (6): bpftool: strip const/volatile/restrict modifiers from .bss and .data vars libbpf: rename static variables during linking libbpf: support static map definitions bpftool: handle transformed static map names in BPF skeleton selftests/bpf: extend linked_vars selftests with static variables selftests/bpf: extend linked_maps selftests with static maps tools/bpf/bpftool/gen.c | 40 +++--- tools/lib/bpf/libbpf.c | 7 +- tools/lib/bpf/libbpf.h | 12 +- tools/lib/bpf/linker.c | 121 +++++++++++++++++- .../selftests/bpf/prog_tests/linked_maps.c | 20 ++- .../selftests/bpf/prog_tests/linked_vars.c | 12 +- .../selftests/bpf/prog_tests/skeleton.c | 8 +- .../selftests/bpf/prog_tests/static_linked.c | 8 +- .../selftests/bpf/progs/bpf_iter_test_kern4.c | 4 +- .../selftests/bpf/progs/linked_maps1.c | 13 ++ .../selftests/bpf/progs/linked_maps2.c | 18 +++ .../selftests/bpf/progs/linked_vars1.c | 4 +- .../selftests/bpf/progs/linked_vars2.c | 4 +- .../selftests/bpf/progs/test_check_mtu.c | 4 +- .../selftests/bpf/progs/test_cls_redirect.c | 4 +- .../bpf/progs/test_snprintf_single.c | 2 +- .../selftests/bpf/progs/test_sockmap_listen.c | 4 +- .../selftests/bpf/progs/test_static_linked1.c | 6 +- .../selftests/bpf/progs/test_static_linked2.c | 4 +- 19 files changed, 244 insertions(+), 51 deletions(-) -- 2.30.2