Browse Source

+ WebAssembly multithreading: also declare threadvar sections as TLS and prefix their name with '.tbss' when using the external assembler

Nikolay Nikolov 3 years ago
parent
commit
b821b9d502
2 changed files with 7 additions and 3 deletions
  1. 1 1
      compiler/aggas.pas
  2. 6 2
      compiler/wasm32/agllvmmc.pas

+ 1 - 1
compiler/aggas.pas

@@ -364,7 +364,7 @@ implementation
           begin
             if (target_info.system in (systems_windows+systems_wince)) then
               secname:='.tls'
-            else if (target_info.system in systems_linux) then
+            else if (target_info.system in (systems_linux+systems_wasm)) then
               secname:='.tbss';
           end;
 

+ 6 - 2
compiler/wasm32/agllvmmc.pas

@@ -141,9 +141,13 @@ implementation
 
   function TLLVMMachineCodePlaygroundAssembler.sectionname(atype: TAsmSectiontype; const aname: string; aorder: TAsmSectionOrder): string;
     begin
-      if (atype=sec_fpc) or (atype=sec_threadvar) then
+      if (atype=sec_fpc) or
+         ((atype=sec_threadvar) and not (ts_wasm_threads in current_settings.targetswitches)) then
         atype:=sec_data;
-      Result:=inherited sectionname(atype, aname, aorder)+',"",@';
+      if atype=sec_threadvar then
+        Result:=inherited sectionname(atype, aname, aorder)+',"T",@'
+      else
+        Result:=inherited sectionname(atype, aname, aorder)+',"",@';
     end;