Re: -fPIE and stuff
On Tue, Feb 14, 2012 at 11:09:44PM +0000, Sune Vuorela wrote:
> On 2012-02-14, Kurt Roeckx <kurt@roeckx.be> wrote:
> > It was always my understanding that protected wasn't useful,
> > because it's even more expensive.
>
> Can you come with a bit pointers or numbers about 'expensive' ?
So as far as I understand things the only way to make protected
work without -fPIE is using text relocations. This has the
following effects:
- The text segment can no longer be read-only, and so can't be
shared anymore.
- You need a relocation for each use of the variable.
And you really don't want text relocations.
> > As far as I understand things, this is supposed to work, and might
> > be a bug in the toolchain or dynamic linker. Which might also
> > mean that they're trying to make use of a bug in the toolchain.
>
> It is not a bug in the toolchain. It is how the processor specific ABI
> is.
I'm assuming that you're talking about the small model of amd64.
I can't see anything in the psABI that prevents this from working.
But implementing it with text relocations is something you
don't want, so I can understand that nobody implemented it.
The bug in the toolchain is that it allows you to create
broken binaries.
Anyway, to avoid the copy relocations, I suggest you hide the
symbol and make functions to be able to use it outside the DSO.
Kurt
Reply to: