From patchwork Fri Jul 7 11:39:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 55893 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 76CA2396C675 for ; Fri, 7 Jul 2023 12:14:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76CA2396C675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688732061; bh=fmvLLiLFVomm7uRca7WB/TXQ4SwZpItNPBQoDpO7YjM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=yr+IxzR32G2+yiroLJb4jZVv3bH/wjfINnQfwTyLQAw7C065mhtv2gWfJhqxqMjfs 1wo3cqaCvK/OEuSdDeHNPPWKqHBajlWf8c6W+EijOeRdbpvQjBe7VidGKCm23T9BOb apohNuEdB1T9GvnPCCyL2zBhNM9rI4WowFYoGguE= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 97EC3392D7E5 for ; Fri, 7 Jul 2023 11:39:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97EC3392D7E5 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-fg2NLMHdPJ-t-d0L9B07bA-1; Fri, 07 Jul 2023 07:39:26 -0400 X-MC-Unique: fg2NLMHdPJ-t-d0L9B07bA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-63719bd2155so19952166d6.1 for ; Fri, 07 Jul 2023 04:39:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688729965; x=1691321965; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fmvLLiLFVomm7uRca7WB/TXQ4SwZpItNPBQoDpO7YjM=; b=QkcRgsTwPqOsZKoyRs0Ov9JWT42D4iwYcHOKBnHT3niBtI2GQsfisQ2rGGi84zL8wx p7TOSkc6eK//97jiy98xNsJnSIF7zZ201a/Ek/On+CGqfegNlseRaOFPqqsCbkO2u3uZ PMz4Wnjc5sdrVZ5GDaJsBnV433uEP/zTBlljN8nyHc0hHZ9XOtwIASb9+QbcTrM4dBOx nAeTOfs1mL6NrCOx1I+HUOjTXhqR6yK50m+BIboOYUzwQdI+OpW1mgxDaX1ZADEmiNCD SFEx4/BixXSLPSb6q/rzY0LAyVXAbBpU+WV1HnHZKoRk6Q+wJXqCRvVgk++Tp3mUwf0m yyew== X-Gm-Message-State: ABy/qLaXzZlCY3iJ3BmFgR1JgjZCucK20VLLdzsIQbhJzWLl9Ent9Cx2 3IxYtpe/LdnOeEwVLc5xkOapcnKzmuV/SrXy5vVXBIjNX1KerhdqtpW6hOs1wlA0ib720qorNQk ziyFIS+BufBP2H7AsiNvgstM+WrpV X-Received: by 2002:a0c:ac0e:0:b0:632:27c1:23fc with SMTP id l14-20020a0cac0e000000b0063227c123fcmr4574475qvb.39.1688729965364; Fri, 07 Jul 2023 04:39:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWesJ9enJ3FiDKv4NqcF10vzTxOTnJbBOKC5rVDRFW6SBqFAPZBEeyW7YY2cWh1Dak5OFMug== X-Received: by 2002:a0c:ac0e:0:b0:632:27c1:23fc with SMTP id l14-20020a0cac0e000000b0063227c123fcmr4574465qvb.39.1688729965025; Fri, 07 Jul 2023 04:39:25 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id f1-20020a0ccc81000000b0062ffcda34c6sm1973230qvl.137.2023.07.07.04.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 04:39:24 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 189FAB4FFD; Fri, 7 Jul 2023 13:39:22 +0200 (CEST) To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 0/4, applied] Binaries set comparison support Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Fri, 07 Jul 2023 13:39:22 +0200 Message-ID: <87edlk0x3p.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" # 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