From 94a01bde592c555b3eb526aeb4c2ad695c5660d8 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 18 Jun 2024 11:14:09 -0300 Subject: [PATCH] dwarf_loader: Add missing cus__add(cus, cu) to cus__merge_and_process_cu() In cus__finalize() if cu__finalize() returns LSK__DELETE, i.e. if the tool processing the cu is done with it, we will assume that it is in the cus list of cu instances, remove it and then delete it. This was not being done by cus__merge_and_process_cu(), used when merging all DWARF CUs into a single 'struct cu', such as when processing binaries generated by clang using LTO. Add the missing cus__add() to keep cus->nr_entries consistent. Cc: Alan Maguire Cc: Daniel Xu Cc: Domenico Andreoli Cc: Dominique Leuenberger Cc: Eduard Zingerman Cc: Jan Alexander Steffens Cc: Jan Engelhardt Cc: Jiri Olsa Cc: Matthias Schwarzott Cc: Nathan Chancellor Cc: Viktor Malik Cc: Yonghong Song Link: https://lore.kernel.org/all/ZnGZ71a4E29kPrvS@x1 Signed-off-by: Arnaldo Carvalho de Melo --- dwarf_loader.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dwarf_loader.c b/dwarf_loader.c index b832c93c..3caf3245 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -3452,6 +3452,7 @@ static int cus__merge_and_process_cu(struct cus *cus, struct conf_load *conf, cu->priv = dcu; cu->dfops = &dwarf__ops; cu->language = attr_numeric(cu_die, DW_AT_language); + cus__add(cus, cu); } Dwarf_Die child;