From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32355 invoked by alias); 5 Feb 2015 22:47:18 -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 32339 invoked by uid 89); 5 Feb 2015 22:47:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.2 required=5.0 tests=BAYES_40,FREEMAIL_FROM,KAM_STOCKGEN,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 05 Feb 2015 22:47:16 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJUql-0002Bb-Dl for gcc-patches@gcc.gnu.org; Thu, 05 Feb 2015 17:24:40 -0500 Received: from mail-ob0-x236.google.com ([2607:f8b0:4003:c01::236]:57633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJUql-0002B6-95 for gcc-patches@gcc.gnu.org; Thu, 05 Feb 2015 17:24:39 -0500 Received: by mail-ob0-f182.google.com with SMTP id nt9so9668797obb.13 for ; Thu, 05 Feb 2015 14:23:53 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.246.69 with SMTP id xu5mr289360obc.11.1423175033410; Thu, 05 Feb 2015 14:23:53 -0800 (PST) Received: by 10.76.134.102 with HTTP; Thu, 5 Feb 2015 14:23:53 -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> <50365BC5-5D7C-423A-803B-F8F6F040C865@gmail.com> <54D3BC5B.3080300@redhat.com> <54D3CB8E.3050004@redhat.com> Date: Thu, 05 Feb 2015 22:47: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: Richard Henderson , Bernhard Reutner-Fischer , Jakub Jelinek , Uros Bizjak , "gcc-patches@gcc.gnu.org" , David Li , Cary Coutant Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::236 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00365.txt.bz2 On Thu, Feb 5, 2015 at 2:05 PM, Sriraman Tallam wrote: > On Thu, Feb 5, 2015 at 11:59 AM, Richard Henderson wrote: >> On 02/05/2015 11:01 AM, H.J. Lu wrote: >>> Can you elaborate why it depends on COPY relocation? There >>> is no COPY relocation on x86-64. >> >> Ho hum, we appear to have switched topics mid-thread. >> >> I agree that we cannot override a weak symbol in the executable with even a >> non-weak symbol in a shared library. > > Hi HJ, > > Is your patch supposed to fix weak symbols too? Will > SYMBOL_REF_LOCAL_P evaluate to true for weak defined symbols with this > patch? I tested this in gcc-4_9 and it didnt seem to do that. I am working on a comprehensive patch. I will post it after testing is finished. -- H.J. -- [hjl@gnu-6 copyreloc-3]$ cat initweak.i __attribute__((weak)) int xxxxxxxxxxxx = -1; int foo () { return xxxxxxxxxxxx; } [hjl@gnu-6 copyreloc-3]$ cat commonweak.i __attribute__((weak)) int xxxxxxxxxxxx; int foo () { return xxxxxxxxxxxx; } [hjl@gnu-6 copyreloc-3]$ make initweak.s commonweak.s /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -pie -fpie -O3 -fuse-ld=gold -S initweak.i /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -pie -fpie -O3 -fuse-ld=gold -S commonweak.i [hjl@gnu-6 copyreloc-3]$ cat commonweak.s initweak.s .file "commonweak.i" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc movl xxxxxxxxxxxx(%rip), %eax ret .cfi_endproc .LFE0: .size foo, .-foo .section .text.unlikely .LCOLDE0: .text .LHOTE0: .weak xxxxxxxxxxxx .bss .align 4 .type xxxxxxxxxxxx, @object .size xxxxxxxxxxxx, 4 xxxxxxxxxxxx: .zero 4 .ident "GCC: (GNU) 5.0.0 20150205 (experimental)" .section .note.GNU-stack,"",@progbits .file "initweak.i" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc movl xxxxxxxxxxxx(%rip), %eax ret .cfi_endproc .LFE0: .size foo, .-foo .section .text.unlikely .LCOLDE0: .text .LHOTE0: .weak xxxxxxxxxxxx .data .align 4 .type xxxxxxxxxxxx, @object .size xxxxxxxxxxxx, 4 xxxxxxxxxxxx: .long -1 .ident "GCC: (GNU) 5.0.0 20150205 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 copyreloc-3]$