From 4e7d0cee8acb2210eb0e1ab12f3200b59afe10ac Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Thu, 3 Oct 2024 16:45:04 +0000
Subject: [PATCH] hadrian: disable internal-interpreter of ghc library when
 cross compiling

This commit disable the internal-interpreter flag of ghc library when
cross compiling, only external interpreter works in such cases.

(cherry picked from commit f232c872c6adf4472b5a1c88812c57aa2aa76cbe)
---
 hadrian/src/Settings/Packages.hs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index d6430ada717..0e4ccb6af0d 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -77,7 +77,15 @@ packageArgs = do
             , compilerStageOption ghcProfiled ? arg "--ghc-pkg-option=--force" ]
 
           , builder (Cabal Flags) ? mconcat
-            [ andM [expr ghcWithInterpreter, notStage0] `cabalFlag` "internal-interpreter"
+            -- For the ghc library, internal-interpreter only makes
+            -- sense when we're not cross compiling. For cross GHC,
+            -- external interpreter is used for loading target code
+            -- and internal interpreter is supposed to load native
+            -- code for plugins (!7377), however it's unfinished work
+            -- (#14335) and completely untested in CI for cross
+            -- backends at the moment, so we might as well disable it
+            -- for cross GHC.
+            [ andM [expr ghcWithInterpreter, notStage0, notCross] `cabalFlag` "internal-interpreter"
             , notM cross `cabalFlag` "terminfo"
             , arg "-build-tool-depends"
             , flag UseLibzstd `cabalFlag` "with-libzstd"
-- 
GitLab