Add a function pointer to conf_load, which is called immediately after Elf is extracted from Dwfl_Module in cus__proces_dwflmod. This is a preparation for making elf_functions table shared between encoders. Shared table can be built as soon as the relevant Elf is available. Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxx> Link: https://lore.kernel.org/dwarves/20241128012341.4081072-5-ihor.solodrai@xxxxx/ --- dwarf_loader.c | 6 ++++++ dwarves.h | 1 + 2 files changed, 7 insertions(+) diff --git a/dwarf_loader.c b/dwarf_loader.c index 598fde4..bd65c56 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -3826,6 +3826,12 @@ static int cus__process_dwflmod(Dwfl_Module *dwflmod, Dwarf *dw = dwfl_module_getdwarf(dwflmod, &dwbias); int err = DWARF_CB_OK; + if (parms->conf->pre_load_module) { + err = parms->conf->pre_load_module(dwflmod, elf); + if (err) + return DWARF_CB_ABORT; + } + if (dw != NULL) { ++parms->nr_dwarf_sections_found; err = cus__load_module(cus, parms->conf, dwflmod, dw, elf, diff --git a/dwarves.h b/dwarves.h index 1cb0d62..d516d52 100644 --- a/dwarves.h +++ b/dwarves.h @@ -107,6 +107,7 @@ struct conf_load { struct conf_fprintf *conf_fprintf; int (*threads_prepare)(struct conf_load *conf, int nr_threads, void **thr_data); int (*threads_collect)(struct conf_load *conf, int nr_threads, void **thr_data, int error); + int (*pre_load_module)(Dwfl_Module *mod, Elf *elf); }; /** struct conf_fprintf - hints to the __fprintf routines -- 2.47.1