summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/PIC.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
index 834aa1b86c..b28e0fc68f 100644
--- a/compiler/nativeGen/PIC.hs
+++ b/compiler/nativeGen/PIC.hs
@@ -178,7 +178,8 @@ cmmMakePicReference dflags lbl
(platformOS $ targetPlatform dflags)
lbl ]
- | (positionIndependent dflags || WayDyn `elem` ways dflags) && absoluteLabel lbl
+ | (positionIndependent dflags || gopt Opt_ExternalDynamicRefs dflags)
+ && absoluteLabel lbl
= CmmMachOp (MO_Add (wordWidth dflags))
[ CmmReg (CmmGlobal PicBaseReg)
, CmmLit $ picRelative
@@ -238,7 +239,7 @@ howToAccessLabel
howToAccessLabel dflags _ OSMinGW32 this_mod _ lbl
-- Assume all symbols will be in the same PE, so just access them directly.
- | WayDyn `notElem` ways dflags
+ | not (gopt Opt_ExternalDynamicRefs dflags)
= AccessDirectly
-- If the target symbol is in another PE we need to access it via the
@@ -339,7 +340,8 @@ howToAccessLabel dflags _ os _ _ _
-- if we don't dynamically link to Haskell code,
-- it actually manages to do so without messing things up.
| osElfTarget os
- , not (positionIndependent dflags) && WayDyn `notElem` ways dflags
+ , not (positionIndependent dflags) &&
+ not (gopt Opt_ExternalDynamicRefs dflags)
= AccessDirectly
howToAccessLabel dflags arch os this_mod DataReference lbl
@@ -470,7 +472,7 @@ needImportedSymbols dflags arch os
-- PowerPC Linux: -fPIC or -dynamic
| osElfTarget os
, arch == ArchPPC
- = positionIndependent dflags || WayDyn `elem` ways dflags
+ = positionIndependent dflags || gopt Opt_ExternalDynamicRefs dflags
-- PowerPC 64 Linux: always
| osElfTarget os
@@ -480,7 +482,8 @@ needImportedSymbols dflags arch os
-- i386 (and others?): -dynamic but not -fPIC
| osElfTarget os
, arch /= ArchPPC_64 ELF_V1 && arch /= ArchPPC_64 ELF_V2
- = WayDyn `elem` ways dflags && not (positionIndependent dflags)
+ = gopt Opt_ExternalDynamicRefs dflags &&
+ not (positionIndependent dflags)
| otherwise
= False