On Thu, 2024-06-13 at 10:50 +0100, Alan Maguire wrote: > Map distilled base BTF type ids referenced in split BTF and their > references to the base BTF passed in, and if the mapping succeeds, > reparent the split BTF to the base BTF. > > Relocation is done by first verifying that distilled base BTF > only consists of named INT, FLOAT, ENUM, FWD, STRUCT and > UNION kinds; then we sort these to speed lookups. Once sorted, > the base BTF is iterated, and for each relevant kind we check > for an equivalent in distilled base BTF. When found, the > mapping from distilled -> base BTF id and string offset is recorded. > In establishing mappings, we need to ensure we check STRUCT/UNION > size when the STRUCT/UNION is embedded in a split BTF STRUCT/UNION, > and when duplicate names exist for the same STRUCT/UNION. Otherwise > size is ignored in matching STRUCT/UNIONs. > > Once all mappings are established, we can update type ids > and string offsets in split BTF and reparent it to the new base. > > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > --- Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> [...]