]> 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)
commita009defabf710be3d736c01a5ad80284f42cf928
tree4f871fd99d03f0b83e22eec3c6a26279a05cb0d6
parentc723ac5a75460b28641428940c698a5f3256a7fd
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