summaryrefslogtreecommitdiff
path: root/compiler/main/Finder.lhs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-01-31 10:32:24 +0000
committerSimon Marlow <marlowsd@gmail.com>2011-04-05 14:12:19 +0100
commit7b0ff1792d699ff02a604163c9ccf4a98a1ca3eb (patch)
tree39d13b2316841d8566e9dfda06fe6b9a07aa389f /compiler/main/Finder.lhs
parent0ce8f5e727dfb59857a0f6e34d7617796e76baac (diff)
downloadhaskell-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/Finder.lhs')
-rw-r--r--compiler/main/Finder.lhs20
1 files changed, 5 insertions, 15 deletions
diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs
index d8a627167c..5cbcd411e2 100644
--- a/compiler/main/Finder.lhs
+++ b/compiler/main/Finder.lhs
@@ -498,7 +498,7 @@ mkStubPaths
:: DynFlags
-> ModuleName
-> ModLocation
- -> (FilePath,FilePath,FilePath)
+ -> FilePath
mkStubPaths dflags mod location
= let
@@ -513,15 +513,8 @@ mkStubPaths dflags mod location
| otherwise = src_basename
stub_basename = stub_basename0 ++ "_stub"
-
- obj = ml_obj_file location
- osuf = objectSuf dflags
- stub_obj_base = dropTail (length osuf + 1) obj ++ "_stub"
- -- NB. not takeFileName, see #3093
in
- (stub_basename <.> "c",
- stub_basename <.> "h",
- stub_obj_base <.> objectSuf dflags)
+ stub_basename <.> "h"
-- -----------------------------------------------------------------------------
-- findLinkable isn't related to the other stuff in here,
@@ -538,12 +531,9 @@ findObjectLinkableMaybe mod locn
-- Make an object linkable when we know the object file exists, and we know
-- its modification time.
findObjectLinkable :: Module -> FilePath -> ClockTime -> IO Linkable
-findObjectLinkable mod obj_fn obj_time = do
- let stub_fn = (dropExtension obj_fn ++ "_stub") <.> "o"
- stub_exist <- doesFileExist stub_fn
- if stub_exist
- then return (LM obj_time mod [DotO obj_fn, DotO stub_fn])
- else return (LM obj_time mod [DotO obj_fn])
+findObjectLinkable mod obj_fn obj_time = return (LM obj_time mod [DotO obj_fn])
+ -- We used to look for _stub.o files here, but that was a bug (#706)
+ -- Now GHC merges the stub.o into the main .o (#3687)
-- -----------------------------------------------------------------------------
-- Error messages