Commit be3f4362 authored by Tamar Christina's avatar Tamar Christina Committed by Ben Gamari

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
parent 9968502d
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment