Skip to content

Commit eb3d141

Browse files
committed
Adds genapply patch for 9.6
GenApply suffers from having GHC pollute its defines.
1 parent 6922b22 commit eb3d141

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

overlays/bootstrap.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ in {
298298
# this one is to allow linking extra symbols from iserv.
299299
++ final.lib.optional (versionAtLeast "9.6.1" && versionLessThan"9.10" && final.stdenv.targetPlatform.isAndroid) ./patches/ghc/iserv-syms.patch
300300
++ final.lib.optional (versionAtLeast "9.4" && final.stdenv.targetPlatform.isWindows) ./patches/ghc/ghc-9.6-fix-code-symbol-jumps.patch
301-
++ final.lib.optional (versionAtLeast "9.6.3" && versionLessThan "9.10" && final.stdenv.targetPlatform.isAndroid) ./patches/ghc/ghc-9.6-iog.patch
301+
++ final.lib.optional (versionAtLeast "9.6.3" && versionLessThan "9.10" && final.stdenv.targetPlatform.isAndroid) ./patches/ghc/ghc-9.6-iog.patch ./patches/ghc/iserv-syms.patch
302+
++ final.lib.optional (versionAtLeast "9.6" && versionLessThan "9.12" && final.stdenv.targetPlatform.is32bit) ./patches/ghc/ghc-9.6-genapply-cross-arch.patch
302303
;
303304
in ({
304305
ghc865 = final.callPackage ../compiler/ghc (traceWarnOld "8.6" {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs
2+
index 74351ee..8a6513c 100644
3+
--- a/utils/genapply/Main.hs
4+
+++ b/utils/genapply/Main.hs
5+
@@ -12,6 +12,17 @@
6+
-- for details
7+
module Main(main) where
8+
9+
+-- GHC will helpfully pass
10+
+-- -Dlinux_BUILD_OS -Dx86_64_BUILD_ARCH -Dlinux_HOST_OS -Dx86_64_HOST_ARCH -D__GLASGOW_HASKELL_TH__ -D__SSE__ -D__SSE2__ '-D__IO_MANAGER_MIO__=1'
11+
+-- to cc -E when running the CPP phase. :-/ So we have to undefine them.
12+
+#if defined(linux_BUILD_OS) || defined(x86_64_BUILD_ARCH) || defined(linux_HOST_OS) || defined(x86_64_HOST_ARCH)
13+
+#warning "Undefining macros that GHC passes to CPP"
14+
+#undef linux_BUILD_OS
15+
+#undef x86_64_BUILD_ARCH
16+
+#undef linux_HOST_OS
17+
+#undef x86_64_HOST_ARCH
18+
+#endif
19+
+
20+
-- Note [Genapply target as host for RTS macros]
21+
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22+
-- We improperly include *HOST* macros for our target...
23+
@@ -957,6 +968,12 @@ main = do
24+
text "// DO NOT EDIT!",
25+
text "// Automatically generated by utils/genapply/Main.hs",
26+
text "",
27+
+ text "// DEBUG: SIZEOF_VOID_P " <> int SIZEOF_VOID_P,
28+
+ text "// DEBUG: HOST_ARCH " <> text HOST_ARCH,
29+
+ text "// DEBUG: HOST_OS " <> text HOST_OS,
30+
+ text "// DEBUG: BUILD_ARCH " <> text BUILD_ARCH,
31+
+ text "// DEBUG: BUILD_OS " <> text BUILD_OS,
32+
+ text "",
33+
text "#include \"Cmm.h\"",
34+
text "#include \"AutoApply.h\"",
35+
text "#if !defined(UnregisterisedCompiler)",

0 commit comments

Comments
 (0)