From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Finishing the separation of creating a dcu/cu pair from processing it, as we'll need to add the new dcu/cu pair to the list under cus__lock(), so that we process it in order to keep a reproducible BTF encoding. Cc: Alan Maguire <alan.maguire@xxxxxxxxxx> Cc: Kui-Feng Lee <kuifeng@xxxxxx> Cc: Thomas Weißschuh <linux@xxxxxxxxxxxxxx> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> --- dwarf_loader.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dwarf_loader.c b/dwarf_loader.c index 125e361ef2bf3f7b..5090509309446890 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -3233,6 +3233,16 @@ static struct dwarf_cu *dwarf_cus__create_cu(struct dwarf_cus *dcus, Dwarf_Die * return dcu; } +static int dwarf_cus__process_cu(struct dwarf_cus *dcus, Dwarf_Die *cu_die, + struct cu *cu, void *thr_data) +{ + if (die__process_and_recode(cu_die, cu, dcus->conf) != 0 || + cus__finalize(dcus->cus, cu, dcus->conf, thr_data) == LSK__STOP_LOADING) + return DWARF_CB_ABORT; + + return DWARF_CB_OK; +} + static int dwarf_cus__create_and_process_cu(struct dwarf_cus *dcus, Dwarf_Die *cu_die, uint8_t pointer_size, void *thr_data) { @@ -3241,13 +3251,7 @@ static int dwarf_cus__create_and_process_cu(struct dwarf_cus *dcus, Dwarf_Die *c if (dcu == NULL) return DWARF_CB_ABORT; - struct cu *cu = dcu->cu; - - if (die__process_and_recode(cu_die, cu, dcus->conf) != 0 || - cus__finalize(dcus->cus, cu, dcus->conf, thr_data) == LSK__STOP_LOADING) - return DWARF_CB_ABORT; - - return DWARF_CB_OK; + return dwarf_cus__process_cu(dcus, cu_die, dcu->cu, thr_data); } static int dwarf_cus__nextcu(struct dwarf_cus *dcus, Dwarf_Die *die_mem, Dwarf_Die **cu_die, uint8_t *pointer_size, uint8_t *offset_size) -- 2.44.0