| Message ID | 20250918120424.418-2-oleg.tolmatcev@gmail.com |
|---|---|
| State | New |
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 043873858C30 for <patchwork@sourceware.org>; Thu, 18 Sep 2025 12:05:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 043873858C30 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=hXzqY0ik X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 736F73858C66 for <binutils@sourceware.org>; Thu, 18 Sep 2025 12:04:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 736F73858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 736F73858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758197089; cv=none; b=bmCG5+O3Qdw+8FutfBhWtHyc74HHrwIcTHwTe0qX9ZoqaevYwYvFcBW+0YeMdykuXG4AzoE5Kyypi8mL/4zgeoTYphtHHhziCf4PIxkzq+YUzNGQsmahp8949VIgvS8Fc3ZEPgekmVhZ2kushqnYydSUCQgWxwDhDLOJNdhWJdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758197089; c=relaxed/simple; bh=8G1YR8l7W4ijHgVrFSS0iU6hhYPxLbYw7tP57W3gTzU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IzHoLtWItxeoR+jfOt4WuwtOv9PqF8GLFicCHDrNEieT0QDeYR5sajkmNRxUCBRuCNcTEXYqTiyKu3gosFklLsUYG5lq6TVPxROBpXX3E+IJJmwDbzQIW+2WJsYMUHRKngdxK4/VTD4nd3EMr7grjX6eEiVZxjHwl2CefBtEqAo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 736F73858C66 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-45f29dd8490so7756015e9.1 for <binutils@sourceware.org>; Thu, 18 Sep 2025 05:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758197088; x=1758801888; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=372Oh8sGlQBEMS1m/swluleOdtodKaYvebZ0L4Bxg9Q=; b=hXzqY0ik+yJtYRYP9H3kJnfaethegh2IQKpEIyFCB9BLQBFaIQKSlv19ta0Rlt01sk 8jzdpLxgYZkFjR6hehqfwSkUitOUfuVoiFQlwRv2evKUNVwwxYtxw3wPRoUFS7/v6BBd eayDirW85vKPk4oa/zdUPXh9H5cizQwdteeRklJBNH7j4C4aLHeZTTsAvrEFUIAX3PrF JSaCbAgx53BOKA51mTRAc4/05JKa0xlBvc8+OeCNDxrJ6B4zY763EQGtYbeG4tvlSmBV F2cVMzed9OKiwvkXJdq4TayQXbDVeuSbSF7B/dGLp+jIcGJoaW1pkKOwbY792VBKruNb 6ZgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758197088; x=1758801888; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=372Oh8sGlQBEMS1m/swluleOdtodKaYvebZ0L4Bxg9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RahOA== X-Received: by 2002:a05:600c:1912:b0:45f:2843:e76b with SMTP id 5b1f17b1804b1-46202175cbdmr47817235e9.2.1758197087736; Thu, 18 Sep 2025 05:04:47 -0700 (PDT) Received: from B450M-PRO-VDH-MAX (p200300ed8f217500f92ee72a165e296a.dip0.t-ipconnect.de. [2003:ed:8f21:7500:f92e:e72a:165e:296a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-464f5a285efsm43901015e9.18.2025.09.18.05.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Sep 2025 05:04:47 -0700 (PDT) From: oltolm <oleg.tolmatcev@gmail.com> To: binutils@sourceware.org Cc: oltolm <oleg.tolmatcev@gmail.com> Subject: [PATCH] dwarf: properly update all_comp_units_without_ranges in stash_comp_unit Date: Thu, 18 Sep 2025 14:04:25 +0200 Message-ID: <20250918120424.418-2-oleg.tolmatcev@gmail.com> X-Mailer: git-send-email 2.51.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
dwarf: properly update all_comp_units_without_ranges in stash_comp_unit
|
|
Commit Message
Oleg Tolmatcev
Sept. 18, 2025, 12:04 p.m. UTC
each->next_unit_without_ranges = file->all_comp_units_without_ranges;
- file->all_comp_units_without_ranges = each->next_unit_without_ranges;
The second line of this code is probably a bug because it does nothing. It
was probably supposed to update "file->all_comp_units_without_ranges" to point
to "each" - the new head of the list.
Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
---
bfd/dwarf2.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On 18.09.2025 14:04, oltolm wrote: > each->next_unit_without_ranges = file->all_comp_units_without_ranges; > - file->all_comp_units_without_ranges = each->next_unit_without_ranges; > > The second line of this code is probably a bug because it does nothing. It > was probably supposed to update "file->all_comp_units_without_ranges" to point > to "each" - the new head of the list. I agree, yet ... > --- a/bfd/dwarf2.c > +++ b/bfd/dwarf2.c > @@ -5635,17 +5635,19 @@ stash_comp_unit (struct dwarf2_debug *stash, struct dwarf2_debug_file *file) > (splay_tree_value)each); > > if (file->all_comp_units) > - file->all_comp_units->prev_unit = each; > + { > + file->all_comp_units->prev_unit = each; > + each->next_unit = file->all_comp_units; > + } > else > file->last_comp_unit = each; > > - each->next_unit = file->all_comp_units; > file->all_comp_units = each; ... why this part of the change? The original code was correct afaics, while the new code is correct only as long as what each points to starts out zero- initialized (which right now it does, but which we may better not depend upon here when it's easy to avoid such a dependency). > if (each->arange.high == 0) > { > each->next_unit_without_ranges = file->all_comp_units_without_ranges; > - file->all_comp_units_without_ranges = each->next_unit_without_ranges; > + file->all_comp_units_without_ranges = each; > } As I assume the patch will need committing on your behalf, I could easily reduce it to just this part while committing, provided you agree. Jan
Am Do., 18. Sept. 2025 um 16:40 Uhr schrieb Jan Beulich <jbeulich@suse.com>: > ... why this part of the change? The original code was correct afaics, while > the new code is correct only as long as what each points to starts out zero- > initialized (which right now it does, but which we may better not depend upon > here when it's easy to avoid such a dependency). I made this change when trying to understand the code. Feel free to drop it. > > if (each->arange.high == 0) > > { > > each->next_unit_without_ranges = file->all_comp_units_without_ranges; > > - file->all_comp_units_without_ranges = each->next_unit_without_ranges; > > + file->all_comp_units_without_ranges = each; > > } > > As I assume the patch will need committing on your behalf, I could easily > reduce it to just this part while committing, provided you agree. I agree, thank you.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index a62c952374..ab01958281 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -5635,17 +5635,19 @@ stash_comp_unit (struct dwarf2_debug *stash, struct dwarf2_debug_file *file) (splay_tree_value)each); if (file->all_comp_units) - file->all_comp_units->prev_unit = each; + { + file->all_comp_units->prev_unit = each; + each->next_unit = file->all_comp_units; + } else file->last_comp_unit = each; - each->next_unit = file->all_comp_units; file->all_comp_units = each; if (each->arange.high == 0) { each->next_unit_without_ranges = file->all_comp_units_without_ranges; - file->all_comp_units_without_ranges = each->next_unit_without_ranges; + file->all_comp_units_without_ranges = each; } file->info_ptr += length;