From patchwork Fri Jun 12 09:59:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39568 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 6582439551D7; Fri, 12 Jun 2020 09:59:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6582439551D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591955969; bh=loQ69NKIqGeTktdRbBYaL/PlioqiePqXuzl4z9ukDWc=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=dOvfXSQD8DgKzXYX22/rc5bPQw/lwfLu5GdOeFrn65t15PgmU/ajxvPyIJmUe+F8g dJnWmik4peA0WRnX61TGVZWSxWiCfpPEDsgirZyA4eTfaShb7wmJfoL+wNWI/chx2S gD4ElS93nljDegbb3hlx93BCvNWitt8iKzWhbYcs= 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 F333E3870869 for ; Fri, 12 Jun 2020 09:59:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F333E3870869 Received: by mail-yb1-xb4a.google.com with SMTP id e82so9328159ybh.12 for ; Fri, 12 Jun 2020 02:59:26 -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:message-id:mime-version:subject:from:to:cc; bh=loQ69NKIqGeTktdRbBYaL/PlioqiePqXuzl4z9ukDWc=; b=ZdOUwLjytZz6Khgcl8wilnuwzZsI9tKG3Q6JzPfuNKAGSedurVJEq0M7A/nfSnkbDk rxdgcpgb8VQbzZS18GOF4XSZI7v1qzVsWOFTdgMDU1LtdrCn1rocYJnKMDPzI1Xnewt2 r3W55Kt6moG/7TZB3tU1qGLiD6SFW8WLu7LQmZonKJr8uVPlxiRCw0PEzuOBywf0Qvmi wEIs8fHRem+idK7kTD34OPS3RFj5ixX64E3HN+qTx638CKjs3LD40H3/3MczzdewHO8v F4o28SYE1T4xCxd7UZxREGv7YSzcGriZcbjejBfhky1Pjrm5fBZYPwdzmMPUVk4Oq81t hZSA== X-Gm-Message-State: AOAM532iAcpZ60JmZ1iNrzFPuRXbSpfjR1q6YsGq3ieVrkqDQtQ2UXcH BGu9GJRqjFLI/dL5IRSL7MoCgq2dwvFX2yxbuNA8sv4R9jWohV/lz0CrJLcx0eleZ1zhX/ypdPc mctyHH5XySCvRZpqFozH/1U9p468/Fb49CK5Dlg+2cY3p85iV54ZUYcdQW9g+GN1woi/t8UY= X-Google-Smtp-Source: ABdhPJyJCgWUKXahV1dlG6kYv55s+5XfDAdhqg//nvvbdevj6lBvsGbwDIFzLqIF3tSe1xXeasYyHa9ei3Akjw== X-Received: by 2002:a25:7cc4:: with SMTP id x187mr21195173ybc.245.1591955966392; Fri, 12 Jun 2020 02:59:26 -0700 (PDT) Date: Fri, 12 Jun 2020 10:59:15 +0100 Message-Id: <20200612095917.2146-1-gprocida@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.27.0.290.gba653c62da-goog Subject: [PATCH 0/2] Stable type ids To: libabigail@sourceware.org X-Spam-Status: No, score=-19.2 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: kernel-team@android.com, gprocida@google.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Following up on https://sourceware.org/pipermail/libabigail/2020q2/001973.html and https://sourceware.org/pipermail/libabigail/2020q2/002308.html, this patch series adds support for stable type ids in the form of a hash of libabigail's internal type names. The hash function used is 32-bit FNV-1a, resulting in 8 hex digit type ids - shorter than the existing (default) counter-based ids. mjw's suggestion could be accomodated as a third style. Hash collisions are resolved by linear probing. Tests so far have only found collisions caused by hashing identically-named distinct types. If anonymous structs, unions and enums are given unique but stable (internal) names, then the quality of this naming scheme will improve. In general, it takes about 77k distinct names to reach a probability of 0.5 of there being at least one collision. https://en.wikipedia.org/wiki/Birthday_problem#Probability_table FNV can accommodate other bit lengths. http://www.isthe.com/chongo/tech/comp/fnv Regards, Giuliano. Giuliano Procida (2): abg-writer: Add support for stable hash type ids. Add tests for abidw --type-id-style hash. doc/manuals/abidw.rst | 15 +- include/abg-writer.h | 10 ++ src/abg-writer.cc | 95 ++++++++++++- tests/data/Makefile.am | 9 ++ tests/data/test-read-dwarf/test0.hash.abi | 70 ++++++++++ tests/data/test-read-dwarf/test1.hash.abi | 129 ++++++++++++++++++ tests/data/test-read-dwarf/test2.so.hash.abi | 79 +++++++++++ tests/data/test-read-dwarf/test3.so.hash.abi | 19 +++ tests/data/test-read-dwarf/test4.so.hash.abi | 23 ++++ tests/data/test-read-dwarf/test5.o.hash.abi | 13 ++ tests/data/test-read-dwarf/test6.so.hash.abi | 42 ++++++ tests/data/test-read-dwarf/test7.so.hash.abi | 77 +++++++++++ .../test8-qualified-this-pointer.so.hash.abi | 37 +++++ tests/test-read-dwarf.cc | 107 ++++++++++++++- tools/abidw.cc | 20 ++- 15 files changed, 728 insertions(+), 17 deletions(-) create mode 100644 tests/data/test-read-dwarf/test0.hash.abi create mode 100644 tests/data/test-read-dwarf/test1.hash.abi create mode 100644 tests/data/test-read-dwarf/test2.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test3.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test4.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test5.o.hash.abi create mode 100644 tests/data/test-read-dwarf/test6.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test7.so.hash.abi create mode 100644 tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi