From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84176 invoked by alias); 6 Mar 2015 22:54:51 -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 84142 invoked by uid 89); 6 Mar 2015 22:54:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ob0-f172.google.com Received: from mail-ob0-f172.google.com (HELO mail-ob0-f172.google.com) (209.85.214.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 06 Mar 2015 22:54:50 +0000 Received: by obcwo20 with SMTP id wo20so23669871obc.5 for ; Fri, 06 Mar 2015 14:54:48 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.210.197 with SMTP id mw5mr13016749obc.26.1425682488216; Fri, 06 Mar 2015 14:54:48 -0800 (PST) Received: by 10.76.134.102 with HTTP; Fri, 6 Mar 2015 14:54:48 -0800 (PST) In-Reply-To: References: Date: Fri, 06 Mar 2015 22:54:00 -0000 Message-ID: Subject: Re: RFC: PATCHES: Properly handle reference to protected data on x86 From: "H.J. Lu" To: GCC Patches , GNU C Library , Binutils Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00403.txt.bz2 On Thu, Mar 5, 2015 at 6:39 AM, H.J. Lu wrote: > On Wed, Mar 4, 2015 at 3:26 PM, H.J. Lu wrote: >> Protected symbol means that it can't be pre-emptied. It >> doesn't mean its address won't be external. This is true >> for pointer to protected function. With copy relocation, >> address of protected data defined in the shared library may >> also be external. We only know that for sure at run-time. >> Here are patches for glibc, binutils and GCC to handle it >> properly. >> >> Any comments? > > This is the binutils patch I checked in. It basically reverted > the change for > > https://sourceware.org/bugzilla/show_bug.cgi?id=15228 > > on x86. Copy relocations against protected symbols should > work. > > -- > H.J. > --- > bfd/ > > PR ld/pr15228 > PR ld/pr17709 > * elf-bfd.h (elf_backend_data): Add extern_protected_data. > * elf32-i386.c (elf_backend_extern_protected_data): New. > Defined to 1. > * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. > * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on > copy relocs against protected symbols if extern_protected_data > is true. > (_bfd_elf_symbol_refs_local_p): Don't return true on protected > non-function symbols if extern_protected_data is true. > * elfxx-target.h (elf_backend_extern_protected_data): New. > Default to 0. > (elfNN_bed): Initialize extern_protected_data with > elf_backend_extern_protected_data. > > ld/testsuite/ > > PR ld/pr15228 > PR ld/pr17709 > * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. > * ld-i386/pr17709-nacl.rd: New file. > * ld-i386/pr17709.rd: Likewise. > * ld-i386/pr17709a.s: Likewise. > * ld-i386/pr17709b.s: Likewise. > * ld-i386/protected3.d: Updated. > * ld-i386/protected3.s: Likewise. > * ld-x86-64/pr17709-nacl.rd: New file. > * ld-x86-64/pr17709.rd: Likewise. > * ld-x86-64/pr17709a.s: Likewise. > * ld-x86-64/pr17709b.s: Likewise. > * ld-x86-64/protected3.d: Updated. > * ld-x86-64/protected3.s: Likewise. > * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709. I back ported it to 2.25 branch. -- H.J.