Commit 935bf7c0 authored by ian@well-typed.com's avatar ian@well-typed.com

Merge branch 'master' of http://darcs.haskell.org/ghc

parents a299f108 0b3811c0
......@@ -179,11 +179,41 @@ cpsTop hsc_env proc =
-- the entry point.
splitting_proc_points = hscTarget dflags /= HscAsm
|| not (tablesNextToCode dflags)
|| usingDarwinX86Pic
|| usingDarwinX86Pic -- Note [darwin-x86-pic]
usingDarwinX86Pic = platformArch platform == ArchX86
&& platformOS platform == OSDarwin
&& gopt Opt_PIC dflags
{- Note [darwin-x86-pic]
On x86/Darwin, PIC is implemented by inserting a sequence like
call 1f
1: popl %reg
at the proc entry point, and then referring to labels as offsets from
%reg. If we don't split proc points, then we could have many entry
points in a proc that would need this sequence, and each entry point
would then get a different value for %reg. If there are any join
points, then at the join point we don't have a consistent value for
%reg, so we don't know how to refer to labels.
Hence, on x86/Darwin, we have to split proc points, and then each proc
point will get its own PIC initialisation sequence.
This isn't an issue on x86/ELF, where the sequence is
call 1f
1: popl %reg
addl $_GLOBAL_OFFSET_TABLE_+(.-1b), %reg
so %reg always has a consistent value: the address of
_GLOBAL_OFFSET_TABLE_, regardless of which entry point we arrived via.
-}
runUniqSM :: UniqSM a -> IO a
runUniqSM m = do
us <- mkSplitUniqSupply 'u'
......
......@@ -222,6 +222,8 @@ cmmRegOff reg byte_off = CmmRegOff reg byte_off
cmmOffsetLit :: CmmLit -> Int -> CmmLit
cmmOffsetLit (CmmLabel l) byte_off = cmmLabelOff l byte_off
cmmOffsetLit (CmmLabelOff l m) byte_off = cmmLabelOff l (m+byte_off)
cmmOffsetLit (CmmLabelDiffOff l1 l2 m) byte_off
= CmmLabelDiffOff l1 l2 (m+byte_off)
cmmOffsetLit (CmmInt m rep) byte_off = CmmInt (m + fromIntegral byte_off) rep
cmmOffsetLit _ byte_off = pprPanic "cmmOffsetLit" (ppr byte_off)
......
%
% (c) The University of Glasgow 2005-2006
% (c) The University of Glasgow 2005-2012
%
\begin{code}
-- | The dynamic linker for GHCi.
......@@ -1239,7 +1239,7 @@ searchForLibUsingGcc dflags so dirs = do
else return (Just file)
-- ----------------------------------------------------------------------------
-- Loading a dyanmic library (dlopen()-ish on Unix, LoadLibrary-ish on Win32)
-- Loading a dynamic library (dlopen()-ish on Unix, LoadLibrary-ish on Win32)
-- Darwin / MacOS X only: load a framework
-- a framework is a dynamic library packaged inside a directory of the same
......
......@@ -1365,7 +1365,7 @@ stg_putMVarzh ( P_ mvar, /* :: MVar a */
ALLOC_PRIM_WITH_CUSTOM_FAILURE
(SIZEOF_StgMVarTSOQueue,
unlockClosure(mvar, stg_MVAR_DIRTY_info);
GC_PRIM_P(stg_putMVarzh, mvar));
GC_PRIM_PP(stg_putMVarzh, mvar, val));
q = Hp - SIZEOF_StgMVarTSOQueue + WDS(1);
......
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
# (c) 2009-2012 The University of Glasgow
#
# This file is part of the GHC build system.
#
......@@ -46,9 +46,9 @@ $$(INPLACE_WRAPPER): $$($1_$2_INPLACE)
$$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
ifeq "$$(TargetOS_CPP)" "linux"
echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH)"' >> $$@
echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH):$$$$LD_LIBRARY_PATH"' >> $$@
else ifeq "$$(TargetOS_CPP)" "darwin"
echo 'export DYLD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH)"' >> $$@
echo 'export DYLD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH):$$$$DYLD_LIBRARY_PATH"' >> $$@
endif
endif
ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
......
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