dwarves/94a01bde592c555b3eb526aeb4c2ad695c5660d8.patch
Davide Cavalca 9bd278dc42 Backport upstream bugfixes for clang builds
Resolves: RHEL-54022

Signed-off-by: Davide Cavalca <dcavalca@centosproject.org>
2024-08-12 13:59:12 -04:00

47 lines
1.7 KiB
Diff

From 94a01bde592c555b3eb526aeb4c2ad695c5660d8 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <alan.maguire@oracle.com>
Cc: Daniel Xu <dxu@dxuuu.xyz>
Cc: Domenico Andreoli <cavok@debian.org>
Cc: Dominique Leuenberger <dimstar@opensuse.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Jan Alexander Steffens <heftig@archlinux.org>
Cc: Jan Engelhardt <jengelh@inai.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Matthias Schwarzott <zzam@gentoo.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Viktor Malik <vmalik@redhat.com>
Cc: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/all/ZnGZ71a4E29kPrvS@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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;