on iko/ghcjs-patch-master help sign in
Fix for ghc-lib-parser 9.2 and haskell.nix patched ghc (#1502)

Fixes #1488

commit4b61024e55a1f9b0a26b2baf714002c09ebbfb28 authorHamish Mackenzie <Hamish.K.Mackenzie@gmail.com> dateThu 2 Jun 2022, 15:00 (4 years ago) parenta5b85df
2 files changed+22−1
modules/configuration-nix.nix+2−1 overlays/patches/ghc-lib-parser-9.2-global-unique-counters-in-rts.patch+20
modules/configuration-nix.nix+2−1
@@ -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
overlays/patches/ghc-lib-parser-9.2-global-unique-counters-in-rts.patchnew file+20
@@ -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)