[GHC] #12816: Link error with GOLD linker

#12816: Link error with GOLD linker -------------------------------------+------------------------------------- Reporter: hsyl20 | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Compiler | Version: 8.1 (Linking) | Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: Building GHC (amd64) | failed Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 1. I think we should add "pthread" to the list of extra-libs in "rts/package.conf.in" for the threaded RTS on UNIX-like host OSes. 2. we should include MachDeps.h in "rts/package.conf.in" Current master branch (2e8463b232054b788b73e6551947a9434aa76009) build is broken on my system[0]. When ghc-stage1 tries to produce ghc-stage2, I get: {{{ /home/hsyl20/repo/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161107.so: error: undefined reference to 'pthread_create' /home/hsyl20/repo/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161107.so: error: undefined reference to 'pthread_detach }}} (logs: http://pastebin.com/EbqEx6Gg ) I have tracked down the regression to the following recent commit: a977c96537bb7077c6445f02db98636b150e6e14 If I revert this commit, it builds. However I think this commit has only revealed the bug: if I add "pthread" to the list of extra-libs in "rts/package.conf.in", it builds too. We already add it on freebsd and openbsd but not on Linux. I think I have finally found out why other devs on #ghc haven't noticed this bug: my system uses the GOLD linker (because of #12748), but if I switch back to the BFD linker, it builds without error. While investigating this bug, I have noticed that linker flags for 64-bit atomic ops introduced by https://git.haskell.org/ghc.git/commitdiff/c06e3f46d24ef69f3a3d794f5f604cb8c... aren't set while they should: WORD_SIZE_IN_BITS isn't defined because we don't include MachDeps.h [0] x86-64, ArchLinux (Linux 4.8.6), GNU gold (GNU Binutils 2.27) 1.12, gcc (GCC) 6.2.1 20160830 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12816 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12816: Link error with GOLD linker -------------------------------------+------------------------------------- Reporter: hsyl20 | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.2 Component: Compiler | Version: 8.1 (Linking) | Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2695 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D2695 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12816#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12816: Link error with GOLD linker
-------------------------------------+-------------------------------------
Reporter: hsyl20 | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 8.0.2
Component: Compiler | Version: 8.1
(Linking) |
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Building GHC | (amd64)
failed | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2695
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12816: Link error with GOLD linker -------------------------------------+------------------------------------- Reporter: hsyl20 | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Compiler | Version: 8.1 (Linking) | Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2695 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as b622017eb8b71655f9a04ad4804aee0d0e1abd41. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12816#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC