mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 07:24:34 +00:00
de5de7b447
While looking at the remaining potential sources of instability in the generation of type ids at abixml generation time, it occurred to me that we still had several non canonicalized types in the system. When a given type T is not canonicalized, hash_as_canonical_type_or_constant later hashes it as an arbitrary constant. So in the ID hash map of the abixml writer, all the non-canonicalized types will tend to end-up in the same hash map bucket, so to speak. More precisely, if T is equivalent to another type T' which is canonicalized, then T and T' will end-up in different buckets (in the same hash map) because they will have different hash values as returned by hash_as_canonical_type_or_constant. They will thus end-up having different type-ids because they are in different buckets. The solution is to make sure that T is *also* canonicalized. That way, if T and T' are equivalent, they'll end-up in the same bucket and they will have the same type-id. In other words, all types should be canonicalized now. The only exception to that rule is declaration-only classes and unions. The reason why a declaration-only type 'struct foo' needs to stay non-canonicalized is that it must equal all the definitions of 'struct foo' that can be found elsewhere. This patch thus canonicalizes all types that were not still not being canonicalized. It also adds an assert in hash_as_canonical_type_or_constant to ensure that only declaration-only class_or_union types are not canonicalized. * include/abg-fwd.h (is_declaration_only_class_or_union_type): Declare new ... * src/abg-ir.cc (is_declaration_only_class_or_union_type): ... function. (clone_array): Add the cloned array subrange to its scope so that it can later be canonicalized. (synthesize_type_from_translation_unit) (synthesize_function_type_from_translation_unit): Canonicalize the synthesized types. (hash_as_canonical_type_or_constant): Ensure that all types are canonicalized. * src/abg-dwarf-reader.cc (maybe_canonicalize_type): Remove useless overload. (build_ir_node_for_variadic_parameter_type) (schedule_array_tree_for_late_canonicalization): Define new static functions. (maybe_strip_qualification): Schedule type canonicalization for types cloned prior to editing. (build_function_type): Use the new build_ir_node_for_variadic_parameter_type. It takes care of canonicalizing variadic parameter types. (build_function_decl): Canonicalize the function type that is created here. (build_ir_node_from_die): Use the overload of maybe_canonicalize_type which canonicalizes class_or_union nodes directly, rather than the one which handles DIE offsets. The latter was used as an optimization to reduce the size of the array of types scheduled for canonicalization, as DIE offsets take less space than pointers to IR types. Now that we have DIE de-duplication, my bet is that we can do away with the former. And that also ensures that we miss no type for canonicalization purposes. * src/abg-reader.cc (build_array_type_def): Canonicalize the subrange types of the array. (build_type): Canonicalize all types. * tests/data/test-annotate/libtest23.so.abi: Adjust. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * 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-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi: Likewise. * tests/data/test-read-dwarf/libtest23.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise. * tests/data/test-read-dwarf/test0.abi: Likewise. * tests/data/test-read-dwarf/test0.hash.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: 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. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
abg-comp-filter.h | ||
abg-comparison.h | ||
abg-config.h | ||
abg-corpus.h | ||
abg-cxx-compat.h | ||
abg-diff-utils.h | ||
abg-dwarf-reader.h | ||
abg-fwd.h | ||
abg-hash.h | ||
abg-ini.h | ||
abg-interned-str.h | ||
abg-ir.h | ||
abg-libxml-utils.h | ||
abg-libzip-utils.h | ||
abg-reader.h | ||
abg-regex.h | ||
abg-reporter.h | ||
abg-sptr-utils.h | ||
abg-suppression.h | ||
abg-tools-utils.h | ||
abg-traverse.h | ||
abg-version.h.in | ||
abg-viz-common.h | ||
abg-viz-dot.h | ||
abg-viz-svg.h | ||
abg-workers.h | ||
abg-writer.h | ||
Makefile.am |