This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: PIC is wasteful
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 24 Jun 2011 11:46:06 +0100
- Subject: Re: PIC is wasteful
- References: <4E03410F.10201@agner.org>
On 06/23/2011 02:35 PM, Agner Fog wrote:
> It is possible to put absolute addresses into a .so and it works. I
> tried this in Ubuntu, and it works with 32 bit absolute addresses in a
> 32 bit .so, and with 64 bit absolute addresses in a 64 bit .so. The only
> thing that doesn't work is 32 bit absolute addresses in a 64 bit so. In
> many cases, this is faster than making PIC. I guess this was implemented
> for the sake of virtual tables, jump tables, etc. My question is: Does
> this work in all versions of Linux, BSD, MacOS? Which platforms or
> versions do not allow absolute addresses in shared objects?
I don't understand how an absolute address can ever do anything useful
in a shared object. By definition, you don't know where that shared
object will be loaded. Can you provide an example of a 64-bit
absolute address in a 64-bit shared object?
Andrew.