mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 17:02:17 +00:00
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 <[email protected]> Acked-by: Stanislav Fomichev <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
11 lines
224 B
C
11 lines
224 B
C
/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
|
|
|
|
#define SEC(name) __attribute__((section(name), used))
|
|
|
|
/* Sample program which should always load for testing control paths. */
|
|
SEC("xdp")
|
|
int func()
|
|
{
|
|
return 0;
|
|
}
|