X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FDriverPipeline.hs;h=c8cf4c9a804519a5dc91d576469d84378bfb54b1;hp=f8f06765a33cc0ef8d2b626320cd56581058c7b4;hb=527f52a72acf214994921ad36de92f934e9632da;hpb=3d411991d3c697e5a93e6922582fe8299210e83d diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index f8f0676..c8cf4c9 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1379,6 +1379,13 @@ linkBinary dflags o_files dep_packages = do let lib_paths = libraryPaths dflags let lib_path_opts = map ("-L"++) lib_paths + -- The C "main" function is not in the rts but in a separate static + -- library libHSrtsmain.a that sits next to the rts lib files. Assuming + -- we're using a Haskell main function then we need to link it in. + let no_hs_main = dopt Opt_NoHsMain dflags + let main_lib | no_hs_main = [] + | otherwise = [ "-lHSrtsmain" ] + pkg_link_opts <- getPackageLinkOpts dflags dep_packages #ifdef darwin_TARGET_OS @@ -1445,6 +1452,7 @@ linkBinary dflags o_files dep_packages = do ++ framework_opts #endif ++ pkg_lib_path_opts + ++ main_lib ++ pkg_link_opts #ifdef darwin_TARGET_OS ++ pkg_framework_path_opts @@ -1553,7 +1561,13 @@ linkDynLib dflags o_files dep_packages = do let pkgs_no_rts = pkgs #endif let pkg_lib_paths = collectLibraryPaths pkgs_no_rts - let pkg_lib_path_opts = map ("-L"++) pkg_lib_paths + let pkg_lib_path_opts = concatMap get_pkg_lib_path_opts pkg_lib_paths +#ifdef linux_TARGET_OS + get_pkg_lib_path_opts l | (dynLibLoader dflags)==SystemDependent && not opt_Static = ["-L" ++ l, "-Wl,-rpath", "-Wl," ++ l] + | otherwise = ["-L" ++ l] +#else + get_pkg_lib_path_opts l = ["-L" ++ l] +#endif let lib_paths = libraryPaths dflags let lib_path_opts = map ("-L"++) lib_paths @@ -1653,6 +1667,7 @@ linkDynLib dflags o_files dep_packages = do md_c_flags ++ o_files ++ [ "-shared", "-Wl,-Bsymbolic" ] -- we need symbolic linking to resolve non-PIC intra-package-relocations + ++ [ "-Wl,-soname," ++ takeFileName output_fn ] -- set the library soname ++ extra_ld_inputs ++ lib_path_opts ++ extra_ld_opts