diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index 04718ea00b2130e8b8a13c88bff8653f08d5779e..a91d46f307b65504a87c310b98797939334ed3cd 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -1918,7 +1918,11 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
     -- the linker can correctly load the object files.  This isn't necessary
     -- when using -fexternal-interpreter.
     dynamic_too_enable enable_spec ms
-      = hostIsDynamic && internalInterpreter &&
+      | sTargetRTSLinkerOnlySupportsSharedLibs $ settings lcl_dflags =
+          not isDynWay && not dyn_too_enabled
+            && enable_object
+      | otherwise =
+          hostIsDynamic && internalInterpreter &&
             not isDynWay && not isProfWay &&  not dyn_too_enabled
               && enable_object
       where