Skip to content

Commit f7d7862

Browse files
hamishmackt4ccer
authored andcommitted
Fix for ghc-lib-parser 9.2 and haskell.nix patched ghc (input-output-hk#1502)
Fixes input-output-hk#1488
1 parent 220f8a9 commit f7d7862

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

modules/configuration-nix.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ in {
5858
packages.mintty.components.library.build-tools = pkgs.lib.mkForce [];
5959

6060
packages.ghc-lib-parser.patches = [
61-
(fromUntil "8.10.0.0" "9.1" ../overlays/patches/ghc-lib-parser-8.10-global-unique-counters-in-rts.patch)
61+
(fromUntil "8.10.0.0" "9.2" ../overlays/patches/ghc-lib-parser-8.10-global-unique-counters-in-rts.patch)
62+
(fromUntil "9.2.0.0" "9.3" ../overlays/patches/ghc-lib-parser-9.2-global-unique-counters-in-rts.patch)
6263
];
6364

6465
# See https://github.com/haskell-nix/hnix/pull/1053
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c
2+
index ecb318d5a8..8e70db33fc 100644
3+
--- a/compiler/cbits/genSym.c
4+
+++ b/compiler/cbits/genSym.c
5+
@@ -1,9 +1,15 @@
6+
#include <Rts.h>
7+
#include <assert.h>
8+
#include "Unique.h"
9+
+#include "ghcversion.h"
10+
11+
+// These global variables have been moved into the RTS. It allows them to be
12+
+// shared with plugins even if two different instances of the GHC library are
13+
+// loaded at the same time (#19940)
14+
+#if !MIN_VERSION_GLASGOW_HASKELL(9,2,0,0)
15+
HsInt ghc_unique_counter = 0;
16+
HsInt ghc_unique_inc = 1;
17+
+#endif
18+
19+
#define UNIQUE_BITS (sizeof (HsInt) * 8 - UNIQUE_TAG_BITS)
20+
#define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1)

0 commit comments

Comments
 (0)