From cac97ad6f645c2e6901ea31e031ceeff806f7d3d Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Mon, 13 Oct 2025 03:11:49 +0100 Subject: [PATCH] haskellPackages: fix executables built for ghcjs --- pkgs/development/compilers/ghc/common-hadrian.nix | 4 ++++ .../compilers/ghc/export-heap-methods.patch | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 pkgs/development/compilers/ghc/export-heap-methods.patch diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 2ab244baf9f2..bac31615c602 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -239,6 +239,10 @@ hash = "sha256-sb+AHdkGkCu8MW0xoQIpD5kEc0zYX8udAMDoC+TWc0Q="; }) ] + ++ lib.optionals stdenv.targetPlatform.isGhcjs [ + # https://gitlab.haskell.org/ghc/ghc/-/issues/26290 + ./export-heap-methods.patch + ] # Prevents passing --hyperlinked-source to haddock. Note that this can # be configured via a user defined flavour now. Unfortunately, it is # impossible to import an existing flavour in UserSettings, so patching diff --git a/pkgs/development/compilers/ghc/export-heap-methods.patch b/pkgs/development/compilers/ghc/export-heap-methods.patch new file mode 100644 index 000000000000..ff4ce1263aee --- /dev/null +++ b/pkgs/development/compilers/ghc/export-heap-methods.patch @@ -0,0 +1,11 @@ +diff --git a/rts/js/mem.js b/rts/js/mem.js +index 44c5c37ac4..1f150c5d55 100644 +--- a/rts/js/mem.js ++++ b/rts/js/mem.js +@@ -1,5 +1,5 @@ + //#OPTIONS:CPP +-//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot ++//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot,HEAP8,HEAPU8 + + // #define GHCJS_TRACE_META 1 +