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: why does -fno-pic coge generation on x64 require the large model?


Eli Bendersky <eliben@gmail.com> writes:

> 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?

It's odd to try to create PIC while using -fno-PIC.  I think you must
have some goal in mind for what you want your generated code to look
like, but I don't know what that is.  It most likely does not correspond
to gcc's goal when using -fno-PIC, which is to not generate PIC.

Ian


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