mbox series

[RFC,0/9] Utility to manipulate ABI XML

Message ID 20210325215146.3597963-1-gprocida@google.com
Headers show
Series Utility to manipulate ABI XML | expand

Message

Giuliano Procida March 25, 2021, 9:51 p.m. UTC
Hi Dodji.

Following up from the script which would prune unreachable parts of
the ABI, I refactored this into more useful pieces and added a few
different processing passes.

Each pass performs a specific function.

* don't give anonymous types (differing) names
* duplicate (type id) detection and resolution
  * one kind of duplicate (member-type fragments) looks easy to resolve
  * there are at least two other kinds, probably IR / canonicalisation bugs
* duplicate (type name) resolution
  * some opportunities for applying ODR for kernel code are being missed
* post-processing XML for fun and profit
  * reachability analysis and ABI pruning
  * symbol list filtering as an XML transformation
  * stabilisation of type and declaration order within a corpus

The script serves as a vehicle for analysis and bug reporting - I've
already opened a few bugs and have a couple more pending - as well a
means of prototyping XML transformation via DOM manipulation. It's a
work in progress.

I've run this over every .xml and .abi in tests, followed by abidiff,
and the results are good with these caveats:

* the script finds conflicting definitions of type ids
* renaming anonymous types causes harmless diffs
* the XML reader gives anonymous types linkage names which triggered
  an assertion in XML late canonicalisation

I hope this is interesting if not immediately useful.

Regards,
Giuliano.

Giuliano Procida (9):
  Add ABI tidying utility
  Add pass to drop empty XML elements
  Add pass to prune unreachable parts of the ABI
  Add pass to filter symbols
  Add pass to normalise anonymous type names
  Add pass to report duplicate type ids
  Add pass to eliminate duplicate member-type fragments
  Add pass to stabilise types and declarations
  Add pass to resolve stray forward type declarations

 scripts/abitidy.pl | 707 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 707 insertions(+)
 create mode 100755 scripts/abitidy.pl