Переглянути джерело

* WebAssembly threads internal linker: declare the symbol __wasm_init_tls in the
.text section (function will be generated later by the linker)

Nikolay Nikolov 1 рік тому
батько
коміт
0642f14552
1 змінених файлів з 13 додано та 4 видалено
  1. 13 4
      compiler/systems/t_wasi.pas

+ 13 - 4
compiler/systems/t_wasi.pas

@@ -345,11 +345,20 @@ begin
     is important to keep the sections grouped, and keep the first section in
     each group intact (otherwise, TWasmExeOutput.MemPos_ExeSection in ogwasm.pas
     needs to be updated) }
+  { tags (used by WebAssembly native exceptions) }
+  ScriptAddGenericSections('.wasm_tags');
+  { code }
+  if ts_wasm_threads in current_settings.targetswitches then
+    begin
+      linkscript.Concat('EXESECTION .text');
+      linkscript.Concat('  OBJSECTION .text*');
+      { functions, generated by the linker: }
+      linkscript.Concat('  SYMBOL __wasm_init_tls');
+      linkscript.Concat('ENDEXESECTION');
+    end
+  else
+    ScriptAddGenericSections('.text');
   ScriptAddGenericSections(
-    { tags (used by WebAssembly native exceptions) }
-    '.wasm_tags,'+
-    { code }
-    '.text,'+
     { data (initialized data first, uninitialized data later) }
     '.rodata,.data,fpc.resources,fpc.reshandles,.bss,'+
     { debug info }