diff options
| author | Sylvain Henry <sylvain@haskus.fr> | 2021-07-19 16:52:06 +0200 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-19 19:38:59 -0400 |
| commit | 58b960d2af0ebfc37104ec68a4df377a074951dd (patch) | |
| tree | f0fc5bf672f76ec4f032a07d8d292fb1a6eaddb1 /compiler/GHC/Driver/Pipeline | |
| parent | 535123e4f6505a148ccaa536c21282a87c42669c (diff) | |
| download | haskell-58b960d2af0ebfc37104ec68a4df377a074951dd.tar.gz | |
Make TmpFs independent of DynFlags
This is small step towards #19877. We want to make the Loader/Linker
interface more abstract to be easily reused (i.e. don't pass it
DynFlags) but the system linker uses TmpFs which required a DynFlags
value to get its temp directory. We explicitly pass the temp directory
now. Similarly TmpFs was consulting the DynFlags to decide whether to
clean or: this is now done by the caller in the driver code.
Diffstat (limited to 'compiler/GHC/Driver/Pipeline')
| -rw-r--r-- | compiler/GHC/Driver/Pipeline/Execute.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs index d843f29056..57d491104e 100644 --- a/compiler/GHC/Driver/Pipeline/Execute.hs +++ b/compiler/GHC/Driver/Pipeline/Execute.hs @@ -157,7 +157,10 @@ runMergeForeign _pipe_env hsc_env _location input_fn foreign_os = do else do -- Work around a binutil < 2.31 bug where you can't merge objects if the output file -- is one of the inputs - new_o <- newTempName (hsc_logger hsc_env) (hsc_tmpfs hsc_env) (hsc_dflags hsc_env) TFL_CurrentModule "o" + new_o <- newTempName (hsc_logger hsc_env) + (hsc_tmpfs hsc_env) + (tmpDir (hsc_dflags hsc_env)) + TFL_CurrentModule "o" copyFile input_fn new_o let dflags = hsc_dflags hsc_env logger = hsc_logger hsc_env @@ -764,8 +767,8 @@ getOutputFilename logger tmpfs stop_phase output basename dflags next_phase mayb Nothing -> panic "SpecificFile: No filename" | keep_this_output = persistent_fn - | Temporary lifetime <- output = newTempName logger tmpfs dflags lifetime suffix - | otherwise = newTempName logger tmpfs dflags TFL_CurrentModule + | Temporary lifetime <- output = newTempName logger tmpfs (tmpDir dflags) lifetime suffix + | otherwise = newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule suffix where hcsuf = hcSuf dflags @@ -926,7 +929,7 @@ doCpp logger tmpfs dflags unit_env raw input_fn output_fn = do pkgs = catMaybes (map (lookupUnit unit_state) uids) mb_macro_include <- if not (null pkgs) && gopt Opt_VersionMacros dflags - then do macro_stub <- newTempName logger tmpfs dflags TFL_CurrentModule "h" + then do macro_stub <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "h" writeFile macro_stub (generatePackageVersionMacros pkgs) -- Include version macros for every *exposed* package. -- Without -hide-all-packages and with a package database @@ -1069,14 +1072,14 @@ joinObjectFiles logger tmpfs dflags o_files output_fn = do if ldIsGnuLd then do - script <- newTempName logger tmpfs dflags TFL_CurrentModule "ldscript" + script <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "ldscript" cwd <- getCurrentDirectory let o_files_abs = map (\x -> "\"" ++ (cwd </> x) ++ "\"") o_files writeFile script $ "INPUT(" ++ unwords o_files_abs ++ ")" ld_r [GHC.SysTools.FileOption "" script] else if toolSettings_ldSupportsFilelist toolSettings' then do - filelist <- newTempName logger tmpfs dflags TFL_CurrentModule "filelist" + filelist <- newTempName logger tmpfs (tmpDir dflags) TFL_CurrentModule "filelist" writeFile filelist $ unlines o_files ld_r [GHC.SysTools.Option "-filelist", GHC.SysTools.FileOption "" filelist] |
