From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8653 invoked by alias); 3 Sep 2014 07:25:42 -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 8644 invoked by uid 89); 3 Sep 2014 07:25:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 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-wg0-f47.google.com Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 03 Sep 2014 07:25:40 +0000 Received: by mail-wg0-f47.google.com with SMTP id z12so8029976wgg.30 for ; Wed, 03 Sep 2014 00:25:37 -0700 (PDT) X-Received: by 10.180.14.2 with SMTP id l2mr33764730wic.50.1409729137438; Wed, 03 Sep 2014 00:25:37 -0700 (PDT) Received: from 188045204246.atmpu0063.highway.a1.net (188045204246.atmpu0063.highway.a1.net. [188.45.204.246]) by mx.google.com with ESMTPSA id r19sm2846917wik.0.2014.09.03.00.25.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 00:25:36 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <54062B52.9040706@redhat.com> References: <54062B52.9040706@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH x86_64] Optimize access to globals in "-fpie -pie" builds with copy relocations From: Bernhard Reutner-Fischer Date: Wed, 03 Sep 2014 07:25:00 -0000 To: Richard Henderson ,Sriraman Tallam ,GCC Patches ,David Li ,Cary Coutant ,Ian Lance Taylor ,Paul Pluzhnikov Message-ID: <48b41f33-b2a5-4813-a520-766fdd909bc8@email.android.com> X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00201.txt.bz2 On 2 September 2014 22:40:50 CEST, Richard Henderson wrote: >On 06/20/2014 05:17 PM, Sriraman Tallam wrote: >> Index: config/i386/i386.c >> =================================================================== >> --- config/i386/i386.c (revision 211826) >> +++ config/i386/i386.c (working copy) >> @@ -12691,7 +12691,9 @@ legitimate_pic_address_disp_p (rtx disp) >> return true; >> } >> else if (!SYMBOL_REF_FAR_ADDR_P (op0) >> - && SYMBOL_REF_LOCAL_P (op0) >> + && (SYMBOL_REF_LOCAL_P (op0) >> + || (TARGET_64BIT && ix86_copyrelocs && flag_pie >> + && !SYMBOL_REF_FUNCTION_P (op0))) >> && ix86_cmodel != CM_LARGE_PIC) >> return true; >> break; > >This is the wrong place to patch. > >You ought to be adjusting SYMBOL_REF_LOCAL_P, by providing a modified >TARGET_BINDS_LOCAL_P. > >Note in particular that I believe that you are doing the wrong thing >with weak >and COMMON symbols, in that you probably ought not force a copy reloc >there. > >Note the complexity of default_binds_local_p_1, and the fact that all >you >really want to modify is > > /* If PIC, then assume that any global name can be overridden by > symbols resolved from other modules. */ > else if (shlib) > local_p = false; > >near the bottom of that function. Reminds me of PR32219 https://gcc.gnu.org/ml/gcc-patches/2010-03/msg00665.html but admittedly that is not PIE imposed but still fails on current trunk..