Browse Source

* pass the option to create shared, imported memory to the linker, in case the module is compiled with -CTwasmthreads
Note that this breaks running programs compiled with -CTwasmthreads with "wasmtime run --wasm-features threads", but
there's not much we can do about that, since shared memory is required for threading, and wasmtime still doesn't
support it.

Nikolay Nikolov 3 years ago
parent
commit
34ebeb15ed
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/systems/t_wasi.pas

+ 5 - 0
compiler/systems/t_wasi.pas

@@ -150,6 +150,11 @@ begin
 
   cmdstr := cmdstr + ' --no-entry';
 
+  if ts_wasm_threads in current_settings.targetswitches then
+    begin
+      cmdstr := cmdstr + ' --import-memory --shared-memory --initial-memory=16777216 --max-memory=16777216 -z stack-size=5242880 --global-base=1024';
+    end;
+
   if (cs_link_strip in current_settings.globalswitches) then
    begin
      { only remove non global symbols and debugging info for a library }