This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: why does -fno-pic coge generation on x64 require the large model?
Eli Bendersky <eliben@gmail.com> writes:
> What I'm trying to see is how to convince GCC to generate NON-PIC code
> and link it into a shared library for x64. I only managed to do this
> with "-fno-PIC -mcmodel=large", and I wonder why with other memory
> models it doesn't work out. I suspect this has to do with some
> artifact of x64's addressing modes for symbol offsets.
Yes. If it were easy to permit non-PIC x86_64 code in a shared library,
gcc would do it. But the only way to do that is, as you say, to use the
large memory model, which is relatively inefficient.
Ian