From patchwork Fri Dec 3 11:46:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matthias_M=C3=A4nnich?= X-Patchwork-Id: 48463 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 DED2E385802A for ; Fri, 3 Dec 2021 12:09:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DED2E385802A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638533359; bh=hZ37SVMVlXFg5RqCmJteZ5FFc+kB4czgPWOpTqXnPc0=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=umjxXp9636gbvKVLhN4sIJYahgparyka12sQhpyfrMSOljkYtlkGQtyOo+oj4kNJ0 TcK35++IuSvcZgZHKIRKkp+sxlB0ObPGVhJD74adps3o1v+umdUepyukD0ykCzCYqq 8fbx6VUzcaQt7l15cXqBg2EsCvdts+16F12m8m0Y= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) by sourceware.org (Postfix) with ESMTPS id 0181D3858018 for ; Fri, 3 Dec 2021 12:09:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0181D3858018 Received: by mail-wm1-x34a.google.com with SMTP id k25-20020a05600c1c9900b00332f798ba1dso3349591wms.4 for ; Fri, 03 Dec 2021 04:09:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc:content-transfer-encoding; bh=hZ37SVMVlXFg5RqCmJteZ5FFc+kB4czgPWOpTqXnPc0=; b=7nS6C/lUipVMBCC1yPpnT9NaGMFrSRWyngdCHHwnVP2WWxPDcYnYh3l/gjx/6NWtUP zZ7PGKkuEKI7vFpuG63i5G6zt7qOjror5XnplhQfr8Qm9lDT0LcKH905za/wIS9E34rd zdR8VRjSKM23k13WoYBr9ydSpCyUV5KaBN881NTuEtKn+WmBtceMz26uQ5kaL5OOrKy0 WecgrZV04/cz+8DQ2qU0dIVmClCQjILeBr8tyDqr1ZKWrZMlhkMVaCGJTtd+mToMgUBU SHptSk9LK5jQQkQbuE5B/6SPMvoGEXcJkkw+PWYlUYKWceSxBrA7xbNeSofhojnOMwpi Jbcg== X-Gm-Message-State: AOAM530y9TFqPUJQoBWJQZmIUHcSGKuSHqX+s7OBEwvw+5z+GwCYhz4s GM8AzkETMUpZI6GVmKHHJXT4tTA9OfH75IZuSESyVjg6ZX12xGzAFblwcH0bmQXdqWXgU7eVPao VxLBi3Tachdx7j+KP8GJhSgSRo4O6hcCZ9ifYOv0cU+nXG6R2hO9E0C2ZhY/Ni3r19EVgM7I= X-Google-Smtp-Source: ABdhPJy+g97I+EqG3SGDjMMJs2DXzmIwWTO16qslfEiaoZKRzR4TODEtqXdn9Dh8qXrTKmtyxvkjsIZTkpEn/Q== X-Received: from lux.lon.corp.google.com ([2a00:79e0:d:210:47e9:78df:690b:201]) (user=maennich job=sendgmr) by 2002:a05:600c:4f44:: with SMTP id m4mr14837178wmq.95.1638533348861; Fri, 03 Dec 2021 04:09:08 -0800 (PST) Date: Fri, 3 Dec 2021 11:46:20 +0000 In-Reply-To: <20211203114622.2944173-1-maennich@google.com> Message-Id: <20211203114622.2944173-3-maennich@google.com> Mime-Version: 1.0 References: <20211203114622.2944173-1-maennich@google.com> X-Mailer: git-send-email 2.34.1.400.ga245620fadb-goog Subject: [PATCH 2/5] XML writer: use exemplar types for tracking referenced types To: libabigail@sourceware.org X-Spam-Status: No, score=-22.7 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Matthias Maennich via Libabigail From: =?utf-8?q?Matthias_M=C3=A4nnich?= Reply-To: Matthias Maennich Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" The emitted type sets are used with some referenced type sets (which use bare type pointers). To keep consistency between what is being recorded in each set, switch to storing exemplar type pointers in the referenced type sets. This change results in the omission of a small number of duplicate types from various test cases. In each case the duplicates were previously caused by a referenced type being emitted for one translation unit and then the same type being emitted as a canonical type for a later translation unit. It also causes the movement of some function types in some test cases. Some of those types are now considered referenced and appear earlier as a result. * src/abg-writer.cc (record_type_as_referenced): Use preferred type with referenced type sets. (type_is_referenced): Likewise. (tests/data/test-annotate/test14-pr18893.so.abi): Duplicate type(s) removed, as described above. (tests/data/test-read-dwarf/test14-pr18893.so.abi): Likewise. (tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi): Likewise. (tests/data/test-read-dwarf/test16-pr18904.so.abi): Likewise. (tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi): Likewise. (tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi): Likewise. (tests/data/test-read-dwarf/PR25007-sdhci.ko.abi): Some function type(s) reordered, as described above. (tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi): Likewise. (tests/data/test-annotate/test15-pr18892.so.abi):: Duplicate type(s) removed and some function type(s) reordered, as described above. (tests/data/test-read-dwarf/test15-pr18892.so.abi): Likewise. (tests/data/test-annotate/test21-pr19092.so.abi): Likewise. (tests/data/test-read-dwarf/test21-pr19092.so.abi): Likewise Reviewed-by: Giuliano Procida Signed-off-by: Matthias Maennich --- src/abg-writer.cc | 19 +- .../data/test-annotate/test14-pr18893.so.abi | 2 - .../data/test-annotate/test15-pr18892.so.abi | 44 +- ...19-pr19023-libtcmalloc_and_profiler.so.abi | 4 - .../data/test-annotate/test21-pr19092.so.abi | 26 +- .../data/test-read-dwarf/PR25007-sdhci.ko.abi | 434 +++++++++--------- .../PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi | 2 +- .../test-read-dwarf/test14-pr18893.so.abi | 1 - .../test-read-dwarf/test15-pr18892.so.abi | 28 +- .../test-read-dwarf/test16-pr18904.so.abi | 2 - ...19-pr19023-libtcmalloc_and_profiler.so.abi | 2 - .../test-read-dwarf/test21-pr19092.so.abi | 16 +- .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 1 - 13 files changed, 279 insertions(+), 302 deletions(-) diff --git a/src/abg-writer.cc b/src/abg-writer.cc index 9c3ae6f8d5b4..4cf2a7fb16af 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -542,18 +542,19 @@ public: /// /// @param t a shared pointer to a type void - record_type_as_referenced(const type_base_sptr& t) + record_type_as_referenced(const type_base_sptr& type) { + type_base* t = get_preferred_type(type.get()); // If the type is a function type, record it in a dedicated data // structure. - if (function_type* f = is_function_type(t.get())) + if (function_type* f = is_function_type(t)) m_referenced_fn_types_set.insert(f); else if (!t->get_naked_canonical_type()) // If the type doesn't have a canonical type, record it in a // dedicated data structure. - m_referenced_non_canonical_types_set.insert(t.get()); + m_referenced_non_canonical_types_set.insert(t); else - m_referenced_types_set.insert(t.get()); + m_referenced_types_set.insert(t); } /// Test if a given type has been referenced by a pointer, a @@ -564,17 +565,17 @@ public: /// @return true if the type has been referenced, false /// otherwise. bool - type_is_referenced(const type_base_sptr& t) + type_is_referenced(const type_base_sptr& type) { - if (function_type *f = is_function_type(t.get())) + type_base* t = get_preferred_type(type.get()); + if (function_type* f = is_function_type(t)) return (m_referenced_fn_types_set.find(f) != m_referenced_fn_types_set.end()); else if (!t->get_naked_canonical_type()) - return (m_referenced_non_canonical_types_set.find(t.get()) + return (m_referenced_non_canonical_types_set.find(t) != m_referenced_non_canonical_types_set.end()); else - return m_referenced_types_set.find - (t.get()) != m_referenced_types_set.end(); + return m_referenced_types_set.find(t) != m_referenced_types_set.end(); } /// A comparison functor to compare pointers to @ref type_base. diff --git a/tests/data/test-annotate/test14-pr18893.so.abi b/tests/data/test-annotate/test14-pr18893.so.abi index a5c30fb5b37d..2bcb3c519e20 100644 --- a/tests/data/test-annotate/test14-pr18893.so.abi +++ b/tests/data/test-annotate/test14-pr18893.so.abi @@ -965,8 +965,6 @@ - - diff --git a/tests/data/test-annotate/test15-pr18892.so.abi b/tests/data/test-annotate/test15-pr18892.so.abi index fbfa1da1a48a..582951a9f325 100644 --- a/tests/data/test-annotate/test15-pr18892.so.abi +++ b/tests/data/test-annotate/test15-pr18892.so.abi @@ -3302,42 +3302,38 @@ - - - - + + - + - - + + - - + + - + - - + + - - - + @@ -3352,7 +3348,7 @@ - + @@ -3417,7 +3413,7 @@ - + @@ -3432,7 +3428,7 @@ - + @@ -4802,8 +4798,6 @@ - - @@ -5704,8 +5698,6 @@ - - @@ -7568,15 +7560,15 @@ - + - + - + @@ -10061,7 +10053,7 @@ - + diff --git a/tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi b/tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi index c756cca7a542..18a4964be69c 100644 --- a/tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi +++ b/tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi @@ -2160,10 +2160,6 @@ - - - - diff --git a/tests/data/test-annotate/test21-pr19092.so.abi b/tests/data/test-annotate/test21-pr19092.so.abi index 5b17d83e7448..e009a191a42e 100644 --- a/tests/data/test-annotate/test21-pr19092.so.abi +++ b/tests/data/test-annotate/test21-pr19092.so.abi @@ -2537,11 +2537,6 @@ - - - - - @@ -2569,13 +2564,6 @@ - - - - - - - @@ -2594,6 +2582,18 @@ + + + + + + + + + + + + @@ -10843,7 +10843,7 @@ - + diff --git a/tests/data/test-read-dwarf/PR25007-sdhci.ko.abi b/tests/data/test-read-dwarf/PR25007-sdhci.ko.abi index b23715233e02..f3e2e259b803 100644 --- a/tests/data/test-read-dwarf/PR25007-sdhci.ko.abi +++ b/tests/data/test-read-dwarf/PR25007-sdhci.ko.abi @@ -10107,19 +10107,10 @@ - - - - - - - - - @@ -10147,10 +10138,6 @@ - - - - @@ -10177,9 +10164,6 @@ - - - @@ -10197,16 +10181,6 @@ - - - - - - - - - - @@ -10396,13 +10370,6 @@ - - - - - - - @@ -10552,31 +10519,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -10589,17 +10531,6 @@ - - - - - - - - - - - @@ -10660,10 +10591,6 @@ - - - - @@ -10704,22 +10631,6 @@ - - - - - - - - - - - - - - - - @@ -10835,10 +10746,6 @@ - - - - @@ -10863,14 +10770,6 @@ - - - - - - - - @@ -10916,9 +10815,6 @@ - - - @@ -10963,15 +10859,6 @@ - - - - - - - - - @@ -10998,44 +10885,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -11069,18 +10923,6 @@ - - - - - - - - - - - - @@ -11094,14 +10936,6 @@ - - - - - - - - @@ -11115,13 +10949,6 @@ - - - - - - - @@ -11248,26 +11075,12 @@ - - - - - - - - - - - - - - @@ -11311,15 +11124,6 @@ - - - - - - - - - @@ -11388,19 +11192,10 @@ - - - - - - - - - @@ -11415,10 +11210,6 @@ - - - - @@ -11433,9 +11224,6 @@ - - - @@ -11453,6 +11241,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11472,11 +11477,6 @@ - - - - - diff --git a/tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi b/tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi index 0e6e8af45fc0..4a84fe97a226 100644 --- a/tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi +++ b/tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi @@ -476,11 +476,11 @@ + - diff --git a/tests/data/test-read-dwarf/test14-pr18893.so.abi b/tests/data/test-read-dwarf/test14-pr18893.so.abi index cad90c1c61cc..4ed7a8cdcb42 100644 --- a/tests/data/test-read-dwarf/test14-pr18893.so.abi +++ b/tests/data/test-read-dwarf/test14-pr18893.so.abi @@ -604,7 +604,6 @@ - diff --git a/tests/data/test-read-dwarf/test15-pr18892.so.abi b/tests/data/test-read-dwarf/test15-pr18892.so.abi index a4f0b7fa2815..7f885838c344 100644 --- a/tests/data/test-read-dwarf/test15-pr18892.so.abi +++ b/tests/data/test-read-dwarf/test15-pr18892.so.abi @@ -1683,25 +1683,23 @@ - - + - + - + - + - - + @@ -1709,7 +1707,7 @@ - + @@ -1746,7 +1744,7 @@ - + @@ -1754,7 +1752,7 @@ - + @@ -2653,7 +2651,6 @@ - @@ -3228,7 +3225,6 @@ - @@ -4268,11 +4264,11 @@ - - + + - + @@ -5729,7 +5725,7 @@ - + diff --git a/tests/data/test-read-dwarf/test16-pr18904.so.abi b/tests/data/test-read-dwarf/test16-pr18904.so.abi index ed1f9b07403b..b4dd1ee75cc8 100644 --- a/tests/data/test-read-dwarf/test16-pr18904.so.abi +++ b/tests/data/test-read-dwarf/test16-pr18904.so.abi @@ -2160,8 +2160,6 @@ - - diff --git a/tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi b/tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi index 6def22d56114..da5bb27f4c51 100644 --- a/tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi +++ b/tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi @@ -1185,8 +1185,6 @@ - - diff --git a/tests/data/test-read-dwarf/test21-pr19092.so.abi b/tests/data/test-read-dwarf/test21-pr19092.so.abi index c32385188030..c10916fa7484 100644 --- a/tests/data/test-read-dwarf/test21-pr19092.so.abi +++ b/tests/data/test-read-dwarf/test21-pr19092.so.abi @@ -1516,9 +1516,6 @@ - - - @@ -1534,10 +1531,6 @@ - - - - @@ -1548,6 +1541,13 @@ + + + + + + + @@ -7000,7 +7000,7 @@ - + diff --git a/tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi b/tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi index 288abf42f36a..46952f55eeb9 100644 --- a/tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi +++ b/tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi @@ -4356,7 +4356,6 @@ -