Commit b562cbe3 authored by Clemens Fruhwirth's avatar Clemens Fruhwirth

Renames functions and constructors to fit their new ability for dynamic linking

function: staticLink -> linkBinary (will link non static binaries too)
function: doMkDLL -> linkDynLib (as we can link on ELF too where DLL is an inappropriate term)
constructor: MkDLL -> LinkDynLib
parent 9c69ef13
......@@ -12,16 +12,13 @@ module DriverPipeline (
oneShot, compileFile,
-- Interfaces for the batch-mode driver
staticLink,
linkBinary,
-- Interfaces for the compilation manager (interpreted/batch-mode)
preprocess,
compile, CompResult(..),
link,
-- DLL building
doMkDLL,
) where
#include "HsVersions.h"
......@@ -314,13 +311,13 @@ link LinkBinary dflags batch_attempt_linking hpt
-- Don't showPass in Batch mode; doLink will do that for us.
let link = case ghcLink dflags of
MkDLL -> doMkDLL
LinkBinary -> staticLink
LinkBinary -> linkBinary
LinkDynLib -> linkDynLib
link dflags obj_files pkg_deps
debugTraceMsg dflags 3 (text "link: done")
-- staticLink only returns if it succeeds
-- linkBinary only returns if it succeeds
return Succeeded
| otherwise
......@@ -375,8 +372,8 @@ doLink dflags stop_phase o_files
| otherwise
= case ghcLink dflags of
NoLink -> return ()
LinkBinary -> staticLink dflags o_files link_pkgs
MkDLL -> doMkDLL dflags o_files link_pkgs
LinkBinary -> linkBinary dflags o_files link_pkgs
LinkDynLib -> linkDynLib dflags o_files []
where
-- Always link in the haskell98 package for static linking. Other
-- packages have to be specified via the -package flag.
......@@ -1050,7 +1047,7 @@ runPhase SplitAs stop dflags basename _suff _input_fn get_output_fn maybe_loc
-- wrapper script calling the binary. Currently, we need this only in
-- a parallel way (i.e. in GUM), because PVM expects the binary in a
-- central directory.
-- This is called from staticLink below, after linking. I haven't made it
-- This is called from linkBinary below, after linking. I haven't made it
-- a separate phase to minimise interfering with other modules, and
-- we don't need the generality of a phase (MoveBinary is always
-- done after linking and makes only sense in a parallel setup) -- HWL
......@@ -1164,8 +1161,8 @@ getHCFilePackages filename =
-- read any interface files), so the user must explicitly specify all
-- the packages.
staticLink :: DynFlags -> [FilePath] -> [PackageId] -> IO ()
staticLink dflags o_files dep_packages = do
linkBinary :: DynFlags -> [FilePath] -> [PackageId] -> IO ()
linkBinary dflags o_files dep_packages = do
let verb = getVerbFlag dflags
output_fn = exeFileName dflags
......@@ -1276,11 +1273,8 @@ exeFileName dflags
"a.out"
#endif
-----------------------------------------------------------------------------
-- Making a DLL (only for Win32)
doMkDLL :: DynFlags -> [String] -> [PackageId] -> IO ()
doMkDLL dflags o_files dep_packages = do
linkDynLib :: DynFlags -> [String] -> [PackageId] -> IO ()
linkDynLib dflags o_files dep_packages = do
let verb = getVerbFlag dflags
let static = opt_Static
let no_hs_main = dopt Opt_NoHsMain dflags
......
......@@ -361,7 +361,7 @@ data GhcLink -- What to do in the link step, if there is one
= NoLink -- Don't link at all
| LinkBinary -- Link object code into a binary
| LinkInMemory -- Use the in-memory dynamic linker
| MkDLL -- Make a DLL
| LinkDynLib -- Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
deriving Eq
isNoLink :: GhcLink -> Bool
......@@ -874,7 +874,7 @@ dynamic_flags = [
-------- Linking ----------------------------------------------------
, ( "c" , NoArg (upd $ \d -> d{ ghcLink=NoLink } ))
, ( "no-link" , NoArg (upd $ \d -> d{ ghcLink=NoLink } )) -- Dep.
, ( "-mk-dll" , NoArg (upd $ \d -> d{ ghcLink=MkDLL } ))
, ( "shared" , NoArg (upd $ \d -> d{ ghcLink=LinkDynLib } ))
------- Libraries ---------------------------------------------------
, ( "L" , Prefix addLibraryPath )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment