selftests/bpf: Workaround for llvm nop-4 bug
authorAlexei Starovoitov <ast@kernel.org>
Tue, 22 Nov 2022 17:15:29 +0000 (09:15 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 22 Nov 2022 21:34:08 +0000 (13:34 -0800)
commitdc79f035b2062e4ff4f6432eda18f461f82b1333
tree4ab578497dc37992c6e531ab389ea507d37f4253
parent0b2971a2703c015b5737d66688c2c7c81a5e391b
selftests/bpf: Workaround for llvm nop-4 bug

Currently LLVM fails to recognize .data.* as data section and defaults to .text
section. Later BPF backend tries to emit 4-byte NOP instruction which doesn't
exist in BPF ISA and aborts.
The fix for LLVM is pending:
https://reviews.llvm.org/D138477

While waiting for the fix lets workaround the linked_list test case
by using .bss.* prefix which is properly recognized by LLVM as BSS section.

Fix libbpf to support .bss. prefix and adjust tests.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c
tools/testing/selftests/bpf/prog_tests/linked_list.c
tools/testing/selftests/bpf/progs/linked_list.h