On Fri, Feb 2, 2024 at 4:58 PM Bryce Kahle <git@xxxxxxxxxxxxxx> wrote: > > On Fri, Feb 2, 2024, at 2:10 PM, Andrii Nakryiko wrote: > > > > Maybe the right solution is to concat vmlinux and all the relevant > > module BTFs first, dedup it again, then minimize against that "super > > BTF". But yes, you'd have to specify both vmlinux and all the module > > BTFs at the same time (which bpftool allows you to do easily with its > > CLI interface, so not really a problem) > > > > How would you handle the Type ID conflicts between the modules, since they all start at vmlinux+1? Is there a danger of conflicting type names, where there are two types with the same name but different layouts? The sequence would be: 1) create BTF instance from vmlinux BTF 2) append each module BTF to that instance (we have btf__add_btf() API already for that). This will rewrite type IDs for each module (shifting them by some constant number) 3) btf__dedup() will deduplicate everything, so that only unique type definitions remain. > > I was trying to mirror the sysfs file layout, so a loader didn't have different behavior between user-supplied BTF and kernel-provided BTF.