summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2022-02-24 10:49:43 +0100
committerDodji Seketeli <dodji@redhat.com>2022-03-03 12:44:36 +0100
commitc696400f21cf424875fb4d97cb8780d677edfa0b (patch)
tree47ca30d80ca29206e9cf5da0fb7f047e9890193d
parentBug 26646 - unexpected declaration-only types (part 2) (diff)
downloadlibabigail-c696400f21cf424875fb4d97cb8780d677edfa0b.tar.gz
libabigail-c696400f21cf424875fb4d97cb8780d677edfa0b.tar.bz2
libabigail-c696400f21cf424875fb4d97cb8780d677edfa0b.tar.xz
dwarf-reader: Don't propagate canonical type upon aggregate redundancy
This comes from trying to fix https://sourceware.org/bugzilla/show_bug.cgi?id=26646. During DIE comparison for the purpose of DIE canonicalization, we need to detect a loop due to a recurring aggregate comparison. Thus, the compare_dies function returns true in when it detects that it's comparing two aggregate that are already being compared. In that situation of "detected aggregate redundancy", even though the comparison seemingly succeeds, no canonical type propagation should happen. This patch prevents canonical type propagation when compare_dies return true to signal aggregate redundancy detection. This addresses https://sourceware.org/bugzilla/show_bug.cgi?id=26646#c21. * src/abg-dwarf-reader.cc (compare_dies): Do not propagate canonical type when aggregate redundancy is detected. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
-rw-r--r--src/abg-dwarf-reader.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index b35e6c98..dc82cf3b 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -10236,6 +10236,7 @@ compare_dies(const read_context& ctxt,
10236 return l_canonical_die_offset == r_canonical_die_offset; 10236 return l_canonical_die_offset == r_canonical_die_offset;
10237 10237
10238 bool result = true; 10238 bool result = true;
10239 bool aggregate_redundancy_detected = false;
10239 10240
10240 switch (l_tag) 10241 switch (l_tag)
10241 { 10242 {
@@ -10349,7 +10350,11 @@ compare_dies(const read_context& ctxt,
10349 { 10350 {
10350 if (has_offset_pair(aggregates_being_compared, 10351 if (has_offset_pair(aggregates_being_compared,
10351 die_offset(l), die_offset(r))) 10352 die_offset(l), die_offset(r)))
10352 result = true; 10353 {
10354 result = true;
10355 aggregate_redundancy_detected = true;
10356 break;
10357 }
10353 else if (!compare_as_decl_dies(l, r) || !compare_as_type_dies(l, r)) 10358 else if (!compare_as_decl_dies(l, r) || !compare_as_type_dies(l, r))
10354 result = false; 10359 result = false;
10355 else 10360 else
@@ -10477,6 +10482,7 @@ compare_dies(const read_context& ctxt,
10477 die_offset(r))) 10482 die_offset(r)))
10478 { 10483 {
10479 result = true; 10484 result = true;
10485 aggregate_redundancy_detected = true;
10480 break; 10486 break;
10481 } 10487 }
10482 else if (l_tag == DW_TAG_subroutine_type) 10488 else if (l_tag == DW_TAG_subroutine_type)
@@ -10672,6 +10678,7 @@ compare_dies(const read_context& ctxt,
10672 } 10678 }
10673 10679
10674 if (result == true 10680 if (result == true
10681 && !aggregate_redundancy_detected
10675 && update_canonical_dies_on_the_fly 10682 && update_canonical_dies_on_the_fly
10676 && is_canonicalizeable_type_tag(l_tag)) 10683 && is_canonicalizeable_type_tag(l_tag))
10677 { 10684 {