[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] [multi-file] Handle DW_FORM_ref_addr reference that points to containing unit



[ Submitted earlier off-list ]

Hi,

For test-cases with DW_FORM_ref_addr attributes that point to within the CU
containing the attribute, we run into the following assert in multifile mode:
...
dwz: dwz.c:1984: checksum_die: Assertion `
  ((!op_multifile && !rd_multifile && !fi_multifile) || cu != die_cu (ref))
  && (!op_multifile || cu->cu_chunk == die_cu (ref)->cu_chunk)
  ' failed.
...

This conservative fix detects the situation, and instead of asserting stops
further processing of the DIE.

OK for trunk?

Thanks,
- Tom

[multi-file] Handle DW_FORM_ref_addr reference that points to containing unit

2019-02-05  Tom de Vries  <tdevries@suse.de>

	PR dwz/24170
	* dwz.c (checksum_die): Handle DW_FORM_ref_addr references that points
	to containing unit conservatively.

---
 dwz.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dwz.c b/dwz.c
index 4ef8657..0415630 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1979,10 +1979,13 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die)
 		}
 	      if (unlikely (op_multifile) && ref->die_collapsed_child)
 		ref = ref->die_parent;
-	      assert (((!op_multifile && !rd_multifile && !fi_multifile)
-		       || cu != die_cu (ref))
-		      && (!op_multifile
-			  || cu->cu_chunk == die_cu (ref)->cu_chunk));
+	      if (cu == die_cu (ref))
+		{
+		  die->die_ck_state = CK_BAD;
+		  return 0;
+		}
+	      assert (!op_multifile
+		      || cu->cu_chunk == die_cu (ref)->cu_chunk);
 	      handled = true;
 	      break;
 	    }