Commit Graph

4 Commits

Author SHA1 Message Date
Dodji Seketeli
bf6fae3a52 Bump abixml version to 2.3
An older version of libabigail won't be able to grok new abixml files
containing the recently added support for pointer-to-member types.

It's thus needed to bump the minor version number of the abixml
format.  The new version is thus 2.3.  As a result, this patch also
updates the version numbers shown in the various abixml files of the
test suite.

	* configure.ac: Bump ABIXML_VERSION_MINOR to 3.
	* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi:
	Adjust.
	* tests/data/test-annotate/libtest23.so.abi: Likewise
	* 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/test-anonymous-members-0.o.abi:
	Likewise
	* tests/data/test-annotate/test-pointer-to-member-1.o.annotated.abi:
	Likewise
	* tests/data/test-annotate/test0.abi: Likewise
	* tests/data/test-annotate/test1.abi: Likewise
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise
	* tests/data/test-annotate/test14-pr18893.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/test2.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-annotate/test3.so.abi: Likewise
	* tests/data/test-annotate/test4.so.abi: Likewise
	* tests/data/test-annotate/test5.o.abi: Likewise
	* tests/data/test-annotate/test6.so.abi: Likewise
	* tests/data/test-annotate/test7.so.abi: Likewise
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
	Likewise
	* tests/data/test-read-btf/test0.o.abi: Likewise
	* tests/data/test-read-btf/test1.o.abi: Likewise
	* tests/data/test-read-ctf/PR27700/test-PR27700.abi: Likewise
	* tests/data/test-read-ctf/test-PR26568-1.o.abi: Likewise
	* tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise
	* tests/data/test-read-ctf/test-alias.o.abi: Likewise
	* tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi:
	Likewise
	* tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi:
	Likewise
	* tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise
	* tests/data/test-read-ctf/test-array-mdimension.abi: Likewise
	* tests/data/test-read-ctf/test-array-of-pointers.abi: Likewise
	* tests/data/test-read-ctf/test-array-size.abi: Likewise
	* tests/data/test-read-ctf/test-bitfield-enum.abi: Likewise
	* tests/data/test-read-ctf/test-bitfield.abi: Likewise
	* tests/data/test-read-ctf/test-callback.abi: Likewise
	* tests/data/test-read-ctf/test-callback2.abi: Likewise
	* tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi:
	Likewise
	* tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi:
	Likewise
	* tests/data/test-read-ctf/test-const-array.abi: Likewise
	* tests/data/test-read-ctf/test-dynamic-array.o.abi: Likewise
	* tests/data/test-read-ctf/test-enum-many.o.hash.abi: Likewise
	* tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise
	* tests/data/test-read-ctf/test-enum.o.abi: Likewise
	* tests/data/test-read-ctf/test-fallback.abi: Likewise
	* tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise
	* tests/data/test-read-ctf/test-functions-declaration.abi:
	Likewise
	* tests/data/test-read-ctf/test-linux-module.abi: Likewise
	* tests/data/test-read-ctf/test-list-struct.abi: Likewise
	* tests/data/test-read-ctf/test0.abi: Likewise
	* tests/data/test-read-ctf/test0.hash.abi: Likewise
	* tests/data/test-read-ctf/test1.so.abi: Likewise
	* tests/data/test-read-ctf/test1.so.hash.abi: Likewise
	* tests/data/test-read-ctf/test2.so.abi: Likewise
	* tests/data/test-read-ctf/test2.so.hash.abi: Likewise
	* tests/data/test-read-ctf/test3.so.abi: Likewise
	* tests/data/test-read-ctf/test3.so.hash.abi: Likewise
	* tests/data/test-read-ctf/test4.so.abi: Likewise
	* tests/data/test-read-ctf/test4.so.hash.abi: Likewise
	* tests/data/test-read-ctf/test5.o.abi: Likewise
	* tests/data/test-read-ctf/test7.o.abi: Likewise
	* tests/data/test-read-ctf/test8.o.abi: Likewise
	* tests/data/test-read-ctf/test9.o.abi: 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/PR24378-fn-is-not-scope.abi: Likewise
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise
	* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise
	* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Likewise
	* tests/data/test-read-dwarf/PR28584/PR28584-smv.clang.o.abi:
	Likewise
	* tests/data/test-read-dwarf/PR29443-missing-xx.o.abi: Likewise
	* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.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-PR26568-1.o.abi: Likewise
	* tests/data/test-read-dwarf/test-PR26568-2.o.abi: Likewise
	* tests/data/test-read-dwarf/test-fallback.abi: Likewise
	* tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise
	* tests/data/test-read-dwarf/test-pointer-to-member-1.o.abi:
	Likewise
	* tests/data/test-read-dwarf/test-suppressed-alias.o.abi: Likewise
	* tests/data/test-read-dwarf/test0.abi: Likewise
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise
	* tests/data/test-read-dwarf/test1.abi: Likewise
	* tests/data/test-read-dwarf/test1.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/test14-pr18893.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/test2.so.abi: Likewise
	* tests/data/test-read-dwarf/test2.so.hash.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/test3-alias-1.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test3-alias-2.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test3-alias-3.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test3-alias-4.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test3.so.abi: Likewise
	* tests/data/test-read-dwarf/test3.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test4.so.abi: Likewise
	* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test5.o.abi: Likewise
	* tests/data/test-read-dwarf/test5.o.hash.abi: Likewise
	* tests/data/test-read-dwarf/test6.so.abi: Likewise
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test7.so.abi: Likewise
	* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi:
	Likewise
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi:
	Likewise
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise
	* tests/data/test-read-write/test-crc.xml: Likewise
	* tests/data/test-read-write/test26.xml: Likewise
	* tests/data/test-read-write/test27.xml: Likewise
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Likewise
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2023-12-01 15:43:53 +01:00
Dodji Seketeli
7535d74c3c Bug 29340 - Add support for Ada range types
Libabigail doesn't yet support generic range types like in Ada.
Ranges are supported as a kind of implementation detail of array
types.  But then its use like in the construct below is not supported:

    type My_Int is range 0 .. 5;
    function My_Function return My_Int;

Here, the integer type "My_Int" can take the discrete values that go
from 0 to 5.  It's represented in the DWARF debug info as being a
range type of length 6 and whose underlying type has a size of 8 bits.

This patch adds support for a range type to be (de-)serialized from
and to abixml, diffed, diff-analyzed and diff-reported.

The ABIXML version number has been bumped from 2.1 to 2.2 accordingly.

	* configure.ac: Bump the abixml version to 2.2 from 2.1
	* include/abg-comparison.h (diff_maps::get_subrange_diff_map):
	Declare new member functions.
	(class subrange_diff): Define new class.
	(subrange_diff_sptr): Define new typedef.
	(compute_diff): New overload for subrange_diff.
	(is_subrange_diff): Declare new function.
	* include/abg-ir.h (equals): Declare an overload for
	subrange_type.
	* include/abg-reporter.h (reporter_base::report): Declare an
	overload for subrange_diff.
	(default_reporter::report_underlying_changes_of_qualified_type):
	Declare member function.
	(leaf_reporter::report): Declare and overload for subrange_diff.
	Declare new member function.
	* include/abg-tools-utils.h
	(get_anonymous_subrange_internal_name_prefix): Declare new function.
	* src/abg-comparison-priv.h (struct subrange_diff::priv): Define
	new type.
	* src/abg-comparison.cc (diff_maps::priv::subrange_diff_map_):
	Define data member.
	(diff_maps::get_subrange_diff_map): Define member function.
	(is_subrange_diff, compute_diff): Define new functions.
	(compute_diff_for_types): Handle array_type::subrange_type types.
	(subrange_diff::{subrange_diff, first_subrange, second_subrange,
	get_pretty_representation, has_changes, has_local_changes, report,
	chain_into_hierarchy}): Define member functions.
	(diff_maps::insert_diff_node): Handle subrange diff nodes.
	(corpus_diff::priv::count_leaf_type_changes): Count subranges diff
	nodes.
	* src/abg-default-reporter.cc (default_reporter::report): Define
	an overload for subrange_diff.
	* src/abg-ir.cc (has_generic_anonymous_internal_type_name):
	Support subrange types.
	* src/abg-leaf-reporter.cc (report_type_changes_from_diff_maps):
	Report about subrange types.
	(leaf_reporter::report): Define and overload for subrange_diff
	nodes.
	* src/abg-reader.cc (build_subrange_type): Add a boolean to add
	the subrange type to the current scope.
	(build_array_type_def): Adjust when calling build_subrange_type.
	(build_type): Support building subrange types.
	* src/abg-reporter-priv.cc (represent): Define a new overload for
	the subrange_diff type.
	* src/abg-reporter-priv.h (represent): Declare a new overload for
	the subrange_diff type.
	* src/abg-tools-utils.cc (ANONYMOUS_SUBRANGE_INTERNAL_NAME)
	(ANONYMOUS_SUBRANGE_INTERNAL_NAME_LEN): Define new static const
	variables.
	(get_anonymous_subrange_internal_name_prefix): Define new
	function.
	* src/abg-writer.cc (write_array_subrange_type): Define new static
	function.
	(write_decl): Support emitting subrange_types.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-1.txt:
	New reference output.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/test1-ada-subrange-report-2.txt:
	Likewise.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/v0/test1.ad{b,s}:
	Source code of the input binary below.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/v0/test1.o:
	New input test.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/v1/test1.ad{b,s}:
	Source code of the input binary below.
	* tests/data/test-abidiff-exit/ada-subrange/test1-ada-subrange/v1/test1.o:
	New input test.
	* tests/data/Makefile.am: Add the new test files to source
	distributions.
	* tests/test-abidiff-exit.cc (in_out_specs): Add the new tests
	input above to this test harness.
	* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi:
	Adjust.
	* tests/data/test-annotate/libtest23.so.abi: Likewise.
	* 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/test-anonymous-members-0.o.abi:
	Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test14-pr18893.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/test2.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-annotate/test3.so.abi: Likewise.
	* tests/data/test-annotate/test4.so.abi: Likewise.
	* tests/data/test-annotate/test5.o.abi: Likewise.
	* tests/data/test-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
	Likewise.
	* tests/data/test-read-btf/test0.o.abi: Likewise.
	* tests/data/test-read-btf/test1.o.abi: Likewise.
	* tests/data/test-read-ctf/PR27700/test-PR27700.abi: Likewise.
	* tests/data/test-read-ctf/test-PR26568-1.o.abi: Likewise.
	* tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise.
	* tests/data/test-read-ctf/test-alias.o.abi: Likewise.
	* tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi:
	Likewise.
	* tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi:
	Likewise.
	* tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise.
	* tests/data/test-read-ctf/test-array-mdimension.abi: Likewise.
	* tests/data/test-read-ctf/test-array-of-pointers.abi: Likewise.
	* tests/data/test-read-ctf/test-array-size.abi: Likewise.
	* tests/data/test-read-ctf/test-bitfield-enum.abi: Likewise.
	* tests/data/test-read-ctf/test-bitfield.abi: Likewise.
	* tests/data/test-read-ctf/test-callback.abi: Likewise.
	* tests/data/test-read-ctf/test-callback2.abi: Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi:
	Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi:
	Likewise.
	* tests/data/test-read-ctf/test-const-array.abi: Likewise.
	* tests/data/test-read-ctf/test-dynamic-array.o.abi: Likewise.
	* tests/data/test-read-ctf/test-enum-many.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-enum.o.abi: Likewise.
	* tests/data/test-read-ctf/test-fallback.abi: Likewise.
	* tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise.
	* tests/data/test-read-ctf/test-functions-declaration.abi:
	Likewise.
	* tests/data/test-read-ctf/test-linux-module.abi: Likewise.
	* tests/data/test-read-ctf/test-list-struct.abi: Likewise.
	* tests/data/test-read-ctf/test0.abi: Likewise.
	* tests/data/test-read-ctf/test0.hash.abi: Likewise.
	* tests/data/test-read-ctf/test1.so.abi: Likewise.
	* tests/data/test-read-ctf/test1.so.hash.abi: Likewise.
	* tests/data/test-read-ctf/test2.so.abi: Likewise.
	* tests/data/test-read-ctf/test2.so.hash.abi: Likewise.
	* tests/data/test-read-ctf/test3.so.abi: Likewise.
	* tests/data/test-read-ctf/test3.so.hash.abi: Likewise.
	* tests/data/test-read-ctf/test4.so.abi: Likewise.
	* tests/data/test-read-ctf/test4.so.hash.abi: Likewise.
	* tests/data/test-read-ctf/test5.o.abi: Likewise.
	* tests/data/test-read-ctf/test7.o.abi: Likewise.
	* tests/data/test-read-ctf/test8.o.abi: Likewise.
	* tests/data/test-read-ctf/test9.o.abi: 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/PR24378-fn-is-not-scope.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise.
	* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Likewise.
	* tests/data/test-read-dwarf/PR28584/PR28584-smv.clang.o.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR29443-missing-xx.o.abi: Likewise.
	* tests/data/test-read-dwarf/PR29692-kdelibs3-libkjava.so.1.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-PR26568-1.o.abi: Likewise.
	* tests/data/test-read-dwarf/test-PR26568-2.o.abi: Likewise.
	* tests/data/test-read-dwarf/test-fallback.abi: Likewise.
	* tests/data/test-read-dwarf/test-libaaudio.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-suppressed-alias.o.abi:
	Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test1.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/test14-pr18893.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/test2.so.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.hash.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/test3-alias-1.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-2.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-3.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-4.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-write/test-crc.xml: Likewise.
	* tests/data/test-read-write/test26.xml: Likewise.
	* tests/data/test-read-write/test27.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2023-03-31 23:14:01 +02:00
Dodji Seketeli
861e4670b6 Bug 28450 - Fix cloned member function handling in DWARF
When the DWARF reader encounters a function DIE 'f' that has a
DW_AT_specification that points to a member function, the current
implementation creates a function IR for the member function.  The
problem is that the member function has no ELF symbol associated to
it.  The ELF symbol is associated to 'f', not to the member function.
The DWARF reader then wrongly drops the member function on the floor
because it has no ELF symbol function associated.  So that member
function specification never gets its concrete function represented in
the IR.

This patch fixes the issue by detecting that the member function is
the "specification" for 'f' and that the ELF symbol associated to it
might not be there.  In that case, if the ELF symbol is on the 'f' DIE
itself, we get it from there.

The patch makes more member functions to be represented so it uncovers
a latent issue which is explained below.

Today, some compilers can emit redundant DWARF constructs like "const
reference" or "const void".  A reference is always const so the const
is superfluous.  A similar thing can be said about "const void".
maybe_strip_qualification detects those constructs and rewrites the IR
into a "no-op qualified reference", or a "no-op qualified void".  The
no-op was needed in the previous incarnations of the DWARF reader
because it was expecting a 'qualified type' IR to be associated to a
qualified type DIE.  Note, however, that that expectation has been
generally relaxed since then.

The problem is that the comparison engine, when building the diff IR
needs to strip those no-op qualified types off, to avoid having
spurious change diagnostics.  That stripping introduces some
challenges because the tree is more or less un-mutable at that point
(after type canonicalization) so the stripping can only be partial.

This patch removes the no-op qualified types altogether, rather than
trying harder to handle them down the line.  In other words,  a const
reference is now represented as a reference and a const void as a
void.  This makes things much simpler.

The problem however is that the in-memory IR (and thus the emitted
ABIXML) doesn't have any no-op qualified type anymore.  So comparing
an old ABIXML that contains those no-op qualified types against its
origin ELF corpus can yield some spurious diagnostics.  To fix it, one
needs to re-generate the ABIXML file.

This patch bumps the ABIXML version to 2.1 and introduces a new
ABIXML-FORMAT-VERSIONS file that documents the format changes.

	* ABIXML-FORMAT-VERSIONS: New file that documents the version
	changes of the ABIXML-FORMAT-VERSIONS.
	* include/abg-fwd.h (look_through_no_op_qualified_type): Remove
	this function declaration.
	(strip_useless_const_qualification): Declare new function
	declaration.
	* src/abg-comparison.cc (compute_diff_for_types): Avoid stripping
	off no-op-qualified types as these beasts don't exist anymore.
	(redundancy_marking_visitor::visit_end): Allow a variable which
	type has local changes to be considered redundant if its type is
	itself redundant.
	* src/abg-config.cc (config::config): Bump the abixml version from
	2.0 to 2.1.
	* src/abg-dwarf-reader.cc (maybe_strip_qualification): Factorize
	out the new strip_useless_const_qualification function from here.
	(build_or_get_fn_decl_if_not_suppressed): If the function is
	created but doesn't have an ELF symbol associated to it, then
	update it so that the ELF symbol can be associated.  Otherwise,
	potential_member_fn_should_be_dropped might later drop that
	function on the floor because it doesn't have any ELF symbol
	associated.
	* src/abg-ir.cc (strip_useless_const_qualification): Define this,
	which is has been factorized out of maybe_strip_qualification.
	(look_through_no_op_qualified_type): Remove this definition.
	(equals): In the overload for reference_type_def, do not peel
	typedefs off from the reference before comparison.  This is now
	useless as the comparison infrastructure got a lot better.  In the
	overload for references, stop using
	look_through_no_op_qualified_type as this function doesn't exist
	anymore.
	* src/abg-tools-utils.cc (abidiff_status_has_error): Detect when
	there is a usage error as well.
	* tests/data/test-types-stability/PR28450-libepetra.so.13.0: Add
	new testing binary to the repository.
	* tests/data/Makefile.am: Add the new testing binary above to
	source distribution.
	* tests/test-types-stability.cc (elf_paths): Add the new test to
	this test harness.
	* tests/test-diff-dwarf-abixml.cc (main): Add better error messages.
	* tests/data/test-abidiff-exit/test-member-size-report0.txt: Adjust.
	* tests/data/test-annotate/libtest23.so.abi: Likewise.
	* 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/test-anonymous-members-0.o.abi: Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test14-pr18893.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/test6.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test10-report.txt: 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/test31-pr18535-libstdc++-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Likewise.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test31-report-1.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/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-libaaudio.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/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test1.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/test14-pr18893.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/test2.so.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.hash.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/test3-alias-1.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-2.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-3.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3-alias-4.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-write/test-crc.xml: Likewise.
	* tests/data/test-read-write/test26.xml: Likewise.
	* tests/data/test-read-write/test27.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-11-12 18:31:28 +01:00
Matthias Maennich
acc4bea0b8 symtab: Add support for MODVERSIONS (CRC checksums)
The Linux Kernel has a mechanism (MODVERSIONS) to checksum symbols based
on their type. In a way similar to what libabigail does, but different.
The CRC values for symbols can be extracted from the symtab either by
following the __kcrctab_<symbol> entry or by using the __crc_<symbol>
value directly.

This patch adds support for extracting those CRC values and storing them
as a property of elf_symbol. Subsequently, 'crc' gets emitted as an
attribute of 'elf-symbol' in the XML representation.

CRC comparisons are also added to the abidiff machinery such that if
both representations of a comparison contain a CRC value, they will be
compared and if any of the values is unset (i.e. == 0), equality is
assumed. Differences will be reported in the format that the Kernel
presents them e.g. via Module.symvers. It is likely, but not necessary,
that a CRC difference comes along with an ABI difference reported by
libabigail. Not everything that leads to a change of the CRC value an
ABI breakage in the libabigail sense.

In case a function or variable symbol changes in a harmless way, we
would previously also consider a CRC change harmless (or more precise:
not harmful). Explicitly testing for CRC changes when analyzing whether
diff nodes need to be considered harmful, allows to still classify them
harmful.

Also add some test cases to ensure reading CRC values from kernel
binaries works as expected. The empty-report files have been
consolidated to one file: empty-report.txt. That also clarifies the
expected outcome for the affected tests.

	* include/abg-ir.h (elf_symbol::elf_symbol): Add CRC parameter.
	(elf_symbol::create): Likewise.
	(elf_symbol::get_crc): New member method.
	(elf_symbol::set_crc): New member method.
	* src/abg-comp-filter.cc (crc_changed): New function.
	(categorize_harmful_diff_node): Also test for CRC changes.
	* src/abg-ir.cc (elf_symbol::priv::crc_): New data member.
	* src/abg-ir.cc (elf_symbol::priv::priv): Add CRC parameter.
	(elf_symbol::elf_symbol): Likewise.
	(elf_symbol::create): Likewise.
	(elf_symbol::textually_equals): Add CRC support.
	(elf_symbol::get_crc): New member method.
	(elf_symbol::set_crc): New member method.
	* src/abg-reader.cc (build_elf_symbol): Add CRC support.
	* src/abg-reporter-priv.cc (maybe_report_diff_for_symbol): Likewise.
	* src/abg-symtab-reader.cc (symtab::load): Likewise.
	* src/abg-writer.cc (write_elf_symbol): Likewise.
	* tests/data/Makefile.am: Add new test data files.
	* tests/data/test-abidiff-exit/test-crc-report.txt: New test file.
	* tests/data/test-abidiff-exit/test-crc-v0.abi: Likewise.
	* tests/data/test-abidiff-exit/test-crc-v1.abi: Likewise.
	* tests/data/test-abidiff/empty-report.txt: New file.
	* tests/data/test-abidiff/test-PR18166-libtirpc.so.report.txt: Deleted.
	* tests/data/test-abidiff/test-PR24552-report0.txt: Deleted.
	* tests/data/test-abidiff/test-crc-0.xml: New test file.
	* tests/data/test-abidiff/test-crc-1.xml: Likewise.
	* tests/data/test-abidiff/test-crc-2.xml: Likewise.
	* tests/data/test-abidiff/test-crc-report.txt: Likewise.
	* tests/data/test-abidiff/test-empty-corpus-report.txt: Deleted.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Add CRC values.
	* tests/data/test-read-write/test-crc.xml: New test data file.
	* tests/data/test-symtab/kernel-modversions/Makefile: New test source.
	* tests/data/test-symtab/kernel-modversions/one_of_each.c: Likewise.
	* tests/data/test-symtab/kernel-modversions/one_of_each.ko: Likewise.
	* tests/test-abidiff-exit.cc: Add new test case.
	* tests/test-abidiff.cc: Add new test case.
	* tests/test-read-write.cc: Likewise.
	* tests/test-symtab.cc (Symtab::KernelSymtabsWithCRC): New test case.

Reviewed-by: Giuliano Procida <gprocida@google.com>
Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
2021-04-02 16:13:13 +02:00