public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Cc: Mark Wielaard <mark@gcc.gnu.org>
Subject: [committed] Add attribute to checksum for DW_FORM_implicit_const
Date: Mon, 15 Feb 2021 13:23:14 +0100	[thread overview]
Message-ID: <20210215122313.GA26036@delia> (raw)

Hi,

In checksum_die, we handle DW_FORM_implicit_const like so:
...
       case DW_FORM_implicit_const:
         if (!handled && die->die_ck_state != CK_BAD)
           {
             handled = true;
             die->u.p1.die_hash
               = iterative_hash_object (t->values[i], die->u.p1.die_hash);
           }
...

The problem is that the attribute is not hashed in.

We could fix this by removing the "handled = true" assignment, but
generally the order is "attribute first, value second", and this fix would
do the reverse.  Consequently, identical attributes, one with form
DW_FORM_sdata and one with form DW_FORM_implicit_const would not get the same
checksum.

Fix this by locally adding hashing of the attribute, before hashing in the
value.

Committed to trunk.

Thanks,
- Tom

Add attribute to checksum for DW_FORM_implicit_const

2021-02-15  Tom de Vries  <tdevries@suse.de>

	PR dwz/27418
	* dwz.c (checksum_die): Hash in attribute for DW_FORM_implicit_const.

---
 dwz.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dwz.c b/dwz.c
index 7b528e2..17921f0 100644
--- a/dwz.c
+++ b/dwz.c
@@ -3614,6 +3614,9 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die)
 	  if (!handled && die->die_ck_state != CK_BAD)
 	    {
 	      handled = true;
+	      s = t->attr[i].attr;
+	      die->u.p1.die_hash
+		= iterative_hash_object (s, die->u.p1.die_hash);
 	      die->u.p1.die_hash
 		= iterative_hash_object (t->values[i], die->u.p1.die_hash);
 	    }

                 reply	other threads:[~2021-02-15 12:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210215122313.GA26036@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).