summaryrefslogtreecommitdiff
path: root/compiler/GHC/Cmm
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Cmm')
-rw-r--r--compiler/GHC/Cmm/CLabel.hs18
-rw-r--r--compiler/GHC/Cmm/Info/Build.hs7
2 files changed, 14 insertions, 11 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs
index bef9b0f8c7..c6969be7ca 100644
--- a/compiler/GHC/Cmm/CLabel.hs
+++ b/compiler/GHC/Cmm/CLabel.hs
@@ -132,6 +132,7 @@ import GHC.Platform
import GHC.Types.Unique.Set
import Util
import GHC.Core.Ppr ( {- instances -} )
+import GHC.CmmToAsm.Config
-- -----------------------------------------------------------------------------
-- The CLabel type
@@ -1027,23 +1028,21 @@ isLocalCLabel this_mod lbl =
-- that data resides in a DLL or not. [Win32 only.]
-- @labelDynamic@ returns @True@ if the label is located
-- in a DLL, be it a data reference or not.
-labelDynamic :: DynFlags -> Module -> CLabel -> Bool
-labelDynamic dflags this_mod lbl =
+labelDynamic :: NCGConfig -> Module -> CLabel -> Bool
+labelDynamic config this_mod lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ ->
externalDynamicRefs && (this_pkg /= rtsUnitId)
IdLabel n _ _ ->
- isDynLinkName dflags this_mod n
+ externalDynamicRefs && isDynLinkName platform this_mod n
-- When compiling in the "dyn" way, each package is to be linked into
-- its own shared library.
CmmLabel pkg _ _
- | os == OSMinGW32 ->
- externalDynamicRefs && (this_pkg /= pkg)
- | otherwise ->
- gopt Opt_ExternalDynamicRefs dflags
+ | os == OSMinGW32 -> externalDynamicRefs && (this_pkg /= pkg)
+ | otherwise -> externalDynamicRefs
LocalBlockLabel _ -> False
@@ -1080,8 +1079,9 @@ labelDynamic dflags this_mod lbl =
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
where
- externalDynamicRefs = gopt Opt_ExternalDynamicRefs dflags
- os = platformOS (targetPlatform dflags)
+ externalDynamicRefs = ncgExternalDynamicRefs config
+ platform = ncgPlatform config
+ os = platformOS platform
this_pkg = moduleUnitId this_mod
diff --git a/compiler/GHC/Cmm/Info/Build.hs b/compiler/GHC/Cmm/Info/Build.hs
index 9a7602504e..8ee009f638 100644
--- a/compiler/GHC/Cmm/Info/Build.hs
+++ b/compiler/GHC/Cmm/Info/Build.hs
@@ -31,6 +31,8 @@ import GHC.Runtime.Heap.Layout
import GHC.Types.Unique.Supply
import GHC.Types.CostCentre
import GHC.StgToCmm.Heap
+import GHC.CmmToAsm.Monad
+import GHC.CmmToAsm.Config
import Control.Monad
import Data.Map.Strict (Map)
@@ -925,6 +927,7 @@ oneSRT dflags staticFuns lbls caf_lbls isCAF cafs static_data = do
topSRT <- get
let
+ config = initConfig dflags
srtMap = moduleSRTMap topSRT
blockids = getBlockLabels lbls
@@ -1024,11 +1027,11 @@ oneSRT dflags staticFuns lbls caf_lbls isCAF cafs static_data = do
-- when dynamic linking is used we cannot guarantee that the offset
-- between the SRT and the info table will fit in the offset field.
-- Consequently we build a singleton SRT in in this case.
- not (labelDynamic dflags this_mod lbl)
+ not (labelDynamic config this_mod lbl)
-- MachO relocations can't express offsets between compilation units at
-- all, so we are always forced to build a singleton SRT in this case.
- && (not (osMachOTarget $ platformOS $ targetPlatform dflags)
+ && (not (osMachOTarget $ platformOS $ ncgPlatform config)
|| isLocalCLabel this_mod lbl) -> do
-- If we have a static function closure, then it becomes the