From patchwork Tue Jan 26 14:09:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 41819 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 A2CBD3851C01; Tue, 26 Jan 2021 14:09:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2CBD3851C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611670177; bh=KGoLeVymiYHuMZ7qCKo4f8eJQlMQ6SSD8CDdkKgPBrE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=iyk2cvLDffGDBUBq5MlIo9MiGon/J6gaZiDg4W/yIR4sM7vZ1dVksTLmFvZp+4aQu rge93JsUwJQl5eiUN4NnBcyYq4faMHc53ATG6N1oHfxuz0u/t6JSNuSN5nlkWGKHhb CmP8w/+HGpWFw6kQwFsDterQ3+jOwWu9r3H76pSA= 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 ESMTP id 222E7385DC1A for ; Tue, 26 Jan 2021 14:09:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 222E7385DC1A Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-agARCgUoPxaZuK9xaFFuUw-1; Tue, 26 Jan 2021 09:09:32 -0500 X-MC-Unique: agARCgUoPxaZuK9xaFFuUw-1 Received: by mail-wr1-f71.google.com with SMTP id l10so11195026wry.16 for ; Tue, 26 Jan 2021 06:09:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=KGoLeVymiYHuMZ7qCKo4f8eJQlMQ6SSD8CDdkKgPBrE=; b=kp0AE0kI7HSZk37psPQqp1Sdu3iX/V48D1In7TSP9vRY54ApQ2sXz6eiaX3gt6YYCV CgzNBO1P7ypaZzCMtzZq9QyCd7Q8SwOdso0kKmxktUI1cYLWDa0Fkz/Gd2yN63ZWlNLE +7tXP3umZDn/JqBDv3GVnVz/dfvkxmyVZxn82YiF11yIKF/plTOPN0foeYmcS8vUy3AA QXKGrSQtAXAa6C28u9cP9Js4sGoBoEUGMa2VRrAFfSX9zvyFoxuV/TCSYdLtl0mhD2j9 XDqZZRuIpHLMPmCOIHTtGsmG5c7vNU1XwRgXE9kP3JltGgUE9dIylLQ6UKu1wgPqv5bY LLvg== X-Gm-Message-State: AOAM533bhpmiURTPxuryKpV9itHzATQlKfFhbX5KPfYdNNuZylfzZMkF Lrr1Bd73JIk7+Lg3vomontUyFcL7hQQOiuB5giXgjEtosYMRj8Zh3thmw0bG27BShY38wVF6uzP 3Prxp0+pAbdrKpx2b5ItzQ7ouBP6cgRxui93gm0NjvbaYEZ3YWhK+LcVuNog7DCgCrl/N X-Received: by 2002:a5d:6c6d:: with SMTP id r13mr6380079wrz.343.1611670171345; Tue, 26 Jan 2021 06:09:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJw689FH0GoLrAP61KRfS3XtYgYacJA9/3jok5u+zShYvvnFnRgIFWfeMLUkNII0HGL31//6WQ== X-Received: by 2002:a5d:6c6d:: with SMTP id r13mr6380043wrz.343.1611670171051; Tue, 26 Jan 2021 06:09:31 -0800 (PST) Received: from localhost (91-166-131-65.subs.proxad.net. [91.166.131.65]) by smtp.gmail.com with ESMTPSA id s24sm3444482wmh.22.2021.01.26.06.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 06:09:30 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 782B7581CAC; Tue, 26 Jan 2021 15:09:28 +0100 (CET) To: libabigail@sourceware.org Subject: [PATCH] Bug 27233 - fedabipkgdiff fails on package gnupg2 from Fedora 33 Organization: Red Hat / France X-Operating-System: Fedora 34 X-URL: http://www.redhat.com Date: Tue, 26 Jan 2021 15:09:28 +0100 Message-ID: <87o8hbhjs7.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=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" Hello, At the core of this issue, Libabigail is failing to canonicalize some types in some cases. And that is triggering the assertion at the end of hash_as_canonical_type_or_constant when emitting ABIXML. It turns out read_context::canonicalize_types_scheduled in the dwarf reader sometimes fails to canonicalize the types contained in read_context::extra_types_to_canonicalize(). This patch fixes that. Incidentally, this patch also fixes a previous issue where hash_as_canonical_type_or_constant would hit that assert at its end because of non-canonicalized function types. I am now removing the band-aid I put in place at the time by loosening the assertion there. * src/abg-dwarf-reader.cc (read_context::canonicalize_types_scheduled): Don't forget to canonicalize types stored in extra_types_to_canonicalize_. * src/abg-ir.cc (type_base::get_canonical_type_for): Add better comment. (hash_as_canonical_type_or_constant): Remove crutch that is useless now that we canonicalize almost all types in the system. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 3 ++- src/abg-ir.cc | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index f95dbb98..099bff75 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -4895,7 +4895,8 @@ public: cn_timer.start(); } - if (!types_to_canonicalize(source).empty()) + if (!types_to_canonicalize(source).empty() + || !extra_types_to_canonicalize().empty()) { tools_utils::timer single_type_cn_timer; size_t total = types_to_canonicalize(source).size(); diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 6d7a60a6..d1d02f3a 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -12367,7 +12367,14 @@ type_base::get_canonical_type_for(type_base_sptr t) class_or_union_sptr class_or_union = is_class_or_union_type(t); - // Look through declaration-only classes + // Look through declaration-only classes when we are dealing with + // C++ or languages where we assume the "One Definition Rule". In + // that context, we assume that a declaration-only non-anonymous + // class equals all fully defined classes of the same name. + // + // Otherwise, all classes, including declaration-only classes are + // canonicalized and only canonical comparison is going to be used + // in the system. if (decl_only_class_equals_definition) if (class_or_union) { @@ -23419,8 +23426,7 @@ hash_as_canonical_type_or_constant(const type_base *t) // non-canonicalized type. It must be a decl-only class or a // function type, otherwise it means that for some weird reason, the // type hasn't been canonicalized. It should be! - ABG_ASSERT(is_declaration_only_class_or_union_type(t) - || is_function_type(t)); + ABG_ASSERT(is_declaration_only_class_or_union_type(t)); return 0xDEADBABE; }