libabigail/tests/data/test-diff-dwarf/libtest43-PR22913-v1.so
Dodji Seketeli 30314e3a62 Bug 22913 - Correctly de-duplicate pointers to anonymous structs inside a given
During type DIE canonicalization, libabigail performs an optimization
while comparing two types defined in the same translation unit.  That
is, inside a given translation unit two pointers that point to a type
named T (that is, two T*) are considered equal.  They are considered
equal without having to structurally compare the two types named T.

This generally makes sense, because if two types of the same kind,
defined in the same translation unit, have the same name then we can
safely conclude that they are actually the same type.  Unless the two
T are anonymous structs.

If the two T are anonymous structs defined in the same translation
unit, we really need to compare them structurally to know if they are
equal or not.

This is what this patch does.

	* src/abg-dwarf-reader.cc
	(pointer_or_qual_die_of_anonymous_class_type)
	(die_is_qualified_type): Define new functions.
	(compare_dies): If pointers, reference or qualified type have an
	anonymous struct as their underlying type, then we need to
	structurally compare the underlying anonymous struct.
	* tests/data/test-diff-dwarf/libtest43-PR22913-v{0,1}.so: New
	binary test input files.
	* tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: New
	reference output of the comparison of the two binaries above.
	* tests/data/test-diff-dwarf/test43-PR22913-v{0,1}.c: Source code
	of the binaries above.
	* tests/test-diff-dwarf.cc (in_out_specs): Make the test harness
	compare the two binaries above.
	* tests/data/Makefile.am: Add the new test files above to the
	source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2018-03-02 16:49:17 +01:00

8.9 KiB
Executable File