]> git.baikalelectronics.ru Git - kernel.git/commit
bpftool: Improve skeleton generation for data maps without DATASEC type
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 21 Oct 2021 01:44:00 +0000 (18:44 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 22 Oct 2021 00:10:10 +0000 (17:10 -0700)
commit5ebd6ca7b28dccdc4fc4d531fce8c38fe612f466
treee06f4ed73f3d525fefaf1dca390db07a09332cbd
parent17d82768172f9c5f27d9606c82fc656908a32119
bpftool: Improve skeleton generation for data maps without DATASEC type

It can happen that some data sections (e.g., .rodata.cst16, containing
compiler populated string constants) won't have a corresponding BTF
DATASEC type. Now that libbpf supports .rodata.* and .data.* sections,
situation like that will cause invalid BPF skeleton to be generated that
won't compile successfully, as some parts of skeleton would assume
memory-mapped struct definitions for each special data section.

Fix this by generating empty struct definitions for such data sections.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20211021014404.2635234-7-andrii@kernel.org
tools/bpf/bpftool/gen.c