[Nix-dev] Policy on -fPIC and static libraries

Eelco Dolstra e.dolstra at tudelft.nl
Mon Mar 9 13:45:11 CET 2009


Hi,

Lluís Batlle wrote:

> I thought of adding -fPIC only for x86_64, but afaik, in x86 -fPIC
> doesn't introduce performance penalities. Right?

Actually, I think it does, since PIC requires calling functions through a Global
Offset Table (GOT) instead of directly.

However, I don't care all that much about the performance of static libraries
:-)  In fact I would be in favour of disabling them by default except for
packages where we need them.

> What do you think about this? Do you know how other distros do? I
> think gentoo went on the adding -fPIC always for *any* libraries.

At least for libtool-based packages, libtool is supposed to only pass -fPIC for
shared libraries.

Turning on -fPIC by default would at least fix a bunch of packages on
x86_64-linux that forget to pass -fPIC for shared library builds.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list