From 8844513929ccd58854227ddb6275095a1f1742ad Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Mon, 16 Mar 2009 20:34:37 +0000 Subject: [PATCH] FIX #3093: stub filenames when using -osuf Also remove some unused cruft --- compiler/main/DriverPipeline.hs | 7 +++---- compiler/main/Finder.lhs | 19 +++++-------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 3daa76e..6557c05 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -260,11 +260,10 @@ compile' (nothingCompiler, interactiveCompiler, batchCompiler) compileStub :: GhcMonad m => HscEnv -> Module -> ModLocation -> m FilePath compileStub hsc_env mod location = do - let (o_base, o_ext) = splitExtension (ml_obj_file location) - stub_o = (o_base ++ "_stub") <.> o_ext - -- compile the _stub.c file w/ gcc - let (stub_c,_,_) = mkStubPaths (hsc_dflags hsc_env) (moduleName mod) location + let (stub_c,_,stub_o) = mkStubPaths (hsc_dflags hsc_env) + (moduleName mod) location + runPipeline StopLn hsc_env (stub_c,Nothing) Nothing (SpecificFile stub_o) Nothing{-no ModLocation-} diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs index b923b92..1d43591 100644 --- a/compiler/main/Finder.lhs +++ b/compiler/main/Finder.lhs @@ -498,23 +498,14 @@ mkStubPaths dflags mod location stub_basename = stub_basename0 ++ "_stub" - -- this is the filename we're going to use when - -- \#including the stub_h file from the .hc file. - -- Without -stubdir, we just #include the basename - -- (eg. for a module A.B, we #include "B_stub.h"), - -- relying on the fact that we add an implicit -I flag - -- for the directory in which the source file resides - -- (see DriverPipeline.hs). With -stubdir, we - -- \#include "A/B.h", assuming that the user has added - -- -I along with -stubdir . - include_basename - | Just _ <- stubdir = mod_basename - | otherwise = takeFileName src_basename + 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", - (include_basename ++ "_stub") <.> "h") - -- the _stub.o filename is derived from the ml_obj_file. + stub_obj_base <.> objectSuf dflags) -- ----------------------------------------------------------------------------- -- findLinkable isn't related to the other stuff in here, -- 1.7.10.4