On Tue, Jan 19, 2021 at 7:35 AM Yonghong Song <yhs@xxxxxx> wrote: > When loading the ./test.o to the kernel with bpftool, > we see the following error: > libbpf: Error loading BTF: Invalid argument(22) > libbpf: magic: 0xeb9f > ... > [6] ARRAY (anon) type_id=5 index_type_id=7 nr_elems=4 > [7] INT __ARRAY_SIZE_TYPE__ size=4 bits_offset=0 nr_bits=32 encoding=(none) > [8] VAR _license type_id=6 linkage=1 > [9] DATASEC .rodata size=24 vlen=0 vlen == 0 > libbpf: Error loading .BTF into kernel: -22. BTF is optional, ignoring. > > Basically, libbpf changed .rodata datasec size to 24 since elf .rodata > section size is 24. The kernel then rejected the BTF since vlen = 0. > Note that the above kernel verifier failure can be worked around with > changing local variable "fmt" to a static or global, optionally const, variable. > > This patch permits a datasec with vlen = 0 in kernel. > > Signed-off-by: Yonghong Song <yhs@xxxxxx> Applied. Thanks