ok to add -fPIC to non shared library?

Tim Prince TimothyPrince@sbcglobal.net
Mon May 25 18:14:00 GMT 2009


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.



More information about the Gcc-help mailing list