From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2498 invoked by alias); 28 Nov 2017 15:25:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 2486 invoked by uid 89); 28 Nov 2017 15:25:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,KB_WAM_FROM_NAME_SINGLEWORD,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=tgt X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Nov 2017 15:25:19 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 266E680D for ; Tue, 28 Nov 2017 07:25:18 -0800 (PST) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C8E153F24A for ; Tue, 28 Nov 2017 07:25:17 -0800 (PST) References: <20170615122318.GC84372@kam.mff.cuni.cz> Subject: [arm-embedded] [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file To: "gcc-patches@gcc.gnu.org" From: Thomas Preudhomme X-Forwarded-Message-Id: <20170615122318.GC84372@kam.mff.cuni.cz> Message-ID: Date: Tue, 28 Nov 2017 15:49:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20170615122318.GC84372@kam.mff.cuni.cz> Content-Type: multipart/mixed; boundary="------------355722B3DB837B2B31F63F87" X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02409.txt.bz2 This is a multi-part message in MIME format. --------------355722B3DB837B2B31F63F87 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 657 Hi, We have decided to apply the forwarded patch to the embedded-7-branch to fix an ICE when doing partial LTO with weak symbols. ChangeLog entry is as follows: 2017-11-28 Thomas Preud'homme Backport from mainline 2017-06-15 Jan Hubicka Thomas Preud'homme PR lto/69866 * lto-symtab.c (lto_symtab_merge_symbols): Drop useless definitions that resolved externally. Backport from mainline 2017-06-15 Thomas Preud'homme PR lto/69866 * gcc.dg/lto/pr69866_0.c: New test. * gcc.dg/lto/pr69866_1.c: Likewise. Best regards, Thomas --------------355722B3DB837B2B31F63F87 Content-Type: message/rfc822; name="Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file.eml" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for wea"; filename*1="k alias in regular object file.eml" Content-length: 3298 Return-Path: X-Original-To: thomas.preudhomme@foss.arm.com Delivered-To: thomas.preudhomme@foss.arm.com Received: from foss.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTP id 3BEB73F41F for ; Thu, 15 Jun 2017 05:23:20 -0700 (PDT) Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0ACA580D for ; Thu, 15 Jun 2017 05:23:20 -0700 (PDT) Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 1FDC1546A30; Thu, 15 Jun 2017 14:23:19 +0200 (CEST) Date: Thu, 15 Jun 2017 14:23:19 +0200 From: Jan Hubicka To: Thomas Preudhomme Subject: Re: [PATCH, GCC/LTO, ping] Fix PR69866: LTO with def for weak alias in regular object file Message-ID: <20170615122318.GC84372@kam.mff.cuni.cz> References: <654b4277-ced9-e778-bcda-3054e1983727@foss.arm.com> <1db1d20c-6f06-9bd3-2e7d-e862e31199cd@foss.arm.com> <2924a838-1869-9cd4-8b32-3c2c51a12bc5@redhat.com> <2485e103-8b05-2019-10e2-b75d8cc0f374@foss.arm.com> <7a758c6f-31d5-7133-0df3-3258d08b6b56@foss.arm.com> <20170509223658.GB82149@kam.mff.cuni.cz> <530b495f-e3e8-8223-cda0-1fe0525ba46b@foss.arm.com> <8a00c450-6e44-560a-a00c-e44779626622@foss.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a00c450-6e44-560a-a00c-e44779626622@foss.arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Content-length: 1608 Hi, I am testing the following. Let me know if it works for you. Honza Index: lto/lto-symtab.c =================================================================== --- lto/lto-symtab.c (revision 249213) +++ lto/lto-symtab.c (working copy) @@ -952,6 +952,42 @@ if (tgt) node->resolve_alias (tgt, true); } + /* If the symbol was preempted outside IR, see if we want to get rid + of the definition. */ + if (node->analyzed + && !DECL_EXTERNAL (node->decl) + && (node->resolution == LDPR_PREEMPTED_REG + || node->resolution == LDPR_RESOLVED_IR + || node->resolution == LDPR_RESOLVED_EXEC + || node->resolution == LDPR_RESOLVED_DYN)) + { + DECL_EXTERNAL (node->decl) = 1; + /* If alias to local symbol was preempted by external definition, + we know it is not pointing to the local symbol. Remove it. */ + if (node->alias + && !node->weakref + && !node->transparent_alias + && node->get_alias_target ()->binds_to_current_def_p ()) + { + node->alias = false; + node->remove_all_references (); + node->definition = false; + node->analyzed = false; + node->cpp_implicit_alias = false; + } + else if (!node->alias + && node->definition + && node->get_availability () <= AVAIL_INTERPOSABLE) + { + if ((cnode = dyn_cast (node)) != NULL) + cnode->reset (); + else + { + node->analyzed = node->definition = false; + node->remove_all_references (); + } + } + } if (!(cnode = dyn_cast (node)) || !cnode->clone_of --------------355722B3DB837B2B31F63F87--