[0/4,applied] Binaries set comparison support

Message ID 87edlk0x3p.fsf@redhat.com
Headers
Series Binaries set comparison support |

Message

Dodji Seketeli July 7, 2023, 11:39 a.m. UTC
  # Binaries set comparison support

## Introduction

This patch set implements the *Binaries set comparison* support added
to the `abidiff` and `abidw` programs.  The bug that tracks this
feature is [here](https://sourceware.org/bugzilla/show_bug.cgi?id=30034).

## `abidiff` Invocation to compare sets of binaries

### Through the command line

`abidiff` can be invoked to compare two sets of binaries that are
passed on the command line like:

    $ abidiff --add-binaries1=file2-v1              \
              --add-binaries2=file2-v2,file2-v1     \
	      --added-binaries-dir1 dir1 	    \
	      --added-binaries-dir2 dir2	    \
	      file1-v1 file1-v2

This compares the set of binaries {file1-v1, file2-v1} to be found in
the directory dir1 against the set of binaries {file1-v2, file2-v2,
file2-v1} to be found in the directory dir2.

### Indirectly through the dependencies of input binaries

`abidiff` can be invoked to compare two sets of binaries that are
defined as the union of the two input binaries provided on the command
line, as well as their dependencies, as provided by the content of the
DT_NEEDED ELF property, or by the content of the dependencies
expressed in the ABI Corpus for input ABIXML files.

Here is an example of invocation:

    $ abidiff --follow-dependencies			\
	      --added-binaries-dir1 /some/where		\
	      --added-binaries-dir2 /some/where/else	\
	      foo bar

So, abidiff when looking at the binary `foo`, abidiff would build a
set that comprises the union of:

    - foo
    - The dependencies of foo (gathered from either the DT_NEEDED ELF
      property or the ABI corpus dependencies) that are found in the
      `/some/where` directory specified by --added-binaries-dir1 or in the same
      directory as foo if no --added-binaries-dir1 was provided.

Note that if a dependency is not found in the `/home/where` directory,
then it's ignored.

Similarly, a set is built for bar and abidiff compares the two sets.

## Comparison of sets

A set of binaries is considered as if it was one binary made of the
several binaries of the set.  An ABI Corpus Groups is built from analyzing
the binaries of a given set.

Then the two ABI Corpus Groups are compared accordingly.

## Invocation of `abidw` to serialize the ABI representation of sets
   of binaries

###  Through the command line

`abidw` can be invoked to construct and serialize an ABI corpus group made
of the union of the input binary and some other added.

Here is an example of invocation:

    $ abidw --added-binaries="bin1,bin2,bin3"	\
      	    --added-binaries-dir /some/where	\
	    binary

### Indirectly through the dependencies of input binaries

`abidw` can also be invoked to construct and serialize an ABI corpus
group made of the union of the binary and its dependencies as
expressed by the DT_NEEDED ELF property.

Here is an example of invocation:

    $ abidw --follow-dependencies --added-binaries-dir /some/where binary

The union of `binary` and its dependencies specified by the content of
the DT_NEEDED property and found in the `/home/where` directory is
used to construct and ABI corpus group which is serialized on the
default output stream.  Note that if a dependency is not found in the
`/home/where` directory, then it's ignored.

The following patches implement that feature and have been applied to
the master branch of the git repository.

Dodji Seketeli (4):
  Make fe_iface::initialize independent from the kind of interface
  corpus,tools-utils: Support loading a corpus, its deps & other binaries
  abidw: Add --{follow,list}-dependencies & --add-binaries support
  abidiff: Add --{follow,list}-dependencies & add-binaries{1,2} support

 doc/manuals/abidiff.rst                       |  90 ++++
 doc/manuals/abidw.rst                         |  72 ++-
 include/abg-corpus.h                          |   2 +
 include/abg-elf-based-reader.h                |   8 +-
 include/abg-elf-reader.h                      |   9 +-
 include/abg-fe-iface.h                        |   4 +-
 include/abg-tools-utils.h                     |  35 ++
 src/abg-btf-reader.cc                         |   2 +-
 src/abg-corpus.cc                             |  21 +
 src/abg-ctf-reader.cc                         |   2 +-
 src/abg-dwarf-reader.cc                       |   2 +-
 src/abg-elf-based-reader.cc                   |  23 +-
 src/abg-elf-reader.cc                         |  25 +-
 src/abg-fe-iface.cc                           |  11 +-
 src/abg-tools-utils.cc                        | 257 ++++++++++-
 tests/data/Makefile.am                        |  25 ++
 .../test-PR30034/libabigail.abignore          |  47 ++
 .../test-PR30034/reference/include/rte_log.h  | 409 ++++++++++++++++++
 .../reference/lib64/librte_eal.so             |   1 +
 .../reference/lib64/librte_eal.so.23          |   1 +
 .../reference/lib64/librte_eal.so.23.1        | Bin 0 -> 1448504 bytes
 .../reference/lib64/librte_kvargs.so          |   1 +
 .../reference/lib64/librte_kvargs.so.23       |   1 +
 .../reference/lib64/librte_kvargs.so.23.1     | Bin 0 -> 25064 bytes
 .../reference/lib64/librte_telemetry.so       |   1 +
 .../reference/lib64/librte_telemetry.so.23    |   1 +
 .../reference/lib64/librte_telemetry.so.23.1  | Bin 0 -> 115424 bytes
 .../test-PR30034/split/include/rte_log.h      | 409 ++++++++++++++++++
 .../test-PR30034/split/lib64/librte_eal.so    |   1 +
 .../test-PR30034/split/lib64/librte_eal.so.23 |   1 +
 .../split/lib64/librte_eal.so.23.2            | Bin 0 -> 1467224 bytes
 .../test-PR30034/split/lib64/librte_kvargs.so |   1 +
 .../split/lib64/librte_kvargs.so.23           |   1 +
 .../split/lib64/librte_kvargs.so.23.2         | Bin 0 -> 25128 bytes
 .../test-PR30034/split/lib64/librte_log.so    |   1 +
 .../test-PR30034/split/lib64/librte_log.so.23 |   1 +
 .../split/lib64/librte_log.so.23.2            | Bin 0 -> 43392 bytes
 .../split/lib64/librte_telemetry.so           |   1 +
 .../split/lib64/librte_telemetry.so.23        |   1 +
 .../split/lib64/librte_telemetry.so.23.2      | Bin 0 -> 108584 bytes
 .../test-PR30034/test-PR30034-report-1.txt    |   3 +
 tests/test-abidiff-exit.cc                    | 170 +++++++-
 tools/abidiff.cc                              | 331 +++++++++++---
 tools/abidw.cc                                | 125 +++++-
 44 files changed, 1998 insertions(+), 98 deletions(-)
 create mode 100644 tests/data/test-abidiff-exit/test-PR30034/libabigail.abignore
 create mode 100644 tests/data/test-abidiff-exit/test-PR30034/reference/include/rte_log.h
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_eal.so.23.1
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_kvargs.so.23.1
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/reference/lib64/librte_telemetry.so.23.1
 create mode 100644 tests/data/test-abidiff-exit/test-PR30034/split/include/rte_log.h
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_eal.so.23.2
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_kvargs.so.23.2
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_log.so.23.2
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so
 create mode 120000 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so.23
 create mode 100755 tests/data/test-abidiff-exit/test-PR30034/split/lib64/librte_telemetry.so.23.2
 create mode 100644 tests/data/test-abidiff-exit/test-PR30034/test-PR30034-report-1.txt