[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210422014556.3451936-1-andrii@kernel.org>
Date: Wed, 21 Apr 2021 18:45:50 -0700
From: Andrii Nakryiko <andrii@...nel.org>
To: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>,
<daniel@...earbox.net>
CC: <andrii@...nel.org>, <kernel-team@...com>
Subject: [PATCH bpf-next 0/6] BPF static linker: support static vars and maps
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=468825
Andrii Nakryiko (6):
selftests/bpf: document latest Clang fix expectations for linking
tests
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 | 38 +++---
tools/lib/bpf/libbpf.c | 7 +-
tools/lib/bpf/libbpf.h | 12 +-
tools/lib/bpf/linker.c | 121 +++++++++++++++++-
tools/testing/selftests/bpf/README.rst | 9 ++
.../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 +-
20 files changed, 251 insertions(+), 51 deletions(-)
--
2.30.2
Powered by blists - more mailing lists