X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPipeline.hs;h=4521e34ee7005e2109e3442f4199789b863d0418;hb=cd20fd58e77d3593cd5870a7345285869b2e32f3;hp=d4cb66af69cc78814b18d7e4a543ad90d2781c80;hpb=f8f297afa3721136d626ebeb372432938ed85ab9;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index d4cb66a..4521e34 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -1027,6 +1027,30 @@ staticLink o_files dep_packages = do [rts_pkg, std_pkg] <- getPackageDetails [rtsPackage, basePackage] + ways <- readIORef v_Ways + + -- 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 = [ +#if defined(HAVE_LIBBFD) + "-lbfd", "-liberty" +#endif + ] + | otherwise = [] + + let + thread_opts | WayThreaded `elem` ways = [ +#if !defined(mingw32_TARGET_OS) && !defined(freebsd_TARGET_OS) + "-lpthread" +#endif +#if defined(osf3_TARGET_OS) + , "-lexc" +#endif + ] + | otherwise = [] + let extra_os = if static || no_hs_main then [] else [ head (library_dirs rts_pkg) ++ "/Main.dll_o", @@ -1054,6 +1078,8 @@ staticLink o_files dep_packages = do ++ pkg_framework_path_opts ++ pkg_framework_opts #endif + ++ debug_opts + ++ thread_opts )) -- parallel only: move binary to another dir -- HWL