Skip to content

Commit 60f40bd

Browse files
committed
Fix missing __wasm_apply_data_relocs issue
1 parent 3d3dd2e commit 60f40bd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

builder/ghc-for-component-wrapper.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,13 @@ let
133133
ln -s $wrappedGhc/bin/${ghcCommand}-iserv-prof $wrappedGhc/bin/ghc-iserv-prof
134134
''
135135
# These scripts break if symlinked (they check import.meta.filename against args)
136+
# Also for some reason `libdl.so` is missing `__wasm_apply_data_relocs`
136137
+ lib.optionalString (stdenv.hostPlatform.isWasm) ''
137138
rm $wrappedGhc/lib/*.mjs
138139
cp $unwrappedGhc/lib/*.mjs $wrappedGhc/lib/
140+
substituteInPlace $wrappedGhc/lib/dyld.mjs \
141+
--replace-fail "instance.exports.__wasm_apply_data_relocs();" \
142+
"if(instance.exports.__wasm_apply_data_relocs) instance.exports.__wasm_apply_data_relocs(); else {}"
139143
''
140144
# Wrap haddock, if the base GHC provides it.
141145
+ ''

0 commit comments

Comments
 (0)