summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r--compiler/main/DriverPipeline.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index f1ef637037..3f59ed3bbf 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1341,10 +1341,7 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
let local_includes = [ SysTools.Option ("-iquote" ++ p)
| p <- includePathsQuote cmdline_include_paths ]
let runAssembler inputFilename outputFilename
- = liftIO $ do
- withAtomicRename outputFilename $ \temp_outputFilename -> do
- as_prog
- dflags
+ = liftIO $ as_prog dflags
(local_includes ++ global_includes
-- See Note [-fPIC for assembler]
++ map SysTools.Option pic_c_flags
@@ -1374,11 +1371,15 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
, SysTools.Option "-c"
, SysTools.FileOption "" inputFilename
, SysTools.Option "-o"
- , SysTools.FileOption "" temp_outputFilename
+ , SysTools.FileOption "" outputFilename
])
liftIO $ debugTraceMsg dflags 4 (text "Running the assembler")
- runAssembler input_fn output_fn
+
+ -- Atomic write by writing to temp file and then renaming
+ let temp_output_fn = output_fn <.> "tmp"
+ runAssembler input_fn temp_output_fn
+ liftIO $ renameFile temp_output_fn output_fn
return (RealPhase next_phase, output_fn)