From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26894 invoked by alias); 4 Feb 2015 22:37:05 -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 26875 invoked by uid 89); 4 Feb 2015 22:37:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 04 Feb 2015 22:37:03 +0000 Received: by mail-oi0-f50.google.com with SMTP id h136so3692794oig.9 for ; Wed, 04 Feb 2015 14:37:01 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.198.214 with SMTP id w205mr395235oif.74.1423089421820; Wed, 04 Feb 2015 14:37:01 -0800 (PST) Received: by 10.76.134.102 with HTTP; Wed, 4 Feb 2015 14:37:01 -0800 (PST) In-Reply-To: References: <20150203193615.GZ1746@tucnak.redhat.com> <20150203221935.GA1746@tucnak.redhat.com> <20150204183127.GU1746@tucnak.redhat.com> <20150204184205.GW1746@tucnak.redhat.com> Date: Wed, 04 Feb 2015 22:37:00 -0000 Message-ID: Subject: Re: [PATCH x86_64] Optimize access to globals in "-fpie -pie" builds with copy relocations From: "H.J. Lu" To: Sriraman Tallam Cc: Jakub Jelinek , Uros Bizjak , "gcc-patches@gcc.gnu.org" , David Li , Cary Coutant Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00295.txt.bz2 On Wed, Feb 4, 2015 at 1:53 PM, Sriraman Tallam wrote: > On Wed, Feb 4, 2015 at 10:57 AM, H.J. Lu wrote: >> On Wed, Feb 4, 2015 at 10:51 AM, Sriraman Tallam wrote: >>> On Wed, Feb 4, 2015 at 10:45 AM, H.J. Lu wrote: >>>> On Wed, Feb 4, 2015 at 10:42 AM, Jakub Jelinek wrote: >>>>> On Wed, Feb 04, 2015 at 10:38:48AM -0800, H.J. Lu wrote: >>>>>> Common symbol should be resolved locally for PIE. >>>>> >>>>> binds_local_p yes, binds_to_current_def_p no. >>>>> >>>> >>>> Is SYMBOL_REF_LOCAL_P set to binds_local_p or >>>> binds_to_current_def_p? >>> >>> Looks like binds_local_p: >>> >>> varasm.c: >>> void >>> default_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED) >>> { >>> ... >>> if (targetm.binds_local_p (decl)) >>> flags |= SYMBOL_FLAG_LOCAL; >>> >> >> Why is SYMBOL_REF_LOCAL_P false? > > In varasm.c, default_binds_local_p_1 > > > /* Default visibility weak data can be overridden by a strong symbol > in another module and so are not local. */ > else if (DECL_WEAK (exp) > && !resolved_locally) ^^^^^^^^^^^^^^^^^^^ Why is resolved_locally false? It should be true for common symbol when compiling for PIE. > local_p = false; > > For weak definition, it is set to false here. > -- H.J.