Dynamic libraries by default and GHC 7.8

Simon Marlow marlowsd at gmail.com
Thu Dec 6 22:04:07 CET 2012


On 05/12/12 15:17, Brandon Allbery wrote:
> On Wed, Dec 5, 2012 at 12:03 AM, Chris Smith <cdsmith at gmail.com
> <mailto:cdsmith at gmail.com>> wrote:
>
>     I'm curious how much of the "compile twice" situation for static and
>     dynamic libraries could actually be shared.
>
>
> Probably none; on most platforms you're actually generating different
> code (dynamic libraries require generation of position-independent
> code).  That said, the PPC ABI uses position-independent code even for
> static libraries and I think Apple decided to go that route on Intel as
> well rather than change their build system ... but if you do this then
> linking to other platform-native libraries may be more difficult.  Not a
> problem for Apple since they control the ABI, but not something ghc can
> force on libc or random libraries someone might want to use FFI with.

Sure there's a lot of differences in the generated code, but inside GHC 
these differences only appear at the very last stage of the pipeline, 
native code generation (or LLVM).  All the stages up to that can be 
shared, which accounts for roughly 80% of compilation time (IIRC).

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list