From patchwork Thu Mar 25 21:51:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 42773 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 9F616385800D; Thu, 25 Mar 2021 21:52:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F616385800D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1616709126; bh=9TyWY9wSKCF8+jMoBQSIOfz2RkVXLVkH2tXqlMK/SSE=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=L2CXxfd3cphhTpQFzLqLXsv4dlLGJ3e/9bQ8GV7P5YkewqxlKmJaPNuxwt6v+zkn3 1yOfLhQa9eWv/frDcQib1ISxqd9F/mnzv2DiOMv4eaXwBtvuqJS9NXWSt16Dg/mOcn +XZdMyV27+2tZ5XGDFHSswnAHC+zAtnYW0QxhKRs= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by sourceware.org (Postfix) with ESMTPS id 44B6A3858001 for ; Thu, 25 Mar 2021 21:52:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 44B6A3858001 Received: by mail-yb1-xb4a.google.com with SMTP id o129so7510945ybg.23 for ; Thu, 25 Mar 2021 14:52:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=9TyWY9wSKCF8+jMoBQSIOfz2RkVXLVkH2tXqlMK/SSE=; b=Y13cp7xIRg0c5ah7XIOPlynNjtocZhMg4qVDnnPAwYm0Rxg9ypkPejAd5x7M2pjb8y CRL4Af8W/wdqkKSDfcD1RJrK1bkOdUPtfNTyff59gNFvpLfE2DcGSKO45c0goIBbCerb sdOuacau/T9KkqtYeQ8/qkxM8ewkdohE7caDw5+SvkKe58o979QJBvY0woXocT6HcE/u uXBdm13NPigXZnOUrtIdp7XzPLqOsrZYIDxZ3QsimeSbZeao3c+Nk2TDCvThtqRcVSsL 0/vNOih66EEpI1Zo9niflN30J7VgsC+8ScT4Ql2mLQNv1OAs3v/f4CKcoFn2havp4zA8 p+2g== X-Gm-Message-State: AOAM530Xt7eMIHw46ddHd1QsM9C6erFdwsiX+88uCJC9OpHV0LUeurLO MCvWe9sMIOpk1//ZXaGBrs1YuKX47a10K6DU0/3mvjWsS93PNlitbDCKRAnkkZf8hvAYuIsCLkq 5oef+Ecplb5RbrY055spc+ij+Ach2U03ignzT5eVcMy78ek4wCr5kmFlo+oy4BG2hfXTzw5w= X-Google-Smtp-Source: ABdhPJxK6GXVVLSoQ3Qp2XkMMnU09I+8G2zLDzlYC+yzZDRKQxjsnwQNF2iES9916hi3t9SZwATZYR6semylXA== X-Received: from tef.lon.corp.google.com ([2a00:79e0:d:110:2df6:f24a:7f54:86a8]) (user=gprocida job=sendgmr) by 2002:a5b:ac9:: with SMTP id a9mr14809353ybr.23.1616709122657; Thu, 25 Mar 2021 14:52:02 -0700 (PDT) Date: Thu, 25 Mar 2021 21:51:37 +0000 In-Reply-To: <20210316165509.2658452-1-gprocida@google.com> Message-Id: <20210325215146.3597963-1-gprocida@google.com> Mime-Version: 1.0 References: <20210316165509.2658452-1-gprocida@google.com> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog Subject: [RFC PATCH 0/9] Utility to manipulate ABI XML To: libabigail@sourceware.org X-Spam-Status: No, score=-16.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Giuliano Procida via Libabigail From: Giuliano Procida Reply-To: Giuliano Procida Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" 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