From e267aa7fa2cfc10e97571d14a76ca9a0dc4a668f Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Wed, 20 Nov 2024 18:19:58 -0500
Subject: [PATCH] hadrian-ghci-multi: Pass -this-package-name in unit response
 files

As noted in #25509, the `-this-package-name` must be passed for each
package to ensure that GHC can response references to the packages'
exposed modules via package-qualified imports. Fix this.

Closes #25509.
---
 hadrian/src/Rules/ToolArgs.hs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hadrian/src/Rules/ToolArgs.hs b/hadrian/src/Rules/ToolArgs.hs
index 31e136db82a..1dd6addfccb 100644
--- a/hadrian/src/Rules/ToolArgs.hs
+++ b/hadrian/src/Rules/ToolArgs.hs
@@ -86,9 +86,10 @@ multiSetup pkg_s = do
       let rexp m = ["-reexported-module", m]
       let hidir = root </> "interfaces" </> pkgPath p
       writeFile' (resp_file root p) (intercalate "\n" (th_hack arg_list
-                                                      ++  modules cd
+                                                      ++ modules cd
                                                       ++ concatMap rexp (reexportModules cd)
-                                                      ++ ["-outputdir", hidir]))
+                                                      ++ ["-outputdir", hidir,
+                                                          "-this-package-name", pkgName p]))
       return (resp_file root p)
 
 
-- 
GitLab