public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] dwarf-reader,ir: Merge member fns of classes
@ 2024-05-09 22:28 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2024-05-09 22:28 UTC (permalink / raw)
  To: libabigail

[-- Attachment #1: Type: text/plain, Size: 3979 bytes --]

Hello,

When looking at something else, I realized that in DWARF, two classes
C and C' of the same name and coming from the same corpus might not
have the same member functions that are defined.  This is probably
because for a given translation unit, some compilers emit debug info
only for the member functions that are used somehow.

So, depending on which of C or C' is the canonical class in the end,
we will not necessarily have the same member functions emitted in
ABIXML.  That is annoying.  So there was a kludge in
maybe_adjust_canonical_type to ensure that the canonical type has all
the member functions of the types belonging to same class of
equivalence.

This patch adds a pass before type canonicalization in the DWARF
reader to ensure that all classes of the same name in a given corpus
have the same member functions.  The patch thus removes the now
unnecessary kludge from maybe_adjust_canonical_type and asserts the
impossibility of the member function discrepancy.

	* src/abg-dwarf-reader.cc (reader::{copy_missing_member_functions,
	contains_anonymous_class, merge_member_functions_of_classes,
	merge_member_functions_in_classes_of_same_names}): Define new
	member functions.
	(reader::read_debug_info_into_corpus): Call the reader::new
	merge_member_functions_in_classes_of_same_names.
	* src/abg-ir.cc (maybe_adjust_canonical_type): When looking at the
	canonical type C of a type T, if they both come from the same
	corpus, assert that C has all the member functions of T.  This
	because the DWARF reader now ensures that all types have the same
	name in a given corpus have the same member functions.
	* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
	* tests/data/test-annotate/test15-pr18892.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-read-dwarf/test-libandroid.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/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/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>
Applied to master branch.
---
 src/abg-dwarf-reader.cc                       |   129 +
 src/abg-ir.cc                                 |    20 +-
 .../data/test-annotate/test14-pr18893.so.abi  |  3188 +-
 .../data/test-annotate/test15-pr18892.so.abi  |  7735 ++---
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |  4605 ++-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |  8099 +++--
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |  5793 ++--
 .../test-read-dwarf/test-libandroid.so.abi    |   187 +
 .../test-read-dwarf/test12-pr18844.so.abi     |  1687 +-
 .../test-read-dwarf/test14-pr18893.so.abi     |  2847 +-
 .../test-read-dwarf/test15-pr18892.so.abi     |  7524 ++---
 .../test-read-dwarf/test16-pr18904.so.abi     |  5757 ++--
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |  3830 ++-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |  7081 +++--
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |  4781 +--
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 26133 +++++++++-------
 .../test9-pr18818-clang.so.abi                |  3025 +-
 17 files changed, 53665 insertions(+), 38756 deletions(-)

This patch is too big for the mailing list so I am attaching a gzipped
version of it.


[-- Attachment #2: 0001-dwarf-reader-ir-Merge-member-fns-of-classes.patch.gz --]
[-- Type: application/gzip, Size: 1039208 bytes --]

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-09 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09 22:28 [PATCH, applied] dwarf-reader,ir: Merge member fns of classes Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).