On Fri, 2024-11-22 at 10:08 -0800, Eduard Zingerman wrote: [...] > So I assumed that this is hacky but not that bad. > Given that current patch depends on implementation details it is > probably better to switch to one of the alternatives: > a. allocate new Elf_Data object using elf_newdata() API; > b. just allocate a fake instance of Elf_Data on stack in btf_encoder__tag_kfuncs(). > > (a) seems to be an Ok option, wdyt? Meh, any of these raise some questions about validity of API usage. I'll just add a custom wrapper: struct converted_elf_data { void *d_buf; size_t d_size; size_t d_off; bool owns_buf; }; [...]