On Thu, Mar 3, 2022 at 12:54 PM Delyan Kratunov <delyank@xxxxxx> wrote: > > On Thu, 2022-03-03 at 10:52 -0800, Delyan Kratunov wrote: > > > > > > > > > > > + map_type_id = btf__find_by_name_kind(btf, > > > > bpf_map__section_name(map), BTF_KIND_DATASEC); > > > > > > if we set obj_name to "", bpf_map__name() should return ELF section > > > name here, so no need to expose this as an API > > > > > > > > > oh, but also bpf_map__btf_value_type_id() should give you this ID directly > > > > TIL, that's not obvious at all. There's a few places in gen.c that could be > > simplified then - find_type_for_map goes through slicing the complete name and > > walking over every BTF type to match on the slice. Is there some compatibility > > reason to do that or is btf_value_type_id always there? > > Unfortunately, the internal datasec maps have value_type_id = key_value_type_id > = 0 i.e. void, so bpf_map__btf_value_type_id won't work out of the box. > > I haven't looked if that's a bug all the way in clang-emitted object or > somewhere further on. Yeah, just replied in another email. We fill it out too late, but it should be possible to move it earlier into open phase. > > -- Delyan