Re: [PATCH v13 bpf-next 3/8] libbpf: use layout to compute an unknown kind size
Andrii Nakryiko <[email protected]>
| Newsgroups | org.kernel.vger.dwarves,org.kernel.vger.bpf |
|---|---|
| Message-ID | <CAEf4BzYQGh1=EJkewD9wSyTawvwxTFJ9ODy-PFVHeuP59ATBQA@mail.gmail.com> |
On Fri, Mar 6, 2026 at 3:37 AM Alan Maguire <[email protected]> wrote: > > This allows BTF parsing to proceed even if we do not know the > kind. Fall back to base BTF layout if layout information is > not in split BTF. > > Signed-off-by: Alan Maguire <[email protected]> > --- > tools/lib/bpf/btf.c | 42 +++++++++++++++++++++++++++++++++--------- > 1 file changed, 33 insertions(+), 9 deletions(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index ae13f9f4df08..9f4d1bd73b4d 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -356,7 +356,32 @@ static int btf_parse_layout_sec(struct btf *btf) > return 0; > } > > -static int btf_type_size(const struct btf_type *t) > +/* for unknown kinds, consult kind layout. */ > +static int btf_type_size_unknown(const struct btf *btf, const struct btf_type *t) > +{ > + __u32 layout_kinds = btf->hdr.layout_len / sizeof(struct btf_layout); (give you are going to resubmit anyways) nit: l_cnt or something? layout_kinds sounds like it actually contains a content > + struct btf_layout *l = btf->layout; > + __u16 vlen = btf_vlen(t); > + __u32 kind = btf_kind(t); > + [...]