why does -fno-pic coge generation on x64 require the large model?

Eli Bendersky eliben@gmail.com
Mon Nov 7 11:39:00 GMT 2011


Hello,

I'm experimenting with generating PIC and non-PIC code on x64 Ubuntu.
It's possible to generate non PIC code as follows:

  gcc -fno-PIC -mcmodel=large -shared -c file.c

However, I noticed that for other models (i.e. -mcmodel=small, or by
default, without the -mcmodel argument), the code being generated is
not really suitable for PIC as it has problematic load-time
relocations.

My question is - why is the large model required to generate true PIC code?

Thanks in advance,
Eli



More information about the Gcc-help mailing list