public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] dwarf-reader: Support DWARF incomplete class types
@ 2022-07-18 13:54 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2022-07-18 13:54 UTC (permalink / raw)
  To: libabigail

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

Hello,

The problem this patch addresses is visible when doing:

$ fedabidiff --debug --self-compare -a --from fc36 wildmagic5

More specifically:

tools/abidw --noout -d usr/lib/debug/ usr/lib64/libWm5Mathematics.so.5.17

This is reported at
https://sourceware.org/bugzilla/show_bug.cgi?id=29302#c2:

  Functions changes summary: 0 Removed, 9 Changed, 0 Added functions
  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

  9 functions with some indirect sub-type change:

    [C] 'method virtual Wm5::ConvexHull<double>::~ConvexHull(int)' at
    Wm5ConvexHull.h:24:1 has some indirect sub-type changes:
      implicit parameter 0 of type 'Wm5::ConvexHull<double>*' has
    sub-type changes:
        in pointed to type 'class Wm5::ConvexHull<double>':
          type size changed from 384 to 0 (in bits)
          1 member function deletion:
            'method virtual Wm5::ConvexHull<double>::~ConvexHull(int)'
    at Wm5ConvexHull.cpp:32:1
          no member function changes (2 filtered);

    [C] 'method virtual Wm5::ConvexHull<float>::~ConvexHull(int)' at
    Wm5ConvexHull.h:24:1 has some indirect sub-type changes:
      implicit parameter 0 of type 'Wm5::ConvexHull<float>*' has
    sub-type changes:
        in pointed to type 'class Wm5::ConvexHull<float>':
          type size changed from 320 to 0 (in bits)
          1 member function deletion:
            'method virtual Wm5::ConvexHull<float>::~ConvexHull(int)'
    at Wm5ConvexHull.cpp:32:1
          no member function changes (2 filtered);

[...]

It appears that some class type DIEs don't have any size information
and are marked as being declarations.  These have an incomplete set of
data member / virtual member functions compared to DIEs for the SAME
types described elsewhere in the DWARF.

About these, the specification says:

    5.7.1 Structure, Union and Class Type Entries
    [...]

    An incomplete structure, union or class type is represented by a
    structure, union
    or class entry that does not have a byte size attribute and that has a
    DW_AT_declaration attribute.

But then the DWARF reader doesn't know about these so it creates
several types from these incomplete DIEs.  Those types are thus
incorrect.  And that leads to spurious self comparison changes down
the road.

This patch thus detects that the DIEs is for an incomplete type and
does not build an IR for its sub-types.  It rather builds a
declaration-only type.

Then later, that declaration-only type is resolved to its
corresponding definition using the existing
read_context::resolve_declaration_only_classes function.

The patch also removes the temporary speed hack that was introduced
into read_context::resolve_declaration_only_classes() by the commit:

    b9af1f35 dwarf-reader: Avoid long comparisons when resolving C++ decl-only classes

This is no longer a problem thanks to the great speed improvement we
have from the commit:

    69795d1b Bug 29303 - Cache the result of structural aggregate comparison

	* src/abg-dwarf-reader.cc
	(read_context::resolve_declaration_only_classes): Do not avoid
	comparing ODR-relevant classes.
	(add_or_update_class_type): Detect incomplete classes and treat
	them as decl-only types.  They'll be resolved to their proper
	complete types later, by
	read_context::resolve_declaration_only_classes.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* 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/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
	* tests/data/test-diff-filter/test41-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-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest23.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/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/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>
---
 src/abg-dwarf-reader.cc                       |    31 +-
 tests/data/test-annotate/libtest23.so.abi     |   711 +-
 .../data/test-annotate/test14-pr18893.so.abi  |  4712 ++-
 .../data/test-annotate/test15-pr18892.so.abi  |  1938 +-
 .../data/test-annotate/test17-pr19027.so.abi  |  1193 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 12309 +++----
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 17461 +++++----
 .../data/test-diff-filter/test41-report-0.txt |     2 +-
 ...bb-4.3-3.20141204.fc23.x86_64-report-0.txt |     2 -
 ...bb-4.3-3.20141204.fc23.x86_64-report-1.txt |     2 -
 .../test-read-dwarf/PR22122-libftdc.so.abi    |  1577 +-
 tests/data/test-read-dwarf/libtest23.so.abi   |   676 +-
 .../test-read-dwarf/test-libaaudio.so.abi     |     8 -
 .../test-read-dwarf/test-libandroid.so.abi    |    23 +-
 .../test-read-dwarf/test11-pr18828.so.abi     | 10415 +++---
 .../test-read-dwarf/test12-pr18844.so.abi     | 11438 +++---
 .../test-read-dwarf/test14-pr18893.so.abi     |  4411 ++-
 .../test-read-dwarf/test15-pr18892.so.abi     |  1920 +-
 .../test-read-dwarf/test16-pr18904.so.abi     |  1183 +-
 .../test-read-dwarf/test17-pr19027.so.abi     |  1186 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 12044 +++----
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 17104 +++++----
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 30010 ++++++++--------
 .../test9-pr18818-clang.so.abi                |  2370 +-
 24 files changed, 65491 insertions(+), 67235 deletions(-)


Attached is the gzipped tarball as it wouldn't reach the mailing list
otherwise.


[-- Attachment #2: 0001-dwarf-reader-Support-DWARF-incomplete-class-types.patch.gz --]
[-- Type: application/gzip, Size: 1141210 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:[~2022-07-18 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18 13:54 [PATCH, applied] dwarf-reader: Support DWARF incomplete class types 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).