diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-01-31 10:32:24 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-04-05 14:12:19 +0100 |
commit | 7b0ff1792d699ff02a604163c9ccf4a98a1ca3eb (patch) | |
tree | 39d13b2316841d8566e9dfda06fe6b9a07aa389f /compiler/main/DriverPhases.hs | |
parent | 0ce8f5e727dfb59857a0f6e34d7617796e76baac (diff) | |
download | haskell-7b0ff1792d699ff02a604163c9ccf4a98a1ca3eb.tar.gz |
Merge _stub.o files into the main .o file (Fixes #3687 and #706)
Now GHC still generates the _stub.c files, but the object file is
automatically merged into the main .o file for a module. This means
that build systems (including GHC's own) no longer need to worry about
looking for _stub.o files and including them when linking.
I had to do lots of refactoring in DriverPipeline to make this work;
now there's a monad to carry around all the information, and
everything is a lot tidier.
The _stub.c is now created as a temporary file and removed after
compilation (unless the -keep-tmp-files flag is on).
Diffstat (limited to 'compiler/main/DriverPhases.hs')
-rw-r--r-- | compiler/main/DriverPhases.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index 5b00261e96..87ae663fcb 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -84,6 +84,7 @@ data Phase | LlvmMangle -- Fix up TNTC by processing assembly produced by LLVM | CmmCpp -- pre-process Cmm source | Cmm -- parse & compile Cmm code + | MergeStub -- merge in the stub object file -- The final phase is a pseudo-phase that tells the pipeline to stop. -- There is no runPhase case for it. @@ -118,6 +119,7 @@ eqPhase LlvmLlc LlvmLlc = True eqPhase LlvmMangle LlvmMangle = True eqPhase CmmCpp CmmCpp = True eqPhase Cmm Cmm = True +eqPhase MergeStub MergeStub = True eqPhase StopLn StopLn = True eqPhase _ _ = False @@ -131,7 +133,7 @@ x `happensBefore` y = after_x `eqPhase` y || after_x `happensBefore` y after_x = nextPhase x nextPhase :: Phase -> Phase --- A conservative approximation the next phase, used in happensBefore +-- A conservative approximation to the next phase, used in happensBefore nextPhase (Unlit sf) = Cpp sf nextPhase (Cpp sf) = HsPp sf nextPhase (HsPp sf) = Hsc sf @@ -145,12 +147,13 @@ nextPhase LlvmLlc = LlvmMangle nextPhase LlvmLlc = As #endif nextPhase LlvmMangle = As -nextPhase SplitAs = StopLn +nextPhase SplitAs = MergeStub nextPhase Ccpp = As nextPhase Cc = As nextPhase CmmCpp = Cmm nextPhase Cmm = HCc nextPhase HCc = As +nextPhase MergeStub = StopLn nextPhase StopLn = panic "nextPhase: nothing after StopLn" -- the first compilation phase for a given file is determined @@ -204,6 +207,7 @@ phaseInputExt LlvmMangle = "lm_s" phaseInputExt SplitAs = "split_s" -- not really generated phaseInputExt CmmCpp = "cmm" phaseInputExt Cmm = "cmmcpp" +phaseInputExt MergeStub = "o" phaseInputExt StopLn = "o" haskellish_src_suffixes, haskellish_suffixes, cish_suffixes, |