[PATCH 1/1] DWARF reader workaround for declaration-only types
Giuliano Procida
gprocida@google.com
Tue Sep 22 11:29:21 GMT 2020
abidw sometimes unexpectedly emits types as declaration-only (often
just preserving the size information associated with full definitions
elsewhere in the corpus.
This workaround illustrates the issue (it breaks some tests).
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-dwarf-reader.cc | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 7257052e6..2ff2d0b0f 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -4808,6 +4808,23 @@ public:
cn_timer.start();
}
+ {
+ // Partition the types so that definitions appear before declarations.
+ struct Partition {
+ read_context * ctxt;
+ die_source source;
+ bool operator()(Dwarf_Off off) const
+ {
+ type_base_sptr t = ctxt->lookup_type_from_die_offset(off, source);
+ decl_base * db = dynamic_cast<decl_base *>(t.get());
+ return !db || !db->get_is_declaration_only();
+ }
+ };
+ Partition partition { this, source };
+ std::vector<Dwarf_Off>& types = types_to_canonicalize(source);
+ std::partition(types.begin(), types.end(), partition);
+ }
+
if (!types_to_canonicalize(source).empty())
{
tools_utils::timer single_type_cn_timer;
--
2.28.0.681.g6f77f65b4e-goog
More information about the Libabigail
mailing list