From a0928e35b5991b08e01cf8b26128eb54a6eb25ee Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 17 Dec 2002 13:50:29 +0000 Subject: [PATCH] [project @ 2002-12-17 13:50:28 by simonmar] - add -no-link flag (omits link step, except in GHCi) - tidy up some informmational messages --- ghc/compiler/compMan/CompManager.lhs | 2 +- ghc/compiler/main/DriverFlags.hs | 3 ++- ghc/compiler/main/DriverPipeline.hs | 13 +++++++++++-- ghc/compiler/main/DriverState.hs | 3 ++- ghc/compiler/main/Main.hs | 8 +++++--- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs index 6dc4c6e..517b824 100644 --- a/ghc/compiler/compMan/CompManager.lhs +++ b/ghc/compiler/compMan/CompManager.lhs @@ -490,7 +490,7 @@ cmDepAnal cmstate dflags rootnames = do showPass dflags "Chasing dependencies" when (verbosity dflags >= 1 && gmode cmstate == Batch) $ hPutStrLn stderr (showSDoc (hcat [ - text progName, text ": chasing modules from: ", + text "Chasing modules from: ", hcat (punctuate comma (map text rootnames))])) downsweep rootnames (mg cmstate) diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs index 9813c82..328dac3 100644 --- a/ghc/compiler/main/DriverFlags.hs +++ b/ghc/compiler/main/DriverFlags.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverFlags.hs,v 1.107 2002/12/12 17:36:18 simonmar Exp $ +-- $Id: DriverFlags.hs,v 1.108 2002/12/17 13:50:29 simonmar Exp $ -- -- Driver flags -- @@ -294,6 +294,7 @@ static_flags = , ( "optdll" , HasArg (add v_Opt_dll) ) ----- Linker -------------------------------------------------------- + , ( "no-link" , NoArg (writeIORef v_NoLink True) ) , ( "static" , NoArg (writeIORef v_Static True) ) , ( "dynamic" , NoArg (writeIORef v_Static False) ) , ( "rdynamic" , NoArg (return ()) ) -- ignored for compat w/ gcc diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index a129357..0721c72 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -301,8 +301,17 @@ link' Interactive dflags batch_attempt_linking linkables link' Batch dflags batch_attempt_linking linkables | batch_attempt_linking - = do when (verb >= 1) $ - hPutStrLn stderr "ghc: linking ..." + = do + -- check for the -no-link flag + omit_linking <- readIORef v_NoLink + if omit_linking + then do when (verb >= 3) $ + hPutStrLn stderr "link(batch): linking omitted (-no-link flag given)." + return Succeeded + else do + + when (verb >= 1) $ + hPutStrLn stderr "Linking ..." -- Don't showPass in Batch mode; doLink will do that for us. staticLink (concatMap getOfiles linkables) diff --git a/ghc/compiler/main/DriverState.hs b/ghc/compiler/main/DriverState.hs index 5014174..fe5ff52 100644 --- a/ghc/compiler/main/DriverState.hs +++ b/ghc/compiler/main/DriverState.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverState.hs,v 1.86 2002/12/12 17:36:19 simonmar Exp $ +-- $Id: DriverState.hs,v 1.87 2002/12/17 13:50:29 simonmar Exp $ -- -- Settings for the driver -- @@ -96,6 +96,7 @@ GLOBAL_VAR(v_Keep_ilx_files, False, Bool) -- Misc GLOBAL_VAR(v_Scale_sizes_by, 1.0, Double) GLOBAL_VAR(v_Static, True, Bool) +GLOBAL_VAR(v_NoLink, False, Bool) GLOBAL_VAR(v_NoHsMain, False, Bool) GLOBAL_VAR(v_Recomp, True, Bool) GLOBAL_VAR(v_Collect_ghc_timing, False, Bool) diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index 298107c..1fcaf02 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,7 +1,7 @@ {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.114 2002/10/25 16:54:59 simonpj Exp $ +-- $Id: Main.hs,v 1.115 2002/12/17 13:50:29 simonmar Exp $ -- -- GHC Driver program -- @@ -37,7 +37,7 @@ import DriverState ( buildCoreToDo, buildStgToDo, v_GhcMode, v_GhcModeFlag, GhcMode(..), v_Keep_tmp_files, v_Ld_inputs, v_Ways, v_OptLevel, v_Output_file, v_Output_hi, - readPackageConf, verifyOutputFiles + readPackageConf, verifyOutputFiles, v_NoLink ) import DriverFlags ( buildStaticHscOpts, dynamic_flags, processArgs, static_flags) @@ -304,8 +304,10 @@ main = o_files <- mapM compileFile srcs + omit_linking <- readIORef v_NoLink + when (mode == DoMkDependHS) endMkDependHS - when (mode == DoLink) (staticLink o_files) + when (mode == DoLink && not omit_linking) (staticLink o_files) when (mode == DoMkDLL) (doMkDLL o_files) -- 1.7.10.4