This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Properly handle protected function for ia32 and x86_64
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Andreas Jaeger <aj at suse dot de>
- Cc: "H. J. Lu" <hjl at lucon dot org>, Andreas Schwab <schwab at suse dot de>,Jakub Jelinek <jakub at redhat dot com>, binutils at sources dot redhat dot com
- Date: Tue, 1 Feb 2005 15:21:10 +1030
- Subject: Re: PATCH: Properly handle protected function for ia32 and x86_64
- References: <20050119230544.GF4777@sunsite.mff.cuni.cz> <20050120004032.GA5734@lucon.org> <20050120015519.GA3810@bubble.modra.org> <20050120031709.GA7990@lucon.org> <20050120042234.GB3810@bubble.modra.org> <20050120063839.GA9529@lucon.org> <jewtu8tne4.fsf@sykes.suse.de> <20050120173353.GA16486@lucon.org> <20050124232617.GA18791@lucon.org> <hod5vnqkre.fsf@reger.suse.de>
On Sun, Jan 30, 2005 at 11:22:29AM +0100, Andreas Jaeger wrote:
> "H. J. Lu" <hjl@lucon.org> 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.
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.
--
Alan Modra
IBM OzLabs - Linux Technology Centre