Opened 3 years ago

Closed 3 years ago

#12748 closed bug (fixed)

BFD linker issue with GHCi

Reported by: hsyl20 Owned by:
Priority: normal Milestone:
Component: Compiler (Linking) Version: 8.0.1
Keywords: bfd, linker, ghci Cc: trommler, bgamari, oerjan, slyfox
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (7)

comment:1 Changed 3 years ago by hsyl20

It seems that the loop in the linker is not infinite but that it will take a long time. Here are the linked packages and the time to link up to some packages (from the bottom up):

-----    HTTP-4000.3.3-Fl4VtSZsPE4A3kSlCM2M0U-ghc8.0.1
-----    lucid-2.9.6-FZpI2dlNE9n8QXjEeTfhJW-ghc8.0.1
-----    happstack-server-7.4.6.2-8UX7Pc8fxznJjPPJjgBwca-ghc8.0.1
-----    xhtml-3000.2.1-ghc8.0.1
-----    utf8-string-1.0.1.1-2T8mBCuEDlXDo8zed8Onw4-ghc8.0.1
-----    time-compat-0.1.0.3-3baQeqpui17BDAvomZYiih-ghc8.0.1
-----    threads-0.5.1.4-KS41fYDpDlm1BvjwZbbSK6-ghc8.0.1
-----    sendfile-0.7.9-3VAtD7YE7bbEbbTKNhrN1c-ghc8.0.1
-----    network-uri-2.6.1.0-8yR4gjnzE4eDGhJR7PHfVJ-ghc8.0.1
-----    html-1.0.1.2-Jj2JgpzqaYBEsxjiTkT0Vw-ghc8.0.1
-----    hslogger-1.2.10-6Ih3VN3QBbAJ6pLH6h3KNu-ghc8.0.1
> 2128s  network-2.6.3.1-G4Up1CPKbp7DeFsnywOnGG-ghc8.0.1
-----    extensible-exceptions-0.1.1.4-3h0ykvvAO915cRhUyj3rRV-ghc8.0.1
-----    blaze-html-0.8.1.2-2ceCZ3Fm7x67ZwaaR7uQ3C-ghc8.0.1
-----    blaze-markup-0.7.1.0-BKRb0wHFpEyDJWTsyjQqnp-ghc8.0.1
-----    file-embed-0.0.10-IXfudWSq57y1Athysk5ifZ-ghc8.0.1
-----    loop-0.3.0-98VH1UqsOHy2KxBxA55ICY-ghc8.0.1
-----    diagrams-svg-1.4.0.3-FphjbXW7TZSAwXXOYkXY74-ghc8.0.1
-----    svg-builder-0.1.0.1-CvxGiuGBpW3JJl8eWFlgQU-ghc8.0.1
-----    old-time-1.1.0.3-IcvdkJUsE9M8t3io8peAEp-ghc8.0.1
-----    base64-bytestring-1.0.0.1-In9M41tLtcS9QYt3QpGpNY-ghc8.0.1
-----    diagrams-rasterific-1.3.1.8-2NQiYfE0qFP7UFNV120Viv-ghc8.0.1
-----    Rasterific-0.6.1.1-3xSOfexAru5AQFIj4yXZ8f-ghc8.0.1
-----    FontyFruity-0.5.3.2-1YzwX3JO76u7ntpUxhGpcT-ghc8.0.1
-----    xml-1.3.14-rYbwgRBahsKh5Xn1LyTeP-ghc8.0.1
495,13s  diagrams-contrib-1.3.0.12-BVQVFc3zAIebigwBRjBcg-ghc8.0.1
-----    split-0.2.3.1-IJKK4pOCYGKud0jZImZke-ghc8.0.1
-----    force-layout-0.4.0.5-CkQAJNRWbYI3c8zBWjDsz7-ghc8.0.1
289,77s  diagrams-lib-1.3.1.4-EWFz1jRqz29KScpInBNJM4-ghc8.0.1
-----    intervals-0.7.2-7abOKU77U9GirBl7dVRy8-ghc8.0.1
-----    fsnotify-0.2.1-LnY2OginHk88niUbIC7bDm-ghc8.0.1
-----    unix-compat-0.4.2.0-GNHotEMWE5dJ4oYFhgibIV-ghc8.0.1
-----    hinotify-0.3.8.1-Gq67SHpnhelljPBDnXAk3-ghc8.0.1
-----    async-2.1.0-IGx6TJY2BPOHCk3x4WAuIK-ghc8.0.1
-----    fingertree-0.1.1.0-C6YFXKIQXOA6HvmvFT5gT9-ghc8.0.1
-----    diagrams-solve-0.1.0.1-8TpiRrVfWtp4FIaKLscasl-ghc8.0.1
-----    active-0.2.0.10-ET7kEDhlbPi7zo4qIXMEd6-ghc8.0.1
78,53s   JuicyPixels-3.2.8-GcqBxM3ZIJ83rYx9ygJ0bm-ghc8.0.1
-----    zlib-0.6.1.1-IKN2DpYEe8r3bYFvs7BDUW-ghc8.0.1
63,90s   diagrams-core-1.3.0.8-GGXo5v7JBpPFzOrVLJC9nc-ghc8.0.1
48,34s   linear-1.20.5-LFB054YYRYQCVL3hUFEZct-ghc8.0.1
-----    bytes-0.15.2-EQMQclPImIpKkG0m1f3ql5-ghc8.0.1
-----    lens-4.14-2LZrGLWR827Eaze7Qa59gb-ghc8.0.1
-----    reflection-2.1.2-J1ZzlxijzaHGRixYxgxlf9-ghc8.0.1
-----    kan-extensions-5.0.1-JxnJF79ehCQ1iWfDSDGjll-ghc8.0.1
-----    dual-tree-0.2.0.9-J1URg6eEwyVm9LEtYsrpQ-ghc8.0.1
33,69s   newtype-0.2-6DnlyeREupYF8x0b7VMCgm-ghc8.0.1
-----    monoid-extras-0.4.2-D4VPpDMGnd9Hf6LE8J7Aiv-ghc8.0.1
-----    groups-0.4.0.0-53wMJ09LBR64aEJqWveBMG-ghc8.0.1
-----    adjunctions-4.3-DdaVzHtQIdKKcIMAtenkpN-ghc8.0.1
-----    data-default-0.7.1.1-ZpKfkXGfJa8c8Q6OFbvrr-ghc8.0.1
-----    data-default-instances-old-locale-0.0.1-5zxcPmpqjG6FhGl1vmzEjZ-ghc8.0.1
-----    data-default-instances-dlist-0.0.1-DV8IBZIcilKKBwjHagMU7-ghc8.0.1
-----    data-default-instances-containers-0.0.1-6YgqkE3UWFzLQIGXZZRkO7-ghc8.0.1
-----    data-default-class-0.1.2.0-6eetmQ6CbQOLoXb6k5kODu-ghc8.0.1
23,34s   colour-2.3.3-1clKnMqHWhQAElTFd8Ydyp-ghc8.0.1
-----    circle-packing-0.1.0.5-KgymD5nt1dV2mqSNFjQ9xq-ghc8.0.1
-----    text-format-0.3.1.1-IMczxQgUdKA8it9OEumLMx-ghc8.0.1
22,29s   old-locale-1.0.0.7-6glXNhHF891B41ZfuI8hU8-ghc8.0.1
-----    double-conversion-2.0.1.0-Ep4L30s0FWQLbRRekNTc0u-ghc8.0.1
-----    pqueue-1.3.1.1-A3EjwMk8dUf7l1Swzqrred-ghc8.0.1
-----    c-storable-deriving-0.1.3-DIL5UpBe3Em7XwOYU01lXH-ghc8.0.1
-----    criterion-1.1.1.0-Hq6Gg6oBMXcJvBdkiC2CBq-ghc8.0.1
-----    statistics-0.13.3.0-KJVgU6t2auG33XIktKXx0i-ghc8.0.1
-----    vector-binary-instances-0.2.3.2-5646KxzN3hJ80s4tOK0y7f-ghc8.0.1
-----    vector-algorithms-0.7.0.1-7hkZdPzlc60Fe3nqzzgmcD-ghc8.0.1
15,29s   monad-par-0.3.4.8-K7CIv8BXjrxuiIj0uUi92-ghc8.0.1
-----    parallel-3.2.1.0-6VcN0yUHtcs831TgbJiSSi-ghc8.0.1
-----    monad-par-extras-0.3.3-4NSJC48GnVF68j1ZuIgmiE-ghc8.0.1
-----    abstract-par-0.3.3-I2gvKCBAweu3uYwWNazPJ0-ghc8.0.1
-----    abstract-deque-0.3-7e2WwN8ZV7qFTjGkaUX2qO-ghc8.0.1
-----    math-functions-0.2.0.2-IKucf2F6PPp7GCACitUv0c-ghc8.0.1
-----    vector-th-unbox-0.2.1.6-GMTpzttBvqGAEXamQ10jEK-ghc8.0.1
-----    erf-2.0.0.0-9HTdBV7htNjASgIJAT55AC-ghc8.0.1
-----    parsec-3.1.11-IYEP8Lv1S9x5FeUQxGPDBY-ghc8.0.1
-----    optparse-applicative-0.12.1.0-4FckWvtE7Gp1EYdm7OVbJw-ghc8.0.1
11,56s   process-1.4.2.0-ghc8.0.1
-----    mwc-random-0.13.4.0-CH6ozsPFZjwVSNwmEz44J-ghc8.0.1
-----    hastache-0.6.1-FvV3RixlMRQIqgysVmReXH-ghc8.0.1
-----    ieee754-0.7.8-hSToga77ICuzAtDrK6Dj-ghc8.0.1
-----    cassava-0.4.5.0-LCutYytXWri1WnJj44KTfC-ghc8.0.1
10,37s   blaze-builder-0.4.0.2-2VmGHau0mFrAjwd4n28WWF-ghc8.0.1
-----    ansi-wl-pprint-0.6.7.3-BxXaXM4de7bF6SGXMvMtbC-ghc8.0.1
-----    ansi-terminal-0.6.2.3-AKTYR0nthhUCHW4HMZvJFX-ghc8.0.1
-----    aeson-0.11.2.1-3PFLXPeWBg946S5O4IgJJV-ghc8.0.1
-----    unordered-containers-0.2.7.1-6Q3w38ZivLTB9nLFgf8RUI-ghc8.0.1
-----    syb-0.6-C65vWCsht6A8uLstpQIXyj-ghc8.0.1
-----    attoparsec-0.13.1.0-8poMzD5ooNXJ4NDLaelDWq-ghc8.0.1
-----    Glob-0.7.12-6ONSkI0W8EPI2F7ftZDeCU-ghc8.0.1
-----    dlist-0.8.0.2-GWAMmbX9rLg3tqrbOizHGv-ghc8.0.1
-----    megaparsec-5.0.1-25EMPYC0AB61WKE0MffPOR-ghc8.0.1
-----    scientific-0.3.4.9-Ghl8M4Ey2fMI7e1yk2TuuH-ghc8.0.1
3,02s    directory-1.2.6.2-ghc8.0.1
-----    vector-0.11.0.0-BEDZb5o2QOhGbIm6ky7rl6-ghc8.0.1
-----    either-4.4.1.1-H4kagIugHGeIf0psi4Z0to-ghc8.0.1
-----    free-4.12.4-LcxMyZIxIoo6h2gqXah9QK-ghc8.0.1
-----    semigroupoids-5.1-5WI5yrkqR6b5vppUpisNlN-ghc8.0.1
-----    profunctors-5.2-CUL7kUu4nBbDVNmgOaH64k-ghc8.0.1
-----    prelude-extras-0.4.0.3-FAyB4iuuM7cHXdrLMZtdXq-ghc8.0.1
0,51s    exceptions-0.8.3-5cAKIsqc1DD7jaNW3zLxAN-ghc8.0.1
-----    bifunctors-5.4.1-EBkHk3WI7L87dRJGvKP176-ghc8.0.1
-----    comonad-5-1roHbXsedY6KUNYFgPJLp6-ghc8.0.1
-----    distributive-0.5.0.2-2AokE99FpE59iSGkvIRYC4-ghc8.0.1
-----    contravariant-1.4-89BvpwBnlCJ6iFzBGVF7XO-ghc8.0.1
-----    void-0.7.1-BXitqvas4xpGkaFQbixoM1-ghc8.0.1
-----    semigroups-0.18.2-2lmUSJvrDkM6JBURGRclWz-ghc8.0.1
-----    StateVar-1.1.0.4-49DJlv5H4c7r7bJPDG6IK-ghc8.0.1
0,26s    base-orphans-0.5.4-5IQvrjd7gNP548VkOOyIq6-ghc8.0.1
-----    MonadRandom-0.4.2.3-8TfCm6PGvGYB7omozORhov-ghc8.0.1
0,25s    random-1.1-54KmMHXjttlERYcr1mvsAe-ghc8.0.1
-----    filepath-1.4.1.0-ghc8.0.1
-----    pureMD5-2.1.3-HBUMOqRjfoe6ZpLefZBT34-ghc8.0.1
0,19s    crypto-api-0.13.2-JdUN2vdBIpq1NKgk9NRujQ-ghc8.0.1
-----    tagged-0.8.5-I7Gu0uzBLkQJCVUvdvwKKq-ghc8.0.1
-----    template-haskell-2.11.0.0-ghc8.0.1
0,15s    pretty-1.1.3.3-ghc8.0.1
-----    ghc-boot-th-8.0.1-ghc8.0.1
0,13s    entropy-0.3.7-54dsRvsNlllHvcIX99CGiD-ghc8.0.1
-----    system-fileio-0.3.16.3-EDef2a4Ximk1z04PLLp95q-ghc8.0.1
-----    unix-2.7.2.0-ghc8.0.1
-----    time-1.6.0.1-ghc8.0.1
-----    system-filepath-0.4.13.4-24DUGoIUqZu3MxGDhYLfCN-ghc8.0.1
0,09s    cereal-0.5.3.0-JHJQkHEuvBGFx8XwIB7eX0-ghc8.0.1
-----    stm-linkedlist-0.1.0.0-GCpyrfjLFyWFZy8qotX7VW-ghc8.0.1
-----    stm-containers-0.2.15-JTVESCf1d8uCXyJbMCLfQJ-ghc8.0.1
-----    primitive-0.6.1.0-Ip44DqhfCp21tTUYbecwa-ghc8.0.1
-----    hashable-1.2.4.0-GnltDttmBjG9qGzcjuPOH4-ghc8.0.1
-----    text-1.2.2.1-FgcR4Xf0VlEHD9HLxzq9WJ-ghc8.0.1
0,06s    binary-0.8.3.0-ghc8.0.1
-----    bytestring-0.10.8.1-ghc8.0.1
-----    focus-0.1.5-AwR3EdodPlZ3ltP8aTid4C-ghc8.0.1
-----    list-t-1-z6InD0gw7C2QDNkG2mqUf-ghc8.0.1
-----    monad-control-1.0.1.0-CVvkY5Vr2NNGCNJRXug3iR-ghc8.0.1
-----    transformers-base-0.4.4-LWS58Nywv1PJoy1IFDbvS4-ghc8.0.1
-----    stm-2.4.4.1-9HlGYelGmT69YkepeDjuRg-ghc8.0.1
-----    mmorph-1.0.6-3xsw6wg6Vs2JmwrJVsaYA0-ghc8.0.1
-----    transformers-compat-0.5.1.4-81lZyuOJOvsD0zyCv2TKld-ghc8.0.1
-----    mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCM-ghc8.0.1
0,06s    transformers-0.5.2.0-ghc8.0.1
-----    base-prelude-1.0.1.1-50PByGWQp6O3J1SglYyZmP-ghc8.0.1
-----    containers-0.5.7.1-ghc8.0.1
-----    deepseq-1.4.2.0-ghc8.0.1
-----    array-0.5.1.1-ghc8.0.1
-----    base-4.9.0.0-ghc8.0.1
-----    integer-gmp-1.0.0.1-ghc8.0.1
-----    ghc-prim-0.5.0.0-ghc8.0.1

comment:2 Changed 3 years ago by trommler

Cc: trommler added

comment:3 Changed 3 years ago by hsyl20

Cc: bgamari added

I may have found the culprit. While investigating #12754, I obtained these results:

                                     8.0.1       HEAD        HEAD (disable mkTypeableBinds)
Compile time (without export list):  13.16       15.16s      12.19       -20%
Compile time (with    export list):  10.24s      12.06s      9.16        -24%
Binary size:                         5.4M        5.4M        2.5M        -53%
Interface size:                      888K        1.1M        498K        -55%
#symbols in .symtab:                 60034       60034       30017       -50%
#relocs in .rela.data:               60024       60024       10002       -83%
Size of .data section:               720272      720272      80016       -89%
Size of .strtab section:             887100      887100      447902      -50%

For each type constructor, mkTypeableBinds adds:

  • The name of the constructor as a string into .rodata
    • + 1 symbol
    • n bytes, 8-byte aligned (there are two consecutives directives: .align 8 .align 1 before each string)
  • A GHC.Types.TrNameS closure in .data
    • + 1 symbol
    • 8 bytes, 8-byte aligned too
  • A GHC.Types.TyCon closure in .data
    • + 1 symbol
    • 24 bytes, 8-byte aligned too

comment:4 Changed 3 years ago by bgamari

Indeed the Typeable implementation was changed as a result of #9858. We were slightly concerned that resolving this issue would regress compilation times, although initial indications seemed to suggest that the issue wouldn't be noticeable in practice.

It sounds like BFD ld is likely doing something very silly (which wouldn't be at all surprising). I'm not really sure what to recommend in the short term beyond "use gold". In general gold is significantly more sane.

In the long-term there is of course the question of whether we want to revert to the previous approach of producing Typeable bindings during evidence generation. Given that such massive types aren't terribly common, I tend to think that the consistency that treating Typeable at declaration-time is probably worth the cost.

comment:5 Changed 3 years ago by oerjan

Cc: oerjan added

comment:6 Changed 3 years ago by slyfox

Cc: slyfox added

Can you give it a spin on ghc-HEAD?

comment:7 Changed 3 years ago by hsyl20

Resolution: fixed
Status: newclosed

@slyfox I can't reproduce with ghc-8.0 branch (cc3a9504f638fe14fd6532c3b616343a2ee947dd) and the BFD linker. I close the ticket.

Note: See TracTickets for help on using tickets.