libabigail/ABIXML-FORMAT-VERSIONS
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

68 lines
2.7 KiB
Plaintext

2.1 version
===========
This occurred in libabigail 2.1. The IR doesn't contain no-op
qualified types anymore. These were the ancient way to represent
qualified type that were edited by libabigail to avoid spurious
diagnostics. E.g, const references or const void type. In those
cases, we were replacing these by qualified types that were no-ops.
Those no-ops qualified types further needed to be stripped off in the
diff IR to avoid emitting spurious changes. It turned out stripping
out those no-op qualified types was causing some difficulties in the
algorithms that propagate type diff node categorization.
For instance, variable diff type node would have the categorization of
its diff->type_diff() be different from what we could see from the
change observed between its diff->first_subject()->get_type() and
diff->second_subject()->get_type(). This is because diff->type_diff()
strips the no-op qualified types to create a new diff IR node, whereas
looking at the difference between diff->first_subject->get_type() and
diff->second_subject()->get_type() gives a different perspective.
So looking at the "changes" carried by 'diff' could yield a result
suggesting that there was a change to be diagnosed, carried by the
difference between diff->first_subject()->get_type() and
diff->second_subject()->get_type() -- a difference between two no-ops
qualified types -- whereas actually looking at diff->type_diff() (that
should be equivalent) yields a different information because it's
stripped off of the no-op qualified type.
Just removing the no-op qualified types removed all those issues
altogether. So in concrete terms, when we see a const reference, it's
replaced by a reference (because a reference is always const) and
when we see a const void, it's replaced by void. As simple as that.
But then the emitted ABIXML won't carry any no-op qualified type
anymore. Older versions of ABIXML might still carry those, and so
abidiff-ing those against their original binary might yield some
spurious diagnostics. Hence the minor version bump.
relevant commit:
----------------
commit 8a4f72005bc96fecf63414784cf94857eddbd124
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Nov 4 10:59:32 2021 +0100
Bug 28450 - Fix cloned member function handling in DWARF
2.0 version
===========
This occured in libabigail 2.0. The interpretation of
DW_AT_bit_offset (DWARF 5) changed so the value of the
'layout-offset-in-bits' property of the 'data-member' element might
now have changed in an incompatible way.
relevant commit:
----------------
commit 23046152e0843bc2f141e37dcce047305c3f4379
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Oct 22 16:04:08 2020 +0200
Bump ABIXML format version to 2.0
1.0 version
===========
This was the initial version of abixml.