summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Session.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-01 10:36:59 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-10-04 07:54:18 +0000
commit8c46913229942887c27d4d2c40fc8acff761501d (patch)
treec1eba01eee33550453184b059d1ff0a0b8238fdf /compiler/GHC/Driver/Session.hs
parente8693713a40072a0dec5e83b1a31ffb0ee881633 (diff)
downloadhaskell-wip/T20436.tar.gz
Disable -dynamic-too if -dynamic is also passedwip/T20436
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/GHC/Driver/Session.hs')
-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.