1
0
mirror of git://sourceware.org/git/libabigail.git synced 2025-03-06 06:37:31 +00:00
libabigail/tests
Dodji Seketeli 346e88dd76 Bug 26135 - Wrong linkage name causes anonymous classes miscomparison
When comparing decls, the overload of the 'equals' function for
instances of decl_base compares their linkage names.  If they are
different, then the decls are generally considered different.

Class declarations (and definitions) also use the 'equals' function
referred to above.  So when two classes have different linkage names,
they are always considered different.

Now let's consider the case of an anonymous class.  It doesn't have
any user-provided name, by definition.  Libabigail does, however,
assigns it an internal name for various (internal) purposes.  That
internal name is generally ignored for the purpose of (anonymous) type
comparison.  So by design, two anonymous classes can have different
internal anonymous names and yet still happen to be equal.

The root issue in this problem report is that by default, the linkage
name of a class is set to its name.  And when that class is anonymous,
its internal name is used as its linkage name.  Oops.  That leads to
anonymous classes being wrongly considered different.

This patch fixes the issue by providing additional constructors for a
class type to avoid using the internal anonymous name as its linkage
name.

Note that the same issue is present for unions so the patch does the
a similar thing for union types.

Enums are properly handled so we don't need to do anything in that
regard.

For good measure, the patch also adds an assert to
type_base::get_canonical_types_for to ensure that anonymous class or
union types don't have linkage names for now.

	* include/abg-ir.h (class_decl::class_decl): Add two overloads
	that take the "is_anonymous" flag.
	(union_decl::union_decl): Likewise.
	* src/abg-ir.cc (class_decl::class_decl): Define two overloads
	that take the "is_anonymous" flag and set the linkage name
	accordingly.
	(union_decl::union_decl): Likewise.
	(type_base::get_canonical_type_for): Assert that an anonymous
	class or union can't have a linkage name for now.
	* src/abg-dwarf-reader.cc (add_or_update_class_type)
	(add_or_update_union_type): Use a new overload for the constuctor
	of {class, union}_decl and set the "is_anonymous" flag.  Don't use
	decl_base::set_is_anonymous anymore.
	* src/abg-reader.cc (build_class_decl, build_union_decl):
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-07-06 18:26:08 +02:00
..
data Bug 26135 - Wrong linkage name causes anonymous classes miscomparison 2020-07-06 18:26:08 +02:00
lib
.gitignore tests/.gitignore: ignore all files starting with runtest* 2020-05-13 11:26:28 +02:00
Makefile.am tests: Add symtab test suite 2020-05-27 11:00:51 +02:00
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 Bug 25986 - Wrong name of function type used in change report 2020-05-14 09:54:52 +02:00
test-abidiff.cc
test-alt-dwarf-file.cc
test-annotate.cc
test-core-diff.cc
test-cxx-compat.cc cxx-compat: add test suite for cxx-compat 2020-05-13 11:55:12 +02:00
test-diff2.cc
test-diff-dwarf-abixml.cc
test-diff-dwarf.cc
test-diff-filter.cc Bug 25661 - Support data member replacement by anonymous data member 2020-05-18 13:42:50 +02:00
test-diff-pkg.cc configure: add more diagnostic options when ABIGAIL_DEVEL is set 2020-05-18 10:39:36 +02:00
test-diff-suppr.cc tests: parallelize diff-suppr test 2020-04-20 15:02:39 +02:00
test-dot.cc
test-elf-helpers.cc abg-dwarf-reader split: create abg-elf-helpers.{h,cc} and test case 2020-04-22 11:39:45 +02:00
test-ini.cc
test-ir-walker.cc
test-kmi-whitelist.cc Simplify generation of symbol whitelist regex. 2020-05-04 11:17:49 +02:00
test-lookup-syms.cc
test-read-dwarf.cc Fix bug that suppressed DWARF read tests. 2020-06-17 11:27:13 +02:00
test-read-write.cc configure: add more diagnostic options when ABIGAIL_DEVEL is set 2020-05-18 10:39:36 +02:00
test-svg.cc
test-symtab.cc tests: Add kernel symtab test suite 2020-05-27 11:00:51 +02:00
test-tools-utils.cc
test-types-stability.cc test-types-stability: parallelize test case alternatives 2020-05-04 15:34:42 +02:00
test-utils.cc
test-utils.h
test-valgrind-suppressions.supp
test-write-read-archive.cc
update-test-output.py