diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index b5f548c72a78b3c38932bc82ccc6db8aa9f5689b..e2ecae8e7e3b41efc8c6521d47c8583f4999998d 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -1995,7 +1995,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 && not hostIsProfiled && internalInterpreter &&
+      | sTargetRTSLinkerOnlySupportsSharedLibs $ settings lcl_dflags =
+          not isDynWay && not dyn_too_enabled
+            && enable_object
+      | otherwise =
+          hostIsDynamic && not hostIsProfiled && internalInterpreter &&
             not isDynWay && not isProfWay &&  not dyn_too_enabled
               && enable_object
       where