Merge sections in profiling .a to .p_o and use it whenever it exists

Authored by watashi on Sep 21 2018, 10:26 AM.



We do this for vanilla way already.
Let's also merge sections for profiling way and use it instead of the .a
library when it exists.

Test Plan
$ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
GHCi, version 8.7.20180921:  :? for help
Prelude> pid <- System.Posix.Process.getProcessID
Prelude> maps <- readFile $ "/proc/" ++ show pid ++ "/maps"
Prelude> pid
Prelude> putStrLn $ unlines $ take 20 $ lines maps
00400000-02103000 r-xp 00000000 00:1a 199277344
02104000-02106000 r--p 01d03000 00:1a 199277344
02106000-02417000 rw-p 01d05000 00:1a 199277344
02417000-0280a000 rw-p 00000000 00:00 0
40098000-400b0000 rwxp 000d2000 00:1a 199276023
400b7000-400d8000 rwxp 00000000 00:00 0
401d1000-401d2000 rwxp 000e9000 00:1a 199276023
40415000-40419000 rwxp 0000b000 00:1a 199275165
404f8000-40526000 rwxp 000af000 00:1a 199274234

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
watashi created this revision.Sep 21 2018, 10:26 AM
bgamari added inline comments.Sep 21 2018, 11:23 AM

I'm not sure what this comment means now; this seems to be okay for both the normal and profiling ways. Which way will this *not* work for?

watashi updated this revision to Diff 18089.Sep 21 2018, 12:24 PM

update comment wording

watashi marked an inline comment as done.Sep 21 2018, 12:25 PM
simonmar accepted this revision.Sep 25 2018, 5:57 AM

Great! This should make ghc -fexternal-interpreter -prof a lot faster to start up, and some of the tests will run faster.

But there's a downside - it will increase the size of the binary dists. I'm not sure how much. @bgamari is this a concern do you think?

This revision is now accepted and ready to land.Sep 25 2018, 5:57 AM

The total size of each output in my build:


Does that include the ghc package?

Does that include the ghc package?

No, I got the estimation by

du $(find libraries/ -name 'libHS*_p.a' ) | awk '{ sum += $1 } END { print sum }'

Also, the change in build-package-way actually doesn't affect ghc package, we only get .a and .p_a for it.

  1. We should build these at installation time, so they don't have to go into the binary distribution (the same goes for the vanilla way` libHSfoo.o` files)
  2. This also needs to be done in Hadrian

Can do these as followups, but we shouldn't forget.

I opened Trac #15779 to track these follow-up tasks.

This revision was automatically updated to reflect the committed changes.

I believe this line of work broke binary distributions (Trac #16053). @watashi, does this look familiar?

@watashi, could you have a look at this? This is currently blocking the 8.8 release; if another week passes I will need to start backing out this change.