Skip to content

Commit 8d5d7c3

Browse files
committed
Fix GHC 9.6.7 --this-unit-id problem for GHCJS cross compiles
1 parent 54fa2b9 commit 8d5d7c3

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

overlays/bootstrap.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ in {
335335

336336
# Fix for `fatal error: 'rts/Types.h' file not found` when building `primitive`
337337
++ onGhcjs (from "9.13" ./patches/ghc/ghc-9.13-ghcjs-rts-types.patch)
338+
339+
++ onGhcjs (fromUntil "9.6.7" "9.7" ./patches/ghc/ghc-9.6-js-support-this-unit-id-10819.patch)
338340
;
339341
in ({
340342
ghc8107 = traceWarnOld "8.10" (final.callPackage ../compiler/ghc {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 168af9c24581bb550e6f352ebb3dd86c8784cea9 Mon Sep 17 00:00:00 2001
2+
From: Sylvain Henry <[email protected]>
3+
Date: Thu, 6 Jul 2023 15:59:38 +0200
4+
Subject: [PATCH] JS: support -this-unit-id for programs in the linker (#23613)
5+
6+
---
7+
compiler/GHC/StgToJS/Linker/Linker.hs | 2 +-
8+
testsuite/tests/driver/T23613.hs | 4 ++++
9+
testsuite/tests/driver/all.T | 7 ++++---
10+
3 files changed, 9 insertions(+), 4 deletions(-)
11+
create mode 100644 testsuite/tests/driver/T23613.hs
12+
13+
diff --git a/compiler/GHC/StgToJS/Linker/Linker.hs b/compiler/GHC/StgToJS/Linker/Linker.hs
14+
index 58bcdf2de90..530f8730c6b 100644
15+
--- a/compiler/GHC/StgToJS/Linker/Linker.hs
16+
+++ b/compiler/GHC/StgToJS/Linker/Linker.hs
17+
@@ -327,7 +327,7 @@ computeLinkDependencies cfg unit_env link_spec finder_opts finder_cache = do
18+
let (rts_wired_units, rts_wired_functions) = rtsDeps units
19+
20+
-- all the units we want to link together, without their dependencies
21+
- let root_units = filter (/= mainUnitId)
22+
+ let root_units = filter (/= ue_currentUnit unit_env)
23+
$ filter (/= interactiveUnitId)
24+
$ nub
25+
$ rts_wired_units ++ reverse obj_units ++ reverse units
26+
diff --git a/testsuite/tests/driver/T23613.hs b/testsuite/tests/driver/T23613.hs
27+
new file mode 100644
28+
index 00000000000..d82a4bd93b7
29+
--- /dev/null
30+
+++ b/testsuite/tests/driver/T23613.hs
31+
@@ -0,0 +1,4 @@
32+
+module Main where
33+
+
34+
+main :: IO ()
35+
+main = return ()
36+

0 commit comments

Comments
 (0)