From patchwork Wed Nov 16 17:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 55301 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 55F9A395C023 for ; Wed, 16 Nov 2022 17:27:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55F9A395C023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668619653; bh=tZ4122Yowv71XwHIBpGUUH/rjcepjP4Mkt2G0RE2oWA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=JHhQcmI86JdD4bS5KwsD/FXoueCZtG3mpI9yyPp46pIreGK8PwihIn57Cbbqm3yWo Xqq1Jrp59WjEoXM+IHEgS2qUmTRWFjuwjLyJulHE10g06zJ7TqCWNGnpBEd3CpR1YB 6Cyg2bfKPawJu/+Nlz1v1RiqCXa9RBXjsehDhuhE= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id B67CC395C00F for ; Wed, 16 Nov 2022 17:27:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B67CC395C00F Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-97-kMewO4qjP_ObgvQwIuNfuw-1; Wed, 16 Nov 2022 12:27:24 -0500 X-MC-Unique: kMewO4qjP_ObgvQwIuNfuw-1 Received: by mail-qv1-f69.google.com with SMTP id ns11-20020a056214380b00b004c64784249eso6156524qvb.7 for ; Wed, 16 Nov 2022 09:27:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=tZ4122Yowv71XwHIBpGUUH/rjcepjP4Mkt2G0RE2oWA=; b=g0L70OEgffkhdZT9gdgnbmXZ0bSqRYMMN3Zw0b5P84of1gHn0QuHxa2nt1/fW0U6i9 E/oBc0sBQUEcP6biHvCsEIvdQ1mJdeaxiLrwY2hD9HX4n12CYBM4ASkVMVyvQsr/8NjP s7No+f2PqxuHjdeDa3BCtV5VFTVY/iO60NMVbgpgXFBcgo96VtJbCRMVBtWeznJOnjsg sT035IDqa2LPf6QNBLSIA/IjY/2IdSzVQ8dw9zaEnZuijHGUJBBTDp/3VlDSbQk9Kj8o 7HsuzF3howBmEORt6nacwsqvEXfC54LGOjn6W/K/PaPJN/LDT37r55BVVAV1Z/4QYk8K nNaw== X-Gm-Message-State: ANoB5pmMlelXY4V+FOaD+RGTLYMREfvBeQeZijBQ2xtK1+pevgrxuTuP V/Y+kwF4mwCIWp3yMgTKnkGPntLaL/Okv73cSWOtRIHL5/3hQpAaiP5vJWTcXYgoJkiDIRxRU7y 67JthNhZ3W6+LMBzBBnst X-Received: by 2002:a0c:b35c:0:b0:4c6:5908:84f0 with SMTP id a28-20020a0cb35c000000b004c6590884f0mr7537058qvf.9.1668619643711; Wed, 16 Nov 2022 09:27:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4YW6rCXbJpXCaj5IWXfOIO6gjEoVHPogwjc7BRzvwcKnc7GCAAvbYnzSj7CoObjEWJ1XGF9w== X-Received: by 2002:a0c:b35c:0:b0:4c6:5908:84f0 with SMTP id a28-20020a0cb35c000000b004c6590884f0mr7537036qvf.9.1668619643423; Wed, 16 Nov 2022 09:27:23 -0800 (PST) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id r21-20020a05620a299500b006e702033b15sm10731576qkp.66.2022.11.16.09.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 09:27:22 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 847D6581D14; Wed, 16 Nov 2022 18:19:24 +0100 (CET) To: gprocida@google.com, woodard@redhat.com, guillermo.e.martinez@oracle.com, jose.marchesi@oracle.com Cc: dodji@redhat.com, libabigail@sourceware.org Subject: [PATCH 0/2, v2] Make front-ends be first class in the libabigail framework Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Wed, 16 Nov 2022 18:19:24 +0100 Message-ID: <87k03uom03.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.6 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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" Hello, Following the feedback after the v1, here is an updated version of this change set. The main topic of this update was to split the initial patch in two patches. The first one is an introductory patch. It makes the internal representation access the environment by reference, as opposed to by pointer like it was previously. The cool thing about that change is that the environment can now by instantiated on the stack and passed by reference to the functions that create the DWARF and CTF readers. The drawback is that it's a lot of (almost) mechanical changes. The second patch is the real meat of the change, which is twofold. First, it's to improve the integration and maintenance of the new CTF front-end in the libabigail framework. Today, the code of the CTF front-end is guarded by #ifdef WITH_CTF pre-processor macro invocations. Ideally, the amount code guarded by that macro should be minimal (and ideally be zero in the future), especially in the libabigail tools (abidw, abidiff, abipkgdiff, etc) that use the library. Second, it's to allow and ease the inclusion new front-ends in the future, for instance, to support other ELF-based debug info formats. The idea is to provide new abstractions in the libabigail framework to represent a front-end and to share code between similar front-ends. For instance, front-ends that are ELF-based (DWARF/CTF) would share the code to access generic ELF properties. Tools would thus be better equipped to analyze a binary and depending on its kind, instantiate the appropriate front-end for its ABI analysis and use it accordingly. This thread contains the change proposal to implement this "feature". In any case, the change can be access from the Git repository in the "front-end" branch, which can be browsed from https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/users/dodji/front-end Please, find the summary log of the change below. Dodji Seketeli (2): Use environment by reference. Make Front Ends first class citizens include/Makefile.am | 4 +- include/abg-corpus.h | 25 +- include/abg-ctf-reader.h | 35 +- include/abg-dwarf-reader.h | 134 +- include/abg-elf-based-reader.h | 63 + include/abg-elf-reader-common.h | 70 - include/abg-elf-reader.h | 161 + include/abg-fe-iface.h | 166 + include/abg-fwd.h | 7 +- include/abg-ir.h | 154 +- include/abg-reader.h | 62 +- include/abg-suppression.h | 67 + include/abg-tools-utils.h | 13 +- include/abg-writer.h | 2 +- src/Makefile.am | 4 +- src/abg-comparison.cc | 67 +- src/abg-corpus-priv.h | 18 +- src/abg-corpus.cc | 73 +- src/abg-ctf-reader.cc | 1546 ++++---- src/abg-dwarf-reader.cc | 3896 +++++++------------- src/abg-elf-based-reader.cc | 102 + src/abg-elf-helpers.cc | 183 +- src/abg-elf-helpers.h | 38 + src/abg-elf-reader-common.cc | 90 - src/abg-elf-reader.cc | 954 +++++ src/abg-fe-iface.cc | 411 +++ src/abg-ir-priv.h | 57 +- src/abg-ir.cc | 845 ++--- src/abg-reader.cc | 1974 +++++----- src/abg-suppression-priv.h | 179 - src/abg-suppression.cc | 479 ++- src/abg-symtab-reader.cc | 5 +- src/abg-symtab-reader.h | 6 +- src/abg-tools-utils.cc | 163 +- src/abg-writer.cc | 39 +- tests/data/test-read-ctf/test0.abi | 3 + tests/data/test-read-ctf/test0.hash.abi | 3 + tests/data/test-read-ctf/test1.so.abi | 3 + tests/data/test-read-ctf/test1.so.hash.abi | 3 + tests/data/test-read-ctf/test2.so.abi | 3 + tests/data/test-read-ctf/test2.so.hash.abi | 3 + tests/data/test-read-ctf/test3.so.abi | 5 +- tests/data/test-read-ctf/test3.so.hash.abi | 5 +- tests/data/test-read-ctf/test4.so.abi | 3 + tests/data/test-read-ctf/test4.so.hash.abi | 3 + tests/print-diff-tree.cc | 21 +- tests/test-abidiff.cc | 23 +- tests/test-diff-dwarf.cc | 25 +- tests/test-ir-walker.cc | 13 +- tests/test-read-ctf.cc | 21 +- tests/test-read-dwarf.cc | 6 +- tests/test-read-write.cc | 3 - tests/test-symtab.cc | 41 +- tools/Makefile.am | 13 +- tools/abicompat.cc | 70 +- tools/abidiff.cc | 228 +- tools/abidw.cc | 177 +- tools/abilint.cc | 127 +- tools/abipkgdiff.cc | 218 +- tools/abisym.cc | 7 +- tools/kmidiff.cc | 15 +- 61 files changed, 6497 insertions(+), 6637 deletions(-) create mode 100644 include/abg-elf-based-reader.h delete mode 100644 include/abg-elf-reader-common.h create mode 100644 include/abg-elf-reader.h create mode 100644 include/abg-fe-iface.h create mode 100644 src/abg-elf-based-reader.cc delete mode 100644 src/abg-elf-reader-common.cc create mode 100644 src/abg-elf-reader.cc create mode 100644 src/abg-fe-iface.cc