diff options
author | Tamar Christina <tamar@zhox.com> | 2017-02-23 18:34:33 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-26 10:54:07 -0500 |
commit | be3f436277042477d4a9215c4d5022a6f2225ed9 (patch) | |
tree | 777dac0fc1baa5d4ae9cd0d9cb1e13b7f1805b1c /compiler/ghci | |
parent | 9968502d075e3a714913e14cd96a7d6b7ac7b5e7 (diff) | |
download | haskell-be3f436277042477d4a9215c4d5022a6f2225ed9.tar.gz |
Load `pthreads` by default on Windows
The GCC Bindists that we use compile with `pthread` enabled by default.
This means that on every link the dll is passed as a dependency by the
driver. Lots of packages depend on it but the runtime linker doesn't
provide it by default making compiled code work but not interpreted.
Following D3028 `pthreads` would be provided by default ONLY when linked
dynamicly, which we don't support yet (See D2592). Until this is the
case we need to manually provide `libpthreads`.
Test Plan: ./validate
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3155
Diffstat (limited to 'compiler/ghci')
-rw-r--r-- | compiler/ghci/Linker.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index e89f1bb680..ebd27b0e33 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -312,7 +312,19 @@ linkCmdLineLibs' hsc_env pls = , libraryPaths = lib_paths}) = hsc_dflags hsc_env -- (c) Link libraries from the command-line - let minus_ls = [ lib | Option ('-':'l':lib) <- cmdline_ld_inputs ] + let minus_ls_1 = [ lib | Option ('-':'l':lib) <- cmdline_ld_inputs ] + + -- On Windows we want to add libpthread by default just as GCC would. + -- However because we don't know the actual name of pthread's dll we + -- need to defer this to the locateLib call so we can't initialize it + -- inside of the rts. Instead we do it here to be able to find the + -- import library for pthreads. See Trac #13210. + let platform = targetPlatform dflags + os = platformOS platform + minus_ls = case os of + OSMinGW32 -> "pthread" : minus_ls_1 + _ -> minus_ls_1 + libspecs <- mapM (locateLib hsc_env False lib_paths) minus_ls -- (d) Link .o files from the command-line |