[commit: ghc] master: Use NEED_PTHREAD_LIB (c0872bf)

git at git.haskell.org git at git.haskell.org
Thu May 11 13:01:13 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c0872bf99ff891e440f118bf9eea20b980c2cfca/ghc

>---------------------------------------------------------------

commit c0872bf99ff891e440f118bf9eea20b980c2cfca
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Thu May 11 18:17:31 2017 +0800

    Use NEED_PTHREAD_LIB
    
    we do the same for the rts already. And using the configure script should
    be more robust than hand-picking the OSs here.
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3563


>---------------------------------------------------------------

c0872bf99ff891e440f118bf9eea20b980c2cfca
 compiler/main/DriverPipeline.hs | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 474fd8c..07e5edd 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1887,22 +1887,19 @@ linkBinary' staticLink dflags o_files dep_packages = do
     -- Here are some libs that need to be linked at the *end* of
     -- the command line, because they contain symbols that are referred to
     -- by the RTS.  We can't therefore use the ordinary way opts for these.
-    let
-        debug_opts | WayDebug `elem` ways dflags = [
+    let debug_opts | WayDebug `elem` ways dflags = [
 #if defined(HAVE_LIBBFD)
                         "-lbfd", "-liberty"
 #endif
                          ]
-                   | otherwise            = []
+                   | otherwise                   = []
 
-    let thread_opts
-         | WayThreaded `elem` ways dflags =
-            let os = platformOS (targetPlatform dflags)
-            in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, OSAndroid,
-                             OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin]
-               then []
-               else ["-lpthread"]
-         | otherwise               = []
+        thread_opts | WayThreaded `elem` ways dflags = [
+#if NEED_PTHREAD_LIB
+                        "-lpthread"
+#endif
+                        ]
+                    | otherwise                      = []
 
     rc_objs <- maybeCreateManifest dflags output_fn
 



More information about the ghc-commits mailing list