diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-04-08 20:15:48 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-04-10 14:03:12 -0700 |
commit | b1c2ce11d42886d08cfa28e38ee07f2b606ced0b (patch) | |
tree | 9ef005b821557497573639effbb565b93958d101 /tools/testing/selftests/net/Makefile | |
parent | fc50c698c28bcf307dfb14ba9d0b3cacb091c1cb (diff) | |
download | linux-b1c2ce11d42886d08cfa28e38ee07f2b606ced0b.tar.gz linux-b1c2ce11d42886d08cfa28e38ee07f2b606ced0b.tar.bz2 linux-b1c2ce11d42886d08cfa28e38ee07f2b606ced0b.zip |
selftests: net: declare section names for bpf_offload
Non-ancient ip (iproute2-5.15.0, libbpf 0.7.0) refuses to load
the sample with maps because we don't generate BTF:
libbpf: BTF is required, but is missing or corrupted.
ERROR: opening BPF object file failed
Enable BTF by adding -g to clang flags. With that done
neither of the programs load:
libbpf: prog 'func': error relocating .BTF.ext function info: -22
libbpf: prog 'func': failed to relocate calls: -22
libbpf: failed to load object 'ksft-net-drv/net/sample_ret0.bpf.o'
Andrii explains that this is because we don't specify
section names for the code. Add the section names, too.
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Stanislav Fomichev <sdf@google.com>
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240409031549.3531084-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/Makefile')
-rw-r--r-- | tools/testing/selftests/net/Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index e8bfa715aa49..a3c781cb8367 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -149,7 +149,8 @@ BPF_PROG_OBJS := $(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o \ $(OUTPUT)/sample_map_ret0.bpf.o $(OUTPUT)/sample_ret0.bpf.o $(BPF_PROG_OBJS): $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS) - $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@ + $(CLANG) -O2 -g --target=bpf $(CCINCLUDE) $(CLANG_SYS_INCLUDES) \ + -c $< -o $@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \ $(APIDIR)/linux/bpf.h \ |