Missing symbols in ghc-stage2 executable

Ömer Sinan Ağacan omeragacan at gmail.com
Mon Feb 10 08:45:48 UTC 2020


Does anyone know why I get so little symbols in stage 2 compiler compared to
programs built with the same stage 2 compiler?

This is the build.mk I'm using

    BuildFlavour = quick

    ifneq "$(BuildFlavour)" ""
    include mk/flavours/$(BuildFlavour).mk
    endif

    GhcRtsHcOpts += -O0 -g3
    GhcStage2HcOpts += -debug -g5
    GhcLibHcOpts += -g5

    GhcThreaded = NO

    BUILD_PROF_LIBS = NO

    HADDOCK_DOCS = NO
    BUILD_SPHINX_HTML = NO
    BUILD_SPHINX_PDF = NO
    BUILD_MAN = NO

    STRIP_CMD = :

Symbols in stage 2 compiler built with this build.mk:

    $ nm /home/omer/haskell/ghc/inplace/lib/bin/ghc-stage2 | wc -l
    9202

If I build `main = return ()` with the same compiler:

    $ cat test.hs
    main = return ()

    $ /home/omer/haskell/ghc/inplace/bin/ghc-stage2 -g5 -O0 test -fforce-recomp
    [1 of 1] Compiling Main             ( test.hs, test.o )
    Linking test ...

    $ nm test | wc -l
    35266

So it seems like a lot of symbols in the libraries are missing in the stage 2
executable.

I tried setting `DYNAMIC_GHC_PROGRAMS = NO` but I got even less number of
symbols in the stage 2 compiler.

I also confirmed this using a debugger program I wrote which can find info table
labels of objects in the heap when I run it on `test.hs` above but not when I
run it on the stage 2 executable.

Ömer


More information about the ghc-devs mailing list