Missing symbols in ghc-stage2 executable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Missing symbols in ghc-stage2 executable

Ömer Sinan Ağacan
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
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Missing symbols in ghc-stage2 executable

Ömer Sinan Ağacan
If I build with hadrian using "quickest" setting I get a more reasonable number:

    $ nm ./_build/stage1/bin/ghc | wc -l
    102174

It'd be good to have these symbols in make-generated stage 2 executables too.

Ömer

Ömer Sinan Ağacan <[hidden email]>, 10 Şub 2020 Pzt, 11:45
tarihinde şunu yazdı:

>
> 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
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs