Linking in Dead Code
Daniel Fischer
daniel.is.fischer at googlemail.com
Sat May 14 20:10:46 CEST 2011
On Friday 13 May 2011 13:04:14, Guy wrote:
> If only 1% of an imported module is used, GHC will link in the entire
> module.
With split-objs, as far as I know, GHC only links in what you use (plus the
module initialiser).
split-objs was disabled for some GHC/OS X combinations recently,
http://hackage.haskell.org/trac/ghc/ticket/4013 and 5008, maybe that
applies to you, otherwise building GHC with object-splitting enabled and
all libraries with split-objs should reduce code size significantly.
Linking still tends to use a lot of memory with ld, on the appropriate
platforms you could try using gold as the linker, that's reported to use
less memory (and be faster).
> Are there any plans, or at least some ideas, to rectify this?
> One severe example of this is qtHaskell, where importing the top-level
> module causes glacial compile (actually link) times and huge
> executables. Strip can fix the executable size (why does GHC not do
> this automatically?), but linking remains a problem.
>
More information about the Glasgow-haskell-users
mailing list