PIC is wasteful
Andrew Haley
aph@redhat.com
Fri Jun 24 12:40:00 GMT 2011
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.
More information about the Gcc-help
mailing list