]> sourceware.org Git - libabigail.git/commit
dwarf-reader: Support DWARF incomplete class types
authorDodji Seketeli <dodji@redhat.com>
Mon, 18 Jul 2022 09:07:35 +0000 (11:07 +0200)
committerDodji Seketeli <dodji@redhat.com>
Mon, 18 Jul 2022 13:43:22 +0000 (15:43 +0200)
commit5b3516a5e73b4dad4cd44de5bc7adca556cd2ae4
tree750b2bc11074732eebf0fd841ac0ec7fd64f1910
parent2b8b8bc5a8868d3ab9eae487fa64b4d4374e5297
dwarf-reader: Support DWARF incomplete class types

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>
24 files changed:
src/abg-dwarf-reader.cc
tests/data/test-annotate/libtest23.so.abi
tests/data/test-annotate/test14-pr18893.so.abi
tests/data/test-annotate/test15-pr18892.so.abi
tests/data/test-annotate/test17-pr19027.so.abi
tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-diff-filter/test41-report-0.txt
tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt
tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt
tests/data/test-read-dwarf/PR22122-libftdc.so.abi
tests/data/test-read-dwarf/libtest23.so.abi
tests/data/test-read-dwarf/test-libaaudio.so.abi
tests/data/test-read-dwarf/test-libandroid.so.abi
tests/data/test-read-dwarf/test11-pr18828.so.abi
tests/data/test-read-dwarf/test12-pr18844.so.abi
tests/data/test-read-dwarf/test14-pr18893.so.abi
tests/data/test-read-dwarf/test15-pr18892.so.abi
tests/data/test-read-dwarf/test16-pr18904.so.abi
tests/data/test-read-dwarf/test17-pr19027.so.abi
tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi
tests/data/test-read-dwarf/test9-pr18818-clang.so.abi
This page took 0.039607 seconds and 5 git commands to generate.