[0/5] Improvements for the XML Writer

Message ID 20211203114622.2944173-1-maennich@google.com
Headers
Series Improvements for the XML Writer |

Message

Matthias Männich Dec. 3, 2021, 11:46 a.m. UTC
  We gave the issues we currently see with some larger (Android) userspace
libraries another try. Initially that was bug 28320 (infinite loops in the XML
writer). More recently, another Google team expressed an interest in ABI
monitoring and using libabigail for this purpose. A significant issue they
encountered was that large ABIs took a very long time to be extracted by abidw.
It turns out that a lot of abidw time is spent on writing out the XML.

We have been unable to merge upstream libabigail due to this affecting
userspace library monitoring. Both issues involved deep type equality tests
done by the XML writer. This series switches the XML writer to use bare type
pointers in all its containers.

Fixes: Bug 28320 - abidw - (non-deterministic) infinite loop in XML writer
Improves: Bug 26591 - detect pathologically redundant types in abixml

Performance improvements, all measurements are in CPU user seconds:
 - abidw for both test suite and typical kernel inputs is about 2% faster with this change
 - An AOSP framework library test case is sped up by >3 times, from 120 to 37.5
 - An internal Google library test case is sped up >20 times, from 3290 to 160

Impact on test cases:

 - tests/data/test-read-dwarf/PR22122-libftdc.so.abi is the only
   significantly-impacted test case. abidiff reports no change, but
   abidiff --harmless shows some things going on with empty, anonymous struct
   definitions. These empty structs are due to missing DW_AT_signature support
   / are correlated with DW_AT_signature attributes. The object file was
   compiled with Clang. Some more details have recently been discussed in bug
   26591.

 - All the other test object files are reported as having the same ABI by
   abidiff --harmless.

 - Our own test suite of small changes also has no differences found by
   abidiff --harmless.

 - One test kernel tree has an issue with one anonymous enum type being
   resolved incorrectly (having previously had conflicting duplicate
   definitions). The enumerators all have the same values so there is no ABI
   risk here. This deserves further investigation but should probably not hold
   up the series.

 - Spot checks with userspace libraries show no differences found by
   abidiff --harmless either.

Matthias Maennich (5):
  XML writer: use consistent type pointers for type ids and emission
    tracking
  XML writer: use exemplar types for tracking referenced types
  XML writer: track emitted types by bare pointer
  XML writer: map type ids by bare pointer
  XML writer: resolve declaration-only enum definitions

 src/abg-writer.cc                             |   80 +-
 .../data/test-annotate/test14-pr18893.so.abi  |    2 -
 .../data/test-annotate/test15-pr18892.so.abi  |   44 +-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |    4 -
 .../data/test-annotate/test21-pr19092.so.abi  |   26 +-
 .../test-read-dwarf/PR22122-libftdc.so.abi    | 6242 ++++++++---------
 .../data/test-read-dwarf/PR25007-sdhci.ko.abi |  514 +-
 .../PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi |    2 +-
 .../test-read-dwarf/test14-pr18893.so.abi     |    1 -
 .../test-read-dwarf/test15-pr18892.so.abi     |   28 +-
 .../test-read-dwarf/test16-pr18904.so.abi     |    2 -
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |    2 -
 .../test-read-dwarf/test21-pr19092.so.abi     |   16 +-
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi |    1 -
 14 files changed, 3472 insertions(+), 3492 deletions(-)