Adds two empty functions to linked_funcs[12].c. The functions are annotated as "naked" and go to a separate section. This section ends up having size 0. bpftool linker merges content for sections with identical names. This tests if it can handle empty sections. Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx> --- tools/testing/selftests/bpf/progs/linked_funcs1.c | 3 +++ tools/testing/selftests/bpf/progs/linked_funcs2.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/linked_funcs1.c b/tools/testing/selftests/bpf/progs/linked_funcs1.c index c4b49ceea967..029bb5022ba2 100644 --- a/tools/testing/selftests/bpf/progs/linked_funcs1.c +++ b/tools/testing/selftests/bpf/progs/linked_funcs1.c @@ -86,4 +86,7 @@ int BPF_PROG(handler1, struct pt_regs *regs, long id) return 0; } +SEC(".empty_section") +__naked void empty_function1(void) {} + char LICENSE[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/bpf/progs/linked_funcs2.c b/tools/testing/selftests/bpf/progs/linked_funcs2.c index 013ff0645f0c..4547c8dfc689 100644 --- a/tools/testing/selftests/bpf/progs/linked_funcs2.c +++ b/tools/testing/selftests/bpf/progs/linked_funcs2.c @@ -86,4 +86,7 @@ int BPF_PROG(handler2, struct pt_regs *regs, long id) return 0; } +SEC(".empty_section") +__naked void empty_function2(void) {} + char LICENSE[] SEC("license") = "GPL"; -- 2.40.0