On Tue, 2024-05-28 at 13:24 +0100, Alan Maguire wrote: > Share relocation implementation with the kernel. As part of this, > we also need the type/string visitation functions so add them to a > btf_common.c file that also gets shared with the kernel. Relocation > code in kernel and userspace is identical save for the impementation > of the reparenting of split BTF to the relocated base BTF and > retrieval of BTF header from "struct btf"; these small functions > need separate user-space and kernel implementations. > > One other wrinkle on the kernel side is we have to map .BTF.ids in > modules as they were generated with the type ids used at BTF encoding > time. btf_relocate() optionally returns an array mapping from old BTF > ids to relocated ids, so we use that to fix up these references where > needed for kfuncs. > > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > --- I think we also need a test or a few tests to verify that ID sets are converted correctly. Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>