bpftool: Skip pieces of variables in DATASEC
The kernel accepts a variable in DATASEC that is smaller than its type. It's a piece of a variable that the compiler split, with the type of the whole variable. bpftool prints a variable by its type, so it reads past the piece and, when the piece is the last in the section, past the buffer with the value of the map: $ bpftool map dump pinned /sys/fs/bpf/piece ".bss": [{ "whole": 67305985 },{ "piece.0": { "a": [134678021,1994496712,32592,32,0,833,0,414764080 Only the first number is in the map. Skip the pieces in btf_dumper_datasec(), like btf_datasec_show() in the kernel does, and in show_prog_metadata(). Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20261002124714.180012-11-alexei.starovoitov@gmail.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>