Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,399
    • Issues 5,399
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 592
    • Merge requests 592
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12816
Closed
Open
Issue created Nov 08, 2016 by Sylvain Henry@hsyl20Developer

Link error with GOLD linker

  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 (2e8463b2) 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: a977c965 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 (closed)), 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/c06e3f46d24ef69f3a3d794f5f604cb8c2a40cbc 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

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler (Linking)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking