<div dir="ltr">Suppose I have some module Foo with foreign exports. On some platforms I can do something like:<div><br></div><div>ghc -static -shared Foo.o ...</div><div><br></div><div>The resulting shared library would have the base libraries and the RTS statically linked in. From what I understand this is possible on BSDs because generating PIC is the default there (for making PIEs I'd imagine), and possible on Windows because the dynamic loading process involves some technique that doesn't require PIC. On Linux (at least x86_64) this doesn't work by default since libHSbase, libHSrts et al. are not built with -fPIC unless one specifically asks for it when building GHC. As far as I know this is the only way to get -static -shared to work on this platform.</div><div><br></div><div>While the use cases for such stand-alone shared libraries might be small niches, I was curious whether or not there was any discussion about potential strategies for making it easier to build them for Linux. At the very least, perhaps a single switch for the configure script or <a href="http://build.mk">build.mk</a> to make it easier to build GHC+libs with -fPIC on Linux. Another step up might be providing *_PIC.a objects for the base libraries, so that the non-PIC objects are still available for the majority of cases in which PIC is not required.</div><div><br></div><div>Thanks for your time,</div><div><br></div><div>Travis Whitaker</div></div>