Symbols in built executables

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jun 18 06:53:49 EDT 2008


On Tue, 2008-06-17 at 16:16 -0700, Bryan O'Sullivan wrote:
> Here's something I just stumbled upon by accident: at least on Linux,
> GHC emits huge numbers of symbols into the binaries it generates.
> Here's Haddock, which I compiled without any funny debug options:
> 
> $ du -h haddock-0.9
> 4.1M   haddock-0.9
> $ nm haddock-0.9 | wc -l
> 37938
> $ strip haddock-0.9
> $ du -h haddock-0.9
> 2.7M haddock-0.9
> 
> I happened upon this because I'm repackaging GHC 6.8.3 for Fedora, and
> rpmlint complained that haddock was not stripped. The RPM packager
> automatically strips binaries using "strip -g", but that wasn't
> stripping any of the abovementioned symbols.

According to man strip, the -g flag means only strip debugging symbols.
But ghc doesn't generate any debugging symbols (and ghc does not pass -g
to gcc so nor does gcc). So it seems to me that it's not surprising that
you still get all the symbols.

What is a surprise is that rpm only uses strip -g when rpmlint seems to
expect normal strip.

> I don't know what the purpose of those symbols might be. Could someone
> fill me in, please? Can they actually be used for anything?

I don't think they're used for anything. Cabal-1.4 now strips
executables by default upon installation (distros that want to do the
strip themselves can disable this).

Duncan



More information about the Glasgow-haskell-users mailing list