This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PIC is wasteful


On 24-06-2011 12:38, Andrew Haley wrote:
On 06/24/2011 11:19 AM, Agner Fog wrote:
On 24-06-2011 10:23, Andrew Haley wrote:

Why does it make 32 bit absolute addresses when I specify
-mcmodel=medium?
Small symbols are placed in the lower 2G.
So I would have to replace all variables with very big arrays in order
to prevent 32 bit addresses in 64 bit mode :-(
What problem are you trying to solve?  I don't get it.  Why would you
want to avoid 32-bit absolute addresses?

Because the linker complains whenever there is a 32 bit absolute reference in a 64 bit shared object. I guess the .so can be loaded above the 2G address limit.

Apparently, the only way to avoid 32 bit addresses is compiling with -fpic, which has the undesired effect of using GOT and PLT entries which makes shared objects slower than static libraries. The seldom used feature to override a symbol comes at a high price.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]