This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ok to add -fPIC to non shared library?
Tim Pushor wrote:
>
> If you don't mind explaining a bit further, why exactly will it be slower?
> Ian Lance Taylor wrote:
is it ok to include -fPIC compiling C code to
>>> be included in a static library?
>>>
>>
>> Yes.
>>
>> However, the resulting executable will run slightly slower.
>>
I'd certainly like to see Ian's answer. Meanwhile, I'll offer:
This depends somewhat on the target platform. The fPIC code relocatable
and preemptible stuff involves an extra layer of indirection on function
calls. So, you are giving up some of the potential advantage of static
library.