Symbols in built executables

Simon Marlow marlowsd at
Wed Jun 18 05:09:53 EDT 2008

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.
> 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?

We didn't put them there on purpose, if that's what you're asking :)  These 
are just the symbols that get left in by the linker by default.  gdb and 
things like valgrind can use them, but they're not a lot of use in general.

There tend to be a lot of local symbols left around too, which are of even 
less use.  At one time I used to strip these out when making libraries, but 
it was tricky and non-portable, so I think we stopped doing it.


More information about the Glasgow-haskell-users mailing list