Md at debian.org

tales of a debian maintainer

The ultimate guide to -fPIC and libraries

(I recycled this from my debian-policy@ post. I painfully gained this knowledge when I packaged prelink.)

Having non-PIC shared libraries is not generally acceptable, but policy does not reflect the current practice.

Shared non-relocatable code is acceptable on the few architectures which can support it (i386 and maybe another one) only when there is a positive trade-off between the speed gained and the RAM wasted.

The most common situation where a non-PIC shared library is a good idea is when it contains hand-optimised assembly code. It may still be possible to rewrite it to be relocatable without a major performance loss, but it would probably take a lot of time. And again, very few architectures support non-PIC shared libraries at all: on most they would just not work.

Even if a library should be built non-PIC on a specific architecture I see no reason to make it static unless required by the system ABI, which definitely is not the case for i386.

About

This is the blog of Marco d'Itri.

S M T W T F S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

See also:

My blogroll:


W3C HTML 4.01
W3C CSS 2.0     

Powered by Bryar.pm.