From patchwork Tue Jun 11 18:20:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 250602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7AC2B2C0091 for ; Wed, 12 Jun 2013 04:21:02 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=J2FAp+0N5YGNQbbn1 s+6Df6ALGqAqBEoWWPK1CzovRoloqH9xOnrbAWiCxVCUwlTDBEP+JI5lo4fWR/Ik nYq2vki8M7RFdnEeK6Sm8ow5U0qw7vg566SnacJ4TfoiSNVI3PeBZcgtkBzuoq2b 5nrBVd5VQKlmtjqJKDHson/siQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:in-reply-to; s=default; bh=dRG2iE7+khVc/N9J0ZzVY0L Hn2Q=; b=lxWacyLI8tZA4S+XIf6bSMu+Hf18VlguJkW37i1CInPLVdZLeFYYdYH bwW1CEIHAMCyhMGE9vNEJUbGzCH6FDuA3Kpz+d5V1pWUtLyIkIIn4GpgS70zWXJI W+PQiQvX8UEBrU3T38xLWmeBd7rwPSJPfw3h0cxVF66V3Jr9K6DM= Received: (qmail 8296 invoked by alias); 11 Jun 2013 18:20:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8287 invoked by uid 89); 11 Jun 2013 18:20:56 -0000 X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL, BAYES_20, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 11 Jun 2013 18:20:55 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5BIKrN6024559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jun 2013 14:20:54 -0400 Received: from zalov.cz (vpn-50-92.rdu2.redhat.com [10.10.50.92]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5BIKqYI007955 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Jun 2013 14:20:53 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r5BIKo4f007942; Tue, 11 Jun 2013 20:20:51 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r5BIKn6f007941; Tue, 11 Jun 2013 20:20:49 +0200 Date: Tue, 11 Jun 2013 20:20:48 +0200 From: Jakub Jelinek To: Richard Henderson Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix up decl_binds_to_current_def_p (PR target/56564) Message-ID: <20130611182048.GI2336@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20130611113151.GY1493@tucnak.redhat.com> <51B756BC.4000202@redhat.com> <20130611170313.GH2336@tucnak.redhat.com> <51B75BD9.4030908@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <51B75BD9.4030908@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) On Tue, Jun 11, 2013 at 10:18:17AM -0700, Richard Henderson wrote: > > 2) DECL_COMMON with non-default visibility - the old version would return > > true, now it returns false unless linker plugin tells us the current > > common was used > > > > Or do you think we should just do what we did before and just > > handle the 1) and 2) cases explicitly in the decl_binds_to_current_def_p > > function? > > This (2) sounds like something that we could handle in d_b_t_c_d_p without > having to duplicate all of binds_local_p. Ok, here are all the changes to d_b_t_c_d_p. Any holes in this? Untested so far. 2013-06-11 Jakub Jelinek PR target/56564 * varasm.c (decl_binds_to_current_def_p): Call binds_local_p target hook even for !TREE_PUBLIC decls. If no resolution info is available, return false for common and external decls. Jakub --- gcc/varasm.c.jj 2013-06-11 20:11:34.000000000 +0200 +++ gcc/varasm.c 2013-06-11 20:15:15.729363893 +0200 @@ -6781,10 +6781,10 @@ bool decl_binds_to_current_def_p (tree decl) { gcc_assert (DECL_P (decl)); - if (!TREE_PUBLIC (decl)) - return true; if (!targetm.binds_local_p (decl)) return false; + if (!TREE_PUBLIC (decl)) + return true; /* When resolution is available, just use it. */ if (TREE_CODE (decl) == VAR_DECL && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) @@ -6802,10 +6802,20 @@ decl_binds_to_current_def_p (tree decl) return resolution_to_local_definition_p (node->symbol.resolution); } /* Otherwise we have to assume the worst for DECL_WEAK (hidden weaks - binds locally but still can be overwritten). + binds locally but still can be overwritten), DECL_COMMON (can be merged + with a non-common definition somewhere in the same module) or + DECL_EXTERNAL. This rely on fact that binds_local_p behave as decl_replaceable_p for all other declaration types. */ - return !DECL_WEAK (decl); + if (DECL_WEAK (decl)) + return false; + if (DECL_COMMON (decl) + && (DECL_INITIAL (decl) == NULL + || DECL_INITIAL (decl) == error_mark_node)) + return false; + if (DECL_EXTERNAL (decl)) + return false; + return true; } /* A replaceable function or variable is one which may be replaced