]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n
authorYonghong Song <yhs@fb.com>
Wed, 7 Oct 2020 06:29:33 +0000 (23:29 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 7 Oct 2020 17:56:46 +0000 (10:56 -0700)
commit5fa3a2c80d50f460277963e6b395381a32e82861
tree8028dc44eb4e6885ee4f009c40a14cc69fa5fbba
parent37c326d4644624fc2fa7deed6a839b0c2652ff54
bpf: Fix build failure for kernel/trace/bpf_trace.c with CONFIG_NET=n

When CONFIG_NET is not defined, I hit the following build error:
    kernel/trace/bpf_trace.o:(.rodata+0x110): undefined reference to `bpf_prog_test_run_raw_tp'

Commit ad35d2e77169 ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint")
added test_run support for raw_tracepoint in /kernel/trace/bpf_trace.c.
But the test_run function bpf_prog_test_run_raw_tp is defined in
net/bpf/test_run.c, only available with CONFIG_NET=y.

Adding a CONFIG_NET guard for
    .test_run = bpf_prog_test_run_raw_tp;
fixed the above build issue.

Fixes: ad35d2e77169 ("bpf: Enable BPF_PROG_TEST_RUN for raw_tracepoint")
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201007062933.3425899-1-yhs@fb.com
kernel/trace/bpf_trace.c