[GHC] #13739: Very slow linking of profiled executables

GHC ghc-devs at haskell.org
Wed May 24 17:00:05 UTC 2017


#13739: Very slow linking of profiled executables
-------------------------------------+-------------------------------------
        Reporter:  duog              |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by niteria):

 I'm getting 2 minute compile times when linking profiled GHC HEAD.
 Running with `-v` reveals that GHC is stuck on gcc doing linking

 Here's the stuck command: https://phabricator.haskell.org/P151, it takes
 135s to complete.
 When I remove `-Wl,--gc-sections`, it's only 11s.

 It's part of this GHC invocation:
 {{{
 "inplace/bin/ghc-stage1" -o ghc/stage2/build/tmp/ghc-stage2 -hisuf p_hi
 -osuf  p_o -hcsuf p_hc -static -prof -eventlog  -O0 -H64m -Wall
 -hide-all-packages -
 i -ighc/. -ighc/stage2/build -Ighc/stage2/build
 -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen    -optP-
 DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h
 -package-id base-4.10.0.0 -package-id array-0.5.1.2 -package-id
 bytestring-0.10.8.2 -package-id directory-1.3.0.2 -package-id
 process-1.6.0.0 -package-id filepath-1.4.1.2 -pack
 age-id ghc-boot-8.3 -package-id ghc-8.3 -package-id unix-2.7.2.2 -package-
 id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.3
 -package-id haskeline-0.7.4.0 -packa
 ge-id time-1.8.0.1 -package-id transformers-0.5.2.0 -Wall -fno-warn-name-
 shadowing -XHaskell2010  -O -no-hs-main -threaded -no-user-package-db
 -rtsopts      -Wnoncanonical-monad-inst
 ances  -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir
 ghc/stage2/build  -split-sections   -static -prof -eventlog  -O0 -H64m
 -Wall       -hide-all-packages -i -ighc/. -ighc/
 stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen
 -Ighc/stage2/build/ghc/autogen    -optP-DGHCI -optP-include
 -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id base-4.10.0.0
 -package-id array-0.5.1.2 -package-id bytestring-0.10.8.2 -package-id
 directory-1.3.0.2 -package-id process-1.6.0.0 -package-id filepath-1.4.1.2
 -package-id ghc-boot-
 8.3 -package-id ghc-8.3 -package-id unix-2.7.2.2 -package-id
 containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.3
 -package-id haskeline-0.7.4.0 -package-id time-1.8.0
 .1 -package-id transformers-0.5.2.0 -Wall -fno-warn-name-shadowing
 -XHaskell2010  -O -no-hs-main -threaded -no-user-package-db -rtsopts
 -Wnoncanonical-monad-instances  ghc/stage
 2/build/Main.p_o ghc/stage2/build/GHCi/UI.p_o
 ghc/stage2/build/GHCi/UI/Info.p_o ghc/stage2/build/GHCi/UI/Monad.p_o
 ghc/stage2/build/GHCi/UI/Tags.p_o ghc/stage2/build/hschooks.p_o -v -keep-
 tmp-files
 }}}

 My gcc version:
 {{{
 $ gcc --version
 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
 Copyright (C) 2015 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.
 }}}



 @doug: Can you run the command that hangs with:
 `cabal build cabal-install --ghc-options='-v'` to check if it's an
 instance of the same problem?

 If it's also stuck on `gcc` you can run it with `cabal build cabal-install
 --ghc-options='-v -keep-tmp-files'` and run the `gcc` command by itself.
 Then try removing `-Wl,--gc-sections`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13739#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list