[GHC] #12748: BFD linker issue with GHCi

GHC ghc-devs at haskell.org
Fri Oct 21 11:34:06 UTC 2016


#12748: BFD linker issue with GHCi
------------------------------------------+-------------------------------
           Reporter:  hsyl20              |             Owner:
               Type:  bug                 |            Status:  new
           Priority:  normal              |         Milestone:
          Component:  Compiler (Linking)  |           Version:  8.0.1
           Keywords:  bfd,linker,ghci     |  Operating System:  Linux
       Architecture:  Unknown/Multiple    |   Type of failure:  GHCi crash
          Test Case:                      |        Blocked By:
           Blocking:                      |   Related Tickets:
Differential Rev(s):                      |         Wiki Page:
------------------------------------------+-------------------------------
 On my project, GHCi seems to hang waiting for the BFD linker to complete
 the link of `libghc_1.so`. The hanging command has the form: `/usr/bin/ld
 @/tmp/ccHQ8Uzc`
 Using gdb, it seems the BFD linker `ld` is looping (infinitely?) into
 `bfd_elf_link_add_symbols`.

 I have tried to use the GOLD linker `ld.gold` instead on the `ccHQ8Uzc`
 file (removing the unsupported parameters `--hash-size=31` and `--reduce-
 memory-overhead`) and it links instantly.

 Could it be that GHC 8.0.1 generates too many symbols for the BFD linker
 or something like this? The BFD linker worked with GHC 7.10.3.

 I build the project with stack, the hanging happens with `stack repl`
 (GHCi's prompt never shows):
 {{{
 @(Stack/Exec.hs:76:10)
 2016-10-21 12:57:53.747332: [debug] Creating process: /usr/bin/ghc
 --interactive -i -odir=/home/hsyl20/travail/code/ViperVM/.stack-work/odir
 -hidir=/home/hsyl20/travail/code/ViperVM/.stack-work/odir -hide-all-
 packages -i/home/hsyl20/travail/code/ViperVM/src/lib
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/autogen
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build
 -stubdir=/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build
 /home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/src/lib/ViperVM/Arch/X86_64/Linux/syscall.o
 /home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/src/lib/ViperVM/Arch/X86_64/cpuid.o
 -package-id=base-4.9.0.0 -package-id=containers-0.5.7.1 -package-
 id=list-t-1-z6InD0gw7C2QDNkG2mqUf -package-
 id=stm-2.4.4.1-9HlGYelGmT69YkepeDjuRg -package-id=stm-
 containers-0.2.15-JTVESCf1d8uCXyJbMCLfQJ -package-id=stm-
 linkedlist-0.1.0.0-GCpyrfjLFyWFZy8qotX7VW -package-
 id=hashable-1.2.4.0-GnltDttmBjG9qGzcjuPOH4 -package-
 id=cereal-0.5.3.0-JHJQkHEuvBGFx8XwIB7eX0 -package-id=bytestring-0.10.8.1
 -package-id=system-fileio-0.3.16.3-EDef2a4Ximk1z04PLLp95q -package-id
 =system-filepath-0.4.13.4-24DUGoIUqZu3MxGDhYLfCN -package-
 id=pureMD5-2.1.3-HBUMOqRjfoe6ZpLefZBT34 -package-
 id=text-1.2.2.1-FgcR4Xf0VlEHD9HLxzq9WJ -package-id=filepath-1.4.1.0
 -package-id=either-4.4.1.1-H4kagIugHGeIf0psi4Z0to -package-
 id=vector-0.11.0.0-BEDZb5o2QOhGbIm6ky7rl6 -package-id=directory-1.2.6.2
 -package-id=megaparsec-5.0.1-25EMPYC0AB61WKE0MffPOR -package-
 id=transformers-0.5.2.0 -package-id=unix-2.7.2.0 -package-
 id=criterion-1.1.1.0-Hq6Gg6oBMXcJvBdkiC2CBq -package-id=c-storable-
 deriving-0.1.3-DIL5UpBe3Em7XwOYU01lXH -package-
 id=pqueue-1.3.1.1-A3EjwMk8dUf7l1Swzqrred -package-
 id=mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCM -package-id=template-haskell-2.11.0.0
 -package-id=text-format-0.3.1.1-IMczxQgUdKA8it9OEumLMx -package-
 id=diagrams-1.3.0.1-9gEbAUMmu7DEIEOtgBTN65 -package-id=diagrams-
 lib-1.3.1.4-EWFz1jRqz29KScpInBNJM4 -package-id=diagrams-
 core-1.3.0.8-GGXo5v7JBpPFzOrVLJC9nc -package-id=diagrams-
 rasterific-1.3.1.8-2NQiYfE0qFP7UFNV120Viv -package-
 id=JuicyPixels-3.2.8-GcqBxM3ZIJ83rYx9ygJ0bm -package-
 id=loop-0.3.0-98VH1UqsOHy2KxBxA55ICY -package-
 id=Rasterific-0.6.1.1-3xSOfexAru5AQFIj4yXZ8f -package-
 id=colour-2.3.3-1clKnMqHWhQAElTFd8Ydyp -package-id=file-
 embed-0.0.10-IXfudWSq57y1Athysk5ifZ
 -i/home/hsyl20/travail/code/ViperVM/src/apps
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/Disass/Disass-tmp
 -i/home/hsyl20/travail/code/ViperVM/src/apps/Elf
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/ElfWeb/ElfWeb-tmp -package-id
 =happstack-server-7.4.6.2-8UX7Pc8fxznJjPPJjgBwca -package-
 id=lucid-2.9.6-FZpI2dlNE9n8QXjEeTfhJW -package-id=optparse-
 applicative-0.12.1.0-4FckWvtE7Gp1EYdm7OVbJw
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/MemoryTest/MemoryTest-tmp
 -i/home/hsyl20/travail/code/ViperVM/src/apps/PlatformWeb
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/PlatformWeb/PlatformWeb-tmp
 -package-id=blaze-html-0.8.1.2-2ceCZ3Fm7x67ZwaaR7uQ3C -package-id=blaze-
 markup-0.7.1.0-BKRb0wHFpEyDJWTsyjQqnp -package-
 id=network-2.6.3.1-G4Up1CPKbp7DeFsnywOnGG
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/TestSyscalls/TestSyscalls-tmp
 -i/home/hsyl20/travail/code/ViperVM/src/apps/X86Web
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/X86Web/X86Web-tmp -package-
 id=HTTP-4000.3.3-Fl4VtSZsPE4A3kSlCM2M0U
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/gunzip/gunzip-tmp
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/huffman/huffman-tmp
 -i/home/hsyl20/travail/code/ViperVM/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/udev/udev-tmp
 -i/home/hsyl20/travail/code/dynamic-linker-template
 -i/home/hsyl20/travail/code/dynamic-linker-template/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build/autogen
 -i/home/hsyl20/travail/code/dynamic-linker-template/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build
 -stubdir=/home/hsyl20/travail/code/dynamic-linker-template/.stack-
 work/dist/x86_64-linux/Cabal-1.24.0.0/build -Wall -Wall -Wall -Wall -Wall
 -Wall -Wall -Wall -Wall -Wall -Wall -optP-include
 -optP/tmp/ghci13379/cabal_macros.h -ghci-script=/tmp/ghci13379/ghci-script
 @(System/Process/Run.hs:103:5)
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 }}}

 This is on ArchLinux, binutils-2.27, stack 1.2.0, GHC 8.0.1.

 Steps to reproduce (I don't have a smaller reproducing example for now):
 {{{
 git clone https://github.com/hsyl20/ViperVM
 cd ViperVM
 stack repl
 # wait... the compilation is quite long
 # press enter when stack asks for the main module to load
 }}}

 `stack build` doesn't trigger this linker issue.

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


More information about the ghc-tickets mailing list