]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Add CO-RE relos and SEC("?...") to linked_funcs selftests
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 26 Apr 2022 00:45:06 +0000 (17:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 26 Apr 2022 22:41:46 +0000 (15:41 -0700)
commit06e56330e0c8f669d1073274fc1215de3d3de64a
tree4f871fd99d03f0b83e22eec3c6a26279a05cb0d6
parent0f28e185047ee604fc7753ab68ee3f4d88d36e99
selftests/bpf: Add CO-RE relos and SEC("?...") to linked_funcs selftests

Enhance linked_funcs selftest with two tricky features that might not
obviously work correctly together. We add CO-RE relocations to entry BPF
programs and mark those programs as non-autoloadable with SEC("?...")
annotation. This makes sure that libbpf itself handles .BTF.ext CO-RE
relocation data matching correctly for SEC("?...") programs, as well as
ensures that BPF static linker handles this correctly (this was the case
before, no changes are necessary, but it wasn't explicitly tested).

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220426004511.2691730-6-andrii@kernel.org
tools/testing/selftests/bpf/prog_tests/linked_funcs.c
tools/testing/selftests/bpf/progs/linked_funcs1.c
tools/testing/selftests/bpf/progs/linked_funcs2.c