summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-05-20 17:06:01 +0100
committerIan Lynagh <ian@well-typed.com>2013-05-20 17:06:01 +0100
commit5734f7afcc2b9acf857f8e0f745185bf01b91148 (patch)
tree33a64086ae6af066ebe6969efd32a7eef898a4b2
parent12276005b0d72853671b7b2d3f2b0e9cbb44c153 (diff)
downloadhaskell-5734f7afcc2b9acf857f8e0f745185bf01b91148.tar.gz
Fix -dynamic-too on Windows
If we're building the dynamic way too, then hasCafRefs needs to check whether the dynamic way would use a dynamic name.
-rw-r--r--compiler/main/TidyPgm.lhs15
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs
index 1c6bb397ea..6213663997 100644
--- a/compiler/main/TidyPgm.lhs
+++ b/compiler/main/TidyPgm.lhs
@@ -1180,7 +1180,20 @@ hasCafRefs dflags this_pkg this_mod p arity expr
| otherwise = NoCafRefs
where
mentions_cafs = isFastTrue (cafRefsE dflags p expr)
- is_dynamic_name = isDllName dflags this_pkg this_mod
+ is_dynamic_name n = if gopt Opt_BuildDynamicToo dflags
+ then -- If we're building the dynamic way too,
+ -- then we need to check whether it's a
+ -- dynamic name there too. Note that this
+ -- means that the vanila code is more
+ -- pessimistic on Windows when -dynamic-too
+ -- is used, but the alternative is that
+ -- -dynamic-too is unusable on Windows
+ -- as even the interfaces in the integer
+ -- package don't match.
+ is_dynamic_name' dflags n ||
+ is_dynamic_name' (doDynamicToo dflags) n
+ else is_dynamic_name' dflags n
+ is_dynamic_name' dflags' = isDllName dflags' this_pkg this_mod
is_caf = not (arity > 0 || rhsIsStatic (targetPlatform dflags) is_dynamic_name expr)
-- NB. we pass in the arity of the expression, which is expected