Ansgar <ans...@debian.org> writes: > On Thu, 2019-05-23 at 10:50 +0000, Dudziak Krzysztof wrote:
>> Isn't it that way for shared libraries IN GENERAL to need be compiled >> as position-independent code then linked as such ? > No, one could also register the virtual addresses for all shared > libraries in a central database and make sure they don't conflict. My understanding (supported by some quick StackOverflow research) is that it continues to be possible to build shared libraries without PIC. What happens in that case is that the dynamic loader then rewrites the text segment for wherever the shared library is loaded. This in turn means that the shared library cannot be shared in memory between multiple programs that load it (and it's slow on startup, of course). PIC code incurs a performance penalty, particularly on register-starved architectures such as 32-bit x86, so some highly performance-sensitive upstreams will chose to make this trade-off and build non-PIC shared libraries (although it's far more common in this case to just provide static libraries and not use shared libraries at all). This part of Policy is trying to address what a Debian packager should do when running into that situation. -- Russ Allbery (r...@debian.org) <http://www.eyrie.org/~eagle/>