summaryrefslogtreecommitdiff
path: root/compiler/cmm/CLabel.hs
diff options
context:
space:
mode:
authorSimon Marlow <smarlow@fb.com>2018-02-28 11:03:37 -0800
committerSimon Marlow <marlowsd@gmail.com>2018-03-08 08:36:15 +0000
commitd99a65a80cb671363fa41c826b95b9a89de60878 (patch)
treef5a659eb0f44e6b2a62b24f39e4b8db36ba321ed /compiler/cmm/CLabel.hs
parent43fbb905eade2e3e3af67ce944262709763b6578 (diff)
downloadhaskell-d99a65a80cb671363fa41c826b95b9a89de60878.tar.gz
Add -fexternal-dynamic-refs
Summary: The `-dynamic` flag does two things: * In the code generator, it generates code designed to link against external shared libraries. References outside of the current module go through platform-specific indirection tables (e.g. the GOT on ELF). * It enables a "way", which changes which hi files we look for (`Foo.dyn_hi`) and which libraries we link against. Some specialised applications want the first of these without the second. (I could go into detail here but it's probably not all that important). This diff splits out the code-generation effects of `-dynamic` from the "way" parts of its behaviour, via a new flag `-fexternal-dynamic-refs`. Test Plan: validate Reviewers: niteria, bgamari, erikd Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4477
Diffstat (limited to 'compiler/cmm/CLabel.hs')
-rw-r--r--compiler/cmm/CLabel.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index 9170ee0410..a37ce7e87f 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -982,17 +982,19 @@ labelDynamic :: DynFlags -> Module -> CLabel -> Bool
labelDynamic dflags this_mod lbl =
case lbl of
-- is the RTS in a DLL or not?
- RtsLabel _ -> (WayDyn `elem` ways dflags) && (this_pkg /= rtsUnitId)
+ RtsLabel _ ->
+ (gopt Opt_ExternalDynamicRefs dflags) && (this_pkg /= rtsUnitId)
- IdLabel n _ _ -> isDllName dflags this_mod n
+ IdLabel n _ _ ->
+ isDllName dflags this_mod n
-- When compiling in the "dyn" way, each package is to be linked into
-- its own shared library.
CmmLabel pkg _ _
| os == OSMinGW32 ->
- (WayDyn `elem` ways dflags) && (this_pkg /= pkg)
+ (gopt Opt_ExternalDynamicRefs dflags) && (this_pkg /= pkg)
| otherwise ->
- True
+ gopt Opt_ExternalDynamicRefs dflags
LocalBlockLabel _ -> False
@@ -1010,14 +1012,15 @@ labelDynamic dflags this_mod lbl =
-- When compiling in the "dyn" way, each package is to be
-- linked into its own DLL.
ForeignLabelInPackage pkgId ->
- (WayDyn `elem` ways dflags) && (this_pkg /= pkgId)
+ (gopt Opt_ExternalDynamicRefs dflags) && (this_pkg /= pkgId)
else -- On Mac OS X and on ELF platforms, false positives are OK,
-- so we claim that all foreign imports come from dynamic
-- libraries
True
- HpcTicksLabel m -> (WayDyn `elem` ways dflags) && this_mod /= m
+ HpcTicksLabel m ->
+ (gopt Opt_ExternalDynamicRefs dflags) && this_mod /= m
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False