Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
61d41b90
Commit
61d41b90
authored
Sep 03, 2012
by
ian@well-typed.com
Browse files
Move ldInputs into DynFlags
parent
3b56334d
Changes
5
Hide whitespace changes
Inline
Side-by-side
compiler/ghci/Linker.lhs
View file @
61d41b90
...
...
@@ -44,7 +44,6 @@ import BasicTypes
import Outputable
import Panic
import Util
import StaticFlags
import ErrUtils
import SrcLoc
import qualified Maybes
...
...
@@ -264,7 +263,7 @@ showLinkerState dflags
-- @-l@ options in @v_Opt_l@,
--
-- d) Loading any @.o\/.dll@ files specified on the command line, now held
-- in @
v_Ld_i
nputs@,
-- in @
ldI
nputs@,
--
-- e) Loading any MacOS frameworks.
--
...
...
@@ -298,7 +297,7 @@ reallyInitDynLinker dflags =
; libspecs <- mapM (locateLib dflags False lib_paths) minus_ls
-- (d) Link .o files from the command-line
; cmdline_ld_inputs
<- readIORef v_Ld_input
s
;
let
cmdline_ld_inputs
= ldInputs dflag
s
; classified_ld_inputs <- mapM (classifyLdInput dflags) cmdline_ld_inputs
...
...
compiler/main/DriverPipeline.hs
View file @
61d41b90
...
...
@@ -39,7 +39,6 @@ import Module
import
UniqFM
(
eltsUFM
)
import
ErrUtils
import
DynFlags
import
StaticFlags
(
v_Ld_inputs
)
import
Config
import
Panic
import
Util
...
...
@@ -357,7 +356,7 @@ linkingNeeded dflags linkables pkg_deps = do
Left
_
->
return
True
Right
t
->
do
-- first check object files and extra_ld_inputs
extra_ld_inputs
<-
readIORef
v_Ld_input
s
let
extra_ld_inputs
=
ldInputs
dflag
s
e_extra_times
<-
mapM
(
tryIO
.
getModificationUTCTime
)
extra_ld_inputs
let
(
errs
,
extra_times
)
=
splitEithers
e_extra_times
let
obj_times
=
map
linkableTime
linkables
++
extra_times
...
...
@@ -1557,7 +1556,7 @@ getLinkInfo dflags dep_packages = do
pkg_frameworks
<-
case
platformOS
(
targetPlatform
dflags
)
of
OSDarwin
->
getPackageFrameworks
dflags
dep_packages
_
->
return
[]
extra_ld_inputs
<-
readIORef
v_Ld_input
s
let
extra_ld_inputs
=
ldInputs
dflag
s
let
link_info
=
(
package_link_opts
,
pkg_frameworks
,
...
...
@@ -1715,7 +1714,7 @@ linkBinary dflags o_files dep_packages = do
return
[]
-- probably _stub.o files
extra_ld_inputs
<-
readIORef
v_Ld_input
s
let
extra_ld_inputs
=
ldInputs
dflag
s
-- opts from -optl-<blah> (including -l<blah> options)
let
extra_ld_opts
=
getOpts
dflags
opt_l
...
...
@@ -1913,7 +1912,7 @@ linkDynLib dflags o_files dep_packages
let
pkg_link_opts
=
collectLinkOpts
dflags
pkgs_no_rts
-- probably _stub.o files
extra_ld_inputs
<-
readIORef
v_Ld_input
s
let
extra_ld_inputs
=
ldInputs
dflag
s
let
extra_ld_opts
=
getOpts
dflags
opt_l
...
...
compiler/main/DynFlags.hs
View file @
61d41b90
...
...
@@ -563,6 +563,8 @@ data DynFlags = DynFlags {
-- Set by @-ddump-file-prefix@
dumpPrefixForce
::
Maybe
FilePath
,
ldInputs
::
[
String
],
includePaths
::
[
String
],
libraryPaths
::
[
String
],
frameworkPaths
::
[
String
],
-- used on darwin only
...
...
@@ -1130,6 +1132,7 @@ defaultDynFlags mySettings =
dynLibLoader
=
SystemDependent
,
dumpPrefix
=
Nothing
,
dumpPrefixForce
=
Nothing
,
ldInputs
=
[]
,
includePaths
=
[]
,
libraryPaths
=
[]
,
frameworkPaths
=
[]
,
...
...
compiler/main/StaticFlags.hs
View file @
61d41b90
...
...
@@ -66,7 +66,6 @@ module StaticFlags (
-- misc opts
opt_ErrorSpans
,
opt_HistorySize
,
v_Ld_inputs
,
opt_StubDeadValues
,
-- For the parser
...
...
@@ -293,20 +292,9 @@ opt_UF_DearOp = ( 40 :: Int)
opt_ErrorSpans
::
Bool
opt_ErrorSpans
=
lookUp
(
fsLit
"-ferror-spans"
)
-- object files and libraries to be linked in are collected here.
-- ToDo: perhaps this could be done without a global, it wasn't obvious
-- how to do it though --SDM.
GLOBAL_VAR
(
v_Ld_inputs
,
[]
,
[
String
])
-----------------------------------------------------------------------------
-- Tunneling our global variables into a new instance of the GHC library
-- Ignore the v_Ld_inputs global because:
-- a) It is mutated even once GHC has been initialised, which means that I'd
-- have to add another layer of indirection to truly share the value
-- b) We can get away without sharing it because it only affects the link,
-- and is mutated by the GHC exe. Users who load up a new copy of the GHC
-- library while another is running almost certainly won't actually access it.
saveStaticFlagGlobals
::
IO
(
Bool
,
[
String
])
saveStaticFlagGlobals
=
liftM2
(,)
(
readIORef
v_opt_C_ready
)
(
readIORef
v_opt_C
)
...
...
ghc/Main.hs
View file @
61d41b90
...
...
@@ -182,11 +182,6 @@ main' postLoadMode dflags0 args flagWarnings = do
liftIO
$
showBanner
postLoadMode
dflags2
-- we've finished manipulating the DynFlags, update the session
_
<-
GHC
.
setSessionDynFlags
dflags2
dflags3
<-
GHC
.
getSessionDynFlags
hsc_env
<-
GHC
.
getSession
let
-- To simplify the handling of filepaths, we normalise all filepaths right
-- away - e.g., for win32 platforms, backslashes are converted
...
...
@@ -194,9 +189,12 @@ main' postLoadMode dflags0 args flagWarnings = do
normal_fileish_paths
=
map
(
normalise
.
unLoc
)
fileish_args
(
srcs
,
objs
)
=
partition_args
normal_fileish_paths
[]
[]
-- Note: have v_Ld_inputs maintain the order in which 'objs' occurred on
-- the command-line.
liftIO
$
mapM_
(
consIORef
v_Ld_inputs
)
(
reverse
objs
)
dflags2a
=
dflags2
{
ldInputs
=
objs
++
ldInputs
dflags2
}
-- we've finished manipulating the DynFlags, update the session
_
<-
GHC
.
setSessionDynFlags
dflags2a
dflags3
<-
GHC
.
getSessionDynFlags
hsc_env
<-
GHC
.
getSession
---------------- Display configuration -----------
when
(
verbosity
dflags3
>=
4
)
$
...
...
@@ -251,7 +249,7 @@ partition_args (arg:args) srcs objs
{-
We split out the object files (.o, .dll) and add them
to
v_Ld_i
nputs for use by the linker.
to
ldI
nputs for use by the linker.
The following things should be considered compilation manager inputs:
...
...
@@ -639,7 +637,9 @@ doMake srcs = do
o_files
<-
mapM
(
\
x
->
liftIO
$
compileFile
hsc_env
StopLn
x
)
non_hs_srcs
liftIO
$
mapM_
(
consIORef
v_Ld_inputs
)
(
reverse
o_files
)
dflags
<-
GHC
.
getSessionDynFlags
let
dflags'
=
dflags
{
ldInputs
=
o_files
++
ldInputs
dflags
}
_
<-
GHC
.
setSessionDynFlags
dflags'
targets
<-
mapM
(
uncurry
GHC
.
guessTarget
)
hs_srcs
GHC
.
setTargets
targets
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment