Browse Source

+ always (even when multithreading is off) create a "target features" section
in the WebAssembly object writer, since we still require some (very commonly
supported) extensions, even without multithreading

Nikolay Nikolov 3 years ago
parent
commit
972a9df031
1 changed files with 10 additions and 5 deletions
  1. 10 5
      compiler/ogwasm.pas

+ 10 - 5
compiler/ogwasm.pas

@@ -1844,6 +1844,14 @@ implementation
             WriteName(FWasmCustomSections[wcstTargetFeatures],'mutable-globals');
             WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
             WriteName(FWasmCustomSections[wcstTargetFeatures],'sign-ext');
+          end
+        else
+          begin
+            WriteUleb(FWasmCustomSections[wcstTargetFeatures],2);
+            WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
+            WriteName(FWasmCustomSections[wcstTargetFeatures],'bulk-memory');
+            WriteUleb(FWasmCustomSections[wcstTargetFeatures],$2B);
+            WriteName(FWasmCustomSections[wcstTargetFeatures],'sign-ext');
           end;
 
         { Write the producers section:
@@ -1999,11 +2007,8 @@ implementation
         MaybeWriteRelocationDebugTable(wcstRelocDebugRanges,debug_ranges_section_nr,FWasmRelocationDebugRangesTableEntriesCount,FWasmRelocationDebugRangesTable);
         WriteWasmCustomSection(wcstProducers);
         Inc(section_nr);
-        if ts_wasm_threads in current_settings.targetswitches then
-          begin
-            WriteWasmCustomSection(wcstTargetFeatures);
-            Inc(section_nr);
-          end;
+        WriteWasmCustomSection(wcstTargetFeatures);
+        Inc(section_nr);
 
         result:=true;
       end;