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)
commitb82bb1ffbb9a20032853ef4e0d5b8f37c6ae7c25
tree4f871fd99d03f0b83e22eec3c6a26279a05cb0d6
parent11d5daa89254ba2233d422777d52dbf24666b280
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