From patchwork Tue Jun 18 14:30:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 13702466 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACF3E143722; Tue, 18 Jun 2024 14:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718721011; cv=none; b=cQmlTUYCTXJo7U/673hVBLBvJIK1X02+QzOazjSXzEjk9QLf9P9eW/92groFWKt4Sjqib8SuciEv0LEAOKFeVCKoEWPuJiY+oYTwaE7lHfkTDa+UKTFFzyzbHxrWbqfs4IpW062y75hz6YPKe5brW8sfsMgdazILz2a8I2ZX8vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718721011; c=relaxed/simple; bh=TM69GXsRpsgu4g/uBzlfWRyyvsHdvl4/BPKSHavtFl8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OImGMp6GWmOMjzeM7fV/UzSz5pNkqD9EOuW/hHMGcRpYyQ84BPeuC1Ilw3UoImIBf6AcHyjop0k4Al14cmJQpAZQJdmtxb+ZnrZtC3zk1U3v14bgDHskV3hBsIdFT45j9QpEG1siWJ9xYlGtShX1YtG8sY+YO7szFLMj1MpsxlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YtcHG/1U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YtcHG/1U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98B0DC4AF1C; Tue, 18 Jun 2024 14:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718721011; bh=TM69GXsRpsgu4g/uBzlfWRyyvsHdvl4/BPKSHavtFl8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YtcHG/1US+LXxj3l6SMLVJDzIvDPYcd5xzwXFJl62sApms7zHFBElbICEOXMEuaef uFv/gOnzwgjrKSlDEp1SPjTynSXii5lZ8dpZ5d1ld/14Ty4V9nSY/lSGxyixS1Q6XE k2m59fxmhUMS3x5SOvdWzHJwhXm5tP3X+/0TX/ytr8K1KizQtEo5hQL6oTDR/YiJ/O vjVJjBDmr4Txh3qlM3C2mc1jmAlSOb9jcmmEQlAoX92iE1rFl4UzVKTORTYjpjeZCR hJV9+aU+KHJF00By89j2iBlXJDfaUipJM/k2q1VdDiPXpB9TR13jLZdguF0Dd+TIar A9CQawUYpRDMQ== Date: Tue, 18 Jun 2024 11:30:07 -0300 From: Arnaldo Carvalho de Melo To: Nathan Chancellor Cc: dwarves@vger.kernel.org, Linux Kernel Mailing List , bpf@vger.kernel.org, Alan Maguire , Jiri Olsa , Jan Engelhardt , Matthias Schwarzott , Viktor Malik , Eduard Zingerman , Jan Alexander Steffens , Domenico Andreoli , Dominique Leuenberger , Daniel Xu , Yonghong Song , llvm@lists.linux.dev Subject: [PATCH fyi 1/1] dwarf_loader: Add missing cus__add(cus, cu) to cus__merge_and_process_cu() Message-ID: References: <20240613214019.GA1423015@thelio-3990X> <20240617210810.GA1877676@thelio-3990X> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Just FYI, I added this on top of the previous one initializing cu->node. Tested with that cast_common.ko and the vmlinux you made available. - Arnaldo --- 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. 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 b832c93cc2194eaf..3caf32457f42ec2e 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;