summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-01 10:36:59 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-06 10:57:24 -0400
commit9af29e7fa81a8696a2d829a0ecbebcbc8be5badd (patch)
tree35b7bc67fd42dfc298befe77912899e62c90d5ec /compiler
parent7fc986e1201bf1dc8f84fef9051be1d9429064b3 (diff)
downloadhaskell-9af29e7fa81a8696a2d829a0ecbebcbc8be5badd.tar.gz
Disable -dynamic-too if -dynamic is also passed
Before if you passed both options then you would generate two identical hi/dyn_hi and o/dyn_o files, both in the dynamic way. It's better to warn this is happening rather than duplicating the work and causing potential confusion. -dynamic-too should only be used with -static. Fixes #20436
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Driver/Session.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index f69f2da243..12f0e8be33 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -4609,6 +4609,12 @@ makeDynFlagsConsistent dflags
= let dflags' = gopt_unset dflags Opt_BuildDynamicToo
warn = "-dynamic-too is not supported on Windows"
in loop dflags' warn
+ -- Disable -dynamic-too if we are are compiling with -dynamic already, otherwise
+ -- you get two dynamic object files (.o and .dyn_o). (#20436)
+ | ways dflags `hasWay` WayDyn && gopt Opt_BuildDynamicToo dflags
+ = let dflags' = gopt_unset dflags Opt_BuildDynamicToo
+ warn = "-dynamic-too is ignored when using -dynamic"
+ in loop dflags' warn
-- Via-C backend only supports unregisterised ABI. Switch to a backend
-- supporting it if possible.