Browse Source

* WebAssembly threads internal linker: set initial values for threadvar globals

Nikolay Nikolov 1 year ago
parent
commit
90a756931e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/ogwasm.pas

+ 5 - 1
compiler/ogwasm.pas

@@ -5446,7 +5446,11 @@ implementation
           begin
             objsec:=TWasmObjSection(exesec.ObjSectionList[i]);
             objsym:=objsec.MainFuncSymbol;
-            { TODO: implement }
+            if Assigned(objsym.TlsDataSym) then
+              begin
+                objsym.LinkingData.GlobalInitializer.typ:=wbt_i32;
+                objsym.LinkingData.GlobalInitializer.init_i32:=objsym.TlsDataSym.offset+objsym.TlsDataSym.objsection.MemPos;
+              end;
           end;
       end;