From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10409 invoked by alias); 1 Feb 2005 05:50:23 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 9922 invoked from network); 1 Feb 2005 05:50:19 -0000 Received: from unknown (HELO sccrmhc13.comcast.net) (204.127.202.64) by sourceware.org with SMTP; 1 Feb 2005 05:50:19 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (sccrmhc13) with ESMTP id <20050201055019016004bqibe>; Tue, 1 Feb 2005 05:50:19 +0000 Received: by lucon.org (Postfix, from userid 1000) id A5DBA63FD1; Mon, 31 Jan 2005 21:50:18 -0800 (PST) Date: Tue, 01 Feb 2005 05:50:00 -0000 From: "H. J. Lu" To: Andreas Jaeger , Andreas Schwab , Jakub Jelinek , binutils@sources.redhat.com Subject: Re: PATCH: Properly handle protected function for ia32 and x86_64 Message-ID: <20050201055018.GA5076@lucon.org> References: <20050120004032.GA5734@lucon.org> <20050120015519.GA3810@bubble.modra.org> <20050120031709.GA7990@lucon.org> <20050120042234.GB3810@bubble.modra.org> <20050120063839.GA9529@lucon.org> <20050120173353.GA16486@lucon.org> <20050124232617.GA18791@lucon.org> <20050201045110.GO11595@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050201045110.GO11595@bubble.modra.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-02/txt/msg00012.txt.bz2 On Tue, Feb 01, 2005 at 03:21:10PM +1030, Alan Modra wrote: > On Sun, Jan 30, 2005 at 11:22:29AM +0100, Andreas Jaeger wrote: > > "H. J. Lu" writes: > > > * elf32-i386.c (elf_i386_relocate_section): Disallow R_386_GOTOFF > > > against protected function when building shared library. > > > > > > PR 584 > > > * elf64-x86-64.c (is_32bit_relative_branch): New. > > > (elf64_x86_64_relocate_section): Alllow R_X86_64_PC32 on a > > > protected function symbol when building shared library for > > > 32bit relative branch instruction. > > > > I approve the x86-64 part of the patch but would suggest that you wait > > another day for comments before checking in, > > I'm not happy with the i386 one, because conceptually there isn't any > reason why the GOT of a shared library can't contain an entry for a > protected symbol. I believe such a shared lib will work properly, so it > isn't appropriate to issue an error. The problem occurs when an > executable tries to reference such a symbol, and copy relocs are > involved. Please check it again. It is R_386_GOTOFF against protected FUNCTION symbol. It has nothing to do with copy relocation. It is the function pointer problem with protected function. > > I think you should *warn* that a shared library built with protected > data symbols may result in non-shared text pages for apps linked against > the lib, and force elimination of the copy reloc when building apps > against such libs. Another issue is whether seeing a GOTOFF reloc > against a protected symbol is a sufficient indicator of a problematic > shared lib. ie. Perhaps there are other relocs used when different code > sequences in a shared lib access the lib's protected data. > What you described is my proposal: http://sources.redhat.com/ml/binutils/2005-01/msg00349.html I will implement it when I find time. H.J.