public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Add attribute to checksum for DW_FORM_implicit_const
@ 2021-02-15 12:23 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-02-15 12:23 UTC (permalink / raw)
  To: dwz, jakub; +Cc: Mark Wielaard

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);
 	    }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-15 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 12:23 [committed] Add attribute to checksum for DW_FORM_implicit_const Tom de Vries

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).