mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-08 01:31:37 +00:00
Bug 26297: Possible misinterpretation of DW_AT_declaration via DW_AT_specification A DIE representing a definition can refer to the DIE that represents the matching declaration by using the DW_AT_specification attribute. A similar situation exists for a cloned entity (like a cloned variable or function) where the DW_AT_abstract_origin points to the original entity. Usually, to get the union of the attributes for a given definition DIE, we also need to gather the attributes carried by the declaration (or original) DIE accompanying the current definition DIE. For the "is_declaration" attribute however, we should only look at the current (definition) DIE at hand. Said otherwise, we should not follow declaration/origin link when we want to know if a given entity is declaration-only. Thus, this commit causes the DWARF reader to only consider a DIE to be "declaration only" if all DIEs in the chain leading to it have the DW_AT_declaration attribute set. It is a follow-up commit to a change making die_is_declaration_only examine just the immediate DIE. The responsibility of tracking the cumulative declaration-only status of DIEs falls on build_ir_node_from_die which is the function that makes recursive calls to itself on encountering a DW_AT_specification or DW_AT_abstract_origin link. Various other functions that would have previously called die_is_declaration_only are modified so that get the cumulative value for this flag, rather than just examing the DIE they are given. This change eliminates a lot of spurious declaration-only types in ABI output and may also prevent the same, particularly when anonymous, from confusing libabigail's type equality and canonicalisation logic. * src/abg-dwarf-reader.cc (add_or_update_class_type): Add an is_declaration_only argument. Use this in favour of the die_is_declaration_only helper function. (add_or_update_union_type): Ditto. (function_is_suppressed): Ditto. (build_or_get_fn_decl_if_not_suppressed): Ditto. (build_enum_type): Ditto. (build_ir_node_from_die): To the main overload, add is_declaration_only argument and default this to true. Update this to false if the given DIE is not declaration only and pass this on in recusrive calls and calls to build_enum_type, add_or_update_union_type, add_or_update_class_type and build_or_get_fn_decl_if_not_suppressed. * tests/data/test-annotate/test17-pr19027.so.abi: Update test. This is mostly the removal of is-declaration-only attributes, removal of unreachable parts of the type graph and type id renumbering. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
data | ||
lib | ||
.gitignore | ||
Makefile.am | ||
mockfedabipkgdiff.in | ||
print-diff-tree.cc | ||
runtestcanonicalizetypes.sh.in | ||
runtestdefaultsupprs.py.in | ||
runtestdefaultsupprspy3.sh.in | ||
runtestfedabipkgdiff.py.in | ||
runtestfedabipkgdiffpy3.sh.in | ||
test-abicompat.cc | ||
test-abidiff-exit.cc | ||
test-abidiff.cc | ||
test-alt-dwarf-file.cc | ||
test-annotate.cc | ||
test-core-diff.cc | ||
test-cxx-compat.cc | ||
test-diff2.cc | ||
test-diff-dwarf-abixml.cc | ||
test-diff-dwarf.cc | ||
test-diff-filter.cc | ||
test-diff-pkg.cc | ||
test-diff-suppr.cc | ||
test-dot.cc | ||
test-elf-helpers.cc | ||
test-ini.cc | ||
test-ir-walker.cc | ||
test-kmi-whitelist.cc | ||
test-lookup-syms.cc | ||
test-read-dwarf.cc | ||
test-read-write.cc | ||
test-svg.cc | ||
test-symtab.cc | ||
test-tools-utils.cc | ||
test-types-stability.cc | ||
test-utils.cc | ||
test-utils.h | ||
test-valgrind-suppressions.supp | ||
test-write-read-archive.cc | ||
update-test-output.py |