From 943dc155f3304d62c8596196c8b16ee7156b91b4 Mon Sep 17 00:00:00 2001
From: brianlsmith <brianlsmith@gmail.com>
Date: Sun, 7 Aug 2005 18:35:38 +0000
Subject: [PATCH] Always invoke the ld.exe that is in $ghc-bin\..\gcc-lib on
 Windows, because ld is probably not in the path on Windows.

---
 Distribution/Simple/Build.hs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Distribution/Simple/Build.hs b/Distribution/Simple/Build.hs
index 50940bfb4a..4c4fd04429 100644
--- a/Distribution/Simple/Build.hs
+++ b/Distribution/Simple/Build.hs
@@ -211,7 +211,14 @@ buildGHC pkg_descr lbi verbose = do
 		++ stubObjs
         rawSystemPathExit verbose "ar" arArgs
         ifProfLib (rawSystemPathExit verbose "ar" arProfArgs)
-	ifGHCiLib (rawSystemPathExit verbose "ld" ldArgs)
+#if defined(mingw32_TARGET_OS) || defined(mingw32_HOST_OS)
+        let (compilerDir, _) = splitFileName $ compilerPath (compiler lbi)
+            (baseDir, _)     = splitFileName compilerDir
+            ld = baseDir `joinFileName` "gcc-lib\\ld.exe"
+        ifGHCiLib (rawSystemExit verbose ld ldArgs)
+#else
+        ifGHCiLib (rawSystemPathExit verbose "ld" ldArgs)
+#endif
 
   -- build any executables
   withExe pkg_descr $ \ (Executable exeName' modPath exeBi) -> do
-- 
GitLab