From patchwork Wed Aug 11 16:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 44638 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 92FE1383A832 for ; Wed, 11 Aug 2021 16:04:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92FE1383A832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628697884; bh=OJQl/dN7dIi69FoFlcppyBLIX/48hWJLFro+ZGblHrg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=MRb7lpgwhkh2yxqjY5Llo7aSuJ+lNucKs/CYVXSA6V+C48NGS8Y1+OWiguhjgpGmr qHtvAEdPFGUITvbTpYVpbn//P3uEROCNOJAMSX37cMdFBLcf2bBwRGLKv809dIoWUc kdhzZy9FFo+tvRjZwMExPck/Cdq/I15mO5EndjGc= 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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id EC306385841C for ; Wed, 11 Aug 2021 16:04:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC306385841C Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53-I-MPlsY7MeeLr5x-PudPWw-1; Wed, 11 Aug 2021 12:04:29 -0400 X-MC-Unique: I-MPlsY7MeeLr5x-PudPWw-1 Received: by mail-wm1-f70.google.com with SMTP id c2-20020a7bc8420000b0290238db573ab7so2251302wml.5 for ; Wed, 11 Aug 2021 09:04:29 -0700 (PDT) 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=OJQl/dN7dIi69FoFlcppyBLIX/48hWJLFro+ZGblHrg=; b=C86BetyVw1WPFsPUV2+/f7ZF9G9vqNWBP8vKZkkKtTfZfG3pZyeZ1CGMt28XJxJ6vp UrdKEUj321t2b4paPszhLhgFzR79QojEEIAVFjsZf3iGG4qWLglhXSJyRpoK/rCQVznE j2ZdeZOKVABc9MYW9XsQyU2zLRtf3xfuvtjx4lYQULzgUNC6s93MYV1BL9YUyvh8HsZc HhC5HSxafdRt5hY2d15fBVwxCwefjkP0smYa79qr0XGHXPf2HDXIDti4wDmz2/25JLMe BVSBDn9rNtxw8um5WfmdEnPojQL3Ihv3feZ+ANbIWatkjQfHuy8dwep6J0cw/XdoxeSf MPvw== X-Gm-Message-State: AOAM533zGKaoFEJlfp22cpLVD2DGbtDIfO+gdJnFpYWgwfKHV67Ibj+3 tAN7ne0QU7h2dQOEtx7/ePAoRM7wvjLvY6bnvmJOULK6PCo7IGfNydAtIfzL07hUMqkfSMt6azf eQdQed0MdFfZxviHq4sqF4nQbPUuVw1+3BvsrDcTFn46Vtj/7pw9G8ZfT+pfnw/pZqL37 X-Received: by 2002:a1c:27c2:: with SMTP id n185mr27956414wmn.20.1628697867944; Wed, 11 Aug 2021 09:04:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOvssxJd4uAOMl0FQZLLUEIbgf4/8xUdvDPnSAGozVPqVWEc/h0SutNPnQHjVzc8I8H4TmJg== X-Received: by 2002:a1c:27c2:: with SMTP id n185mr27956401wmn.20.1628697867723; Wed, 11 Aug 2021 09:04:27 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id l38sm5902519wmp.15.2021.08.11.09.04.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 09:04:27 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 5898A5800FB; Wed, 11 Aug 2021 18:04:23 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH 3/8, applied] ir: Tighten type comparison optimization for Linux kernel binaries Organization: Red Hat / France X-Operating-System: Fedora 35 X-URL: http://www.redhat.com Date: Wed, 11 Aug 2021 18:04:23 +0200 Message-ID: <87y298c6ig.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=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, types_defined_same_linux_kernel_corpus_public() performs an optimization while comparing two types in the context of the Linux kernel. If two types of the same kind and name are defined in the same corpus and in the same file, then they ought to be equal. For two anonymous classes that have naming typedefs, the function forgets to ensure that the naming typedefs have the same name. I have no binary that exhibits the potential issue, but I stumbled upon the problem while looking at something else that uncovered the problem. This change doesn't impact any of the binaries of the regression suite at the moment, though. Fixed thus. * src/abg-ir.cc (types_defined_same_linux_kernel_corpus_public): Ensure that anonymous classes with naming typedefs have identical typedef names. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 8e00eabf..f7739186 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -13161,6 +13161,16 @@ types_defined_same_linux_kernel_corpus_public(const type_base& t1, || (c2 && c2->get_is_anonymous() && !c2->get_naming_typedef())) return false; + // Two anonymous classes with naming typedefs should have the same + // typedef name. + if (c1 + && c2 + && c1->get_is_anonymous() && c1->get_naming_typedef() + && c2->get_is_anonymous() && c2->get_naming_typedef()) + if (c1->get_naming_typedef()->get_name() + != c2->get_naming_typedef()->get_name()) + return false; + // Two anonymous enum types cannot be eligible to this optimization. if (const enum_type_decl *e1 = is_enum_type(&t1)) if (const enum_type_decl *e2 = is_enum_type(&t2))