diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-10-15 17:55:34 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-29 03:53:52 -0400 |
commit | 0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59 (patch) | |
tree | 1c9d9848db07596c19221fd195db81cdf6430385 /compiler/GHC/Runtime/Linker.hs | |
parent | 795908dc4eab8e8b40cb318a2adbe4a4d4126c74 (diff) | |
download | haskell-0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59.tar.gz |
Split GHC.Driver.Types
I was working on making DynFlags stateless (#17957), especially by
storing loaded plugins into HscEnv instead of DynFlags. It turned out to
be complicated because HscEnv is in GHC.Driver.Types but LoadedPlugin
isn't: it is in GHC.Driver.Plugins which depends on GHC.Driver.Types. I
didn't feel like introducing yet another hs-boot file to break the loop.
Additionally I remember that while we introduced the module hierarchy
(#13009) we talked about splitting GHC.Driver.Types because it contained
various unrelated types and functions, but we never executed. I didn't
feel like making GHC.Driver.Types bigger with more unrelated Plugins
related types, so finally I bit the bullet and split GHC.Driver.Types.
As a consequence this patch moves a lot of things. I've tried to put
them into appropriate modules but nothing is set in stone.
Several other things moved to avoid loops.
* Removed Binary instances from GHC.Utils.Binary for random compiler
things
* Moved Typeable Binary instances into GHC.Utils.Binary.Typeable: they
import a lot of things that users of GHC.Utils.Binary don't want to
depend on.
* put everything related to Units/Modules under GHC.Unit:
GHC.Unit.Finder, GHC.Unit.Module.{ModGuts,ModIface,Deps,etc.}
* Created several modules under GHC.Types: GHC.Types.Fixity, SourceText,
etc.
* Split GHC.Utils.Error (into GHC.Types.Error)
* Finally removed GHC.Driver.Types
Note that this patch doesn't put loaded plugins into HscEnv. It's left
for another patch.
Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Runtime/Linker.hs')
-rw-r--r-- | compiler/GHC/Runtime/Linker.hs | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs index 4477a0ad2f..4203f741c6 100644 --- a/compiler/GHC/Runtime/Linker.hs +++ b/compiler/GHC/Runtime/Linker.hs @@ -31,40 +31,53 @@ where import GHC.Prelude +import GHC.Platform +import GHC.Platform.Ways + +import GHC.Driver.Phases +import GHC.Driver.Env +import GHC.Driver.Session +import GHC.Driver.Ppr + +import GHC.Tc.Utils.Monad + import GHC.Runtime.Interpreter import GHC.Runtime.Interpreter.Types +import GHC.Runtime.Linker.Types import GHCi.RemoteTypes + import GHC.Iface.Load + import GHC.ByteCode.Linker import GHC.ByteCode.Asm import GHC.ByteCode.Types -import GHC.Tc.Utils.Monad -import GHC.Unit.State as Packages -import GHC.Driver.Phases -import GHC.Driver.Finder -import GHC.Driver.Types -import GHC.Platform.Ways + +import GHC.SysTools +import GHC.SysTools.FileCleanup + +import GHC.Types.Basic import GHC.Types.Name import GHC.Types.Name.Env -import GHC.Unit.Module -import GHC.Unit.Home -import GHC.Data.List.SetOps -import GHC.Runtime.Linker.Types (DynLinker(..), PersistentLinkerState(..)) -import GHC.Driver.Session -import GHC.Driver.Ppr -import GHC.Types.Basic +import GHC.Types.SrcLoc +import GHC.Types.Unique.DSet + import GHC.Utils.Outputable import GHC.Utils.Panic import GHC.Utils.Misc import GHC.Utils.Error -import GHC.Types.SrcLoc + +import GHC.Unit.Finder +import GHC.Unit.Module +import GHC.Unit.Module.ModIface +import GHC.Unit.Module.Deps +import GHC.Unit.Home +import GHC.Unit.Home.ModInfo +import GHC.Unit.State as Packages + +import qualified GHC.Data.ShortText as ST import qualified GHC.Data.Maybe as Maybes -import GHC.Types.Unique.DSet import GHC.Data.FastString -import qualified GHC.Data.ShortText as ST -import GHC.Platform -import GHC.SysTools -import GHC.SysTools.FileCleanup +import GHC.Data.List.SetOps -- Standard libraries import Control.Monad @@ -446,7 +459,7 @@ preloadLib hsc_env lib_paths framework_paths pls lib_spec = do return pls DLL dll_unadorned -> do - maybe_errstr <- loadDLL hsc_env (mkSOName platform dll_unadorned) + maybe_errstr <- loadDLL hsc_env (platformSOName platform dll_unadorned) case maybe_errstr of Nothing -> maybePutStrLn dflags "done" Just mm | platformOS platform /= OSDarwin -> @@ -918,7 +931,7 @@ dynLoadObjs hsc_env pls@PersistentLinkerState{..} objs = do let minus_ls = [ lib | Option ('-':'l':lib) <- ldInputs dflags ] let minus_big_ls = [ lib | Option ('-':'L':lib) <- ldInputs dflags ] (soFile, libPath , libName) <- - newTempLibName dflags TFL_CurrentModule (soExt platform) + newTempLibName dflags TFL_CurrentModule (platformSOExt platform) let dflags2 = dflags { -- We don't want the original ldInputs in @@ -1342,7 +1355,7 @@ linkPackage hsc_env pkg mapM_ (load_dyn hsc_env True) known_dlls -- For remaining `dlls` crash early only when there is surely -- no package's DLL around ... (not is_dyn) - mapM_ (load_dyn hsc_env (not is_dyn) . mkSOName platform) dlls + mapM_ (load_dyn hsc_env (not is_dyn) . platformSOName platform) dlls #endif -- After loading all the DLLs, we can load the static objects. -- Ordering isn't important here, because we do one final link @@ -1528,9 +1541,9 @@ locateLib hsc_env is_hs lib_dirs gcc_dirs lib ] hs_dyn_lib_name = lib ++ '-':programName dflags ++ projectVersion dflags - hs_dyn_lib_file = mkHsSOName platform hs_dyn_lib_name + hs_dyn_lib_file = platformHsSOName platform hs_dyn_lib_name - so_name = mkSOName platform lib + so_name = platformSOName platform lib lib_so_name = "lib" ++ so_name dyn_lib_file = case (arch, os) of (ArchX86_64, OSSolaris2) -> "64" </> so_name |