From 49fff41d0385ac1ad80a1a8b2ae33e765e89a088 Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Tue, 18 Jun 2019 14:55:45 -0400
Subject: [PATCH] linker: Disable code unloading

As noted in #16841, there are currently a variety of bugs in the
unloading logic. These only affect Windows since code unloading is
disabled on Linux, where we build with `GhcDynamic=YES` by default.

In the interest of getting the tree green on Windows disable code
unloading until the issues are resolved.
---
 compiler/ghci/Linker.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index bd74d36c5684..c77ca5c5e6ac 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -1123,7 +1123,10 @@ unload_wkr hsc_env keep_linkables pls@PersistentLinkerState{..}  = do
         -- We don't do any cleanup when linking objects with the
         -- dynamic linker.  Doing so introduces extra complexity for
         -- not much benefit.
-      | otherwise
+
+      -- Code unloading currently disabled due to instability.
+      -- See #16841.
+      | False -- otherwise
       = mapM_ (unloadObj hsc_env) [f | DotO f <- linkableUnlinked lnk]
                 -- The components of a BCO linkable may contain
                 -- dot-o files.  Which is very confusing.
@@ -1131,6 +1134,7 @@ unload_wkr hsc_env keep_linkables pls@PersistentLinkerState{..}  = do
                 -- But the BCO parts can be unlinked just by
                 -- letting go of them (plus of course depopulating
                 -- the symbol table which is done in the main body)
+      | otherwise = return () -- see #16841
 
 {- **********************************************************************
 
-- 
GitLab