This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: Disallow protected data symbol with copy relocation?
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com, gcc at gcc dot gnu dot org,hongjiu dot lu at intel dot com
- Date: Thu, 20 Jan 2005 21:18:17 -0800
- Subject: Re: RFC: Disallow protected data symbol with copy relocation?
- References: <20050121045753.GA26471@lucon.org> <m3ekgfpdze.fsf@gossamer.airs.com>
On Fri, Jan 21, 2005 at 12:07:01AM -0500, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > Protected data symbol with copy relocation never works as intended.
> > The problem is with copy relocation, main and DSO see different
> > copies of the protected data symbol. Updating one won't change
> > the other. You can't compare their addresses either. There is no
> > easy way to get it to work unless the psABI is changed. I am proposing
> > to make linker to reject protected data symbol with copy relocation.
> > Any comments?
>
> Why would the linker ever generate a copy relocation for a protected
> symbol? I don't see how that makes sense.
>
For some psABIs, copy relocation is the normal way for main to access
data symbol on DSO. On ia32, you may generate writable text section
to work around it or compile main with PIC to avoid copy relocation.
But on x86_64, you may have to compile main with PIC.
H.J.