mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
bpf: fix perf_snapshot_branch_stack link failure
The newly added code to handle bpf_get_branch_snapshot fails to link when
CONFIG_PERF_EVENTS is disabled:
aarch64-linux-ld: kernel/bpf/verifier.o: in function `do_misc_fixups':
verifier.c:(.text+0x1090c): undefined reference to `__SCK__perf_snapshot_branch_stack'
Add a build-time check for that Kconfig symbol around the code to
remove the link time dependency.
Fixes: 314a53623c ("bpf: inline bpf_get_branch_snapshot() helper")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240405142637.577046-1-arnd@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
343ca8131c
commit
58babe2718
@@ -20191,7 +20191,8 @@ patch_map_ops_generic:
|
||||
}
|
||||
|
||||
/* Implement bpf_get_branch_snapshot inline. */
|
||||
if (prog->jit_requested && BITS_PER_LONG == 64 &&
|
||||
if (IS_ENABLED(CONFIG_PERF_EVENTS) &&
|
||||
prog->jit_requested && BITS_PER_LONG == 64 &&
|
||||
insn->imm == BPF_FUNC_get_branch_snapshot) {
|
||||
/* We are dealing with the following func protos:
|
||||
* u64 bpf_get_branch_snapshot(void *buf, u32 size, u64 flags);
|
||||
|
||||
Reference in New Issue
Block a user