On Thu, May 23, 2019 at 10:39:39AM -0700, Russ Allbery 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. Text relocations are forbidden at least on amd64 though. https://stackoverflow.com/questions/7865059/why-does-gcc-force-pic-for-x64-shared-libs -- WBR, wRAR
Attachment:
signature.asc
Description: PGP signature