2
0
Эх сурвалжийг харах

+ write export section in the wasm internal linker exe writer, only the memory is exported for now

Nikolay Nikolov 1 жил өмнө
parent
commit
c4a77a832f

+ 13 - 0
compiler/ogwasm.pas

@@ -4431,6 +4431,17 @@ implementation
             end;
             end;
         end;
         end;
 
 
+      procedure WriteExportSection;
+        const
+          ExportsCount=1;
+        begin
+          WriteUleb(FWasmSections[wsiExport],ExportsCount);
+          { export 0 }
+          WriteName(FWasmSections[wsiExport],'memory');
+          WriteByte(FWasmSections[wsiExport],$02);  { mem }
+          WriteUleb(FWasmSections[wsiExport],0);    { memidx = 0 }
+        end;
+
       begin
       begin
         result:=false;
         result:=false;
 
 
@@ -4440,6 +4451,7 @@ implementation
         WriteDataSegments;
         WriteDataSegments;
         WriteTableAndElemSections;
         WriteTableAndElemSections;
         WriteGlobalSection;
         WriteGlobalSection;
+        WriteExportSection;
 
 
         WriteUleb(FWasmSections[wsiMemory],1);
         WriteUleb(FWasmSections[wsiMemory],1);
         WriteByte(FWasmSections[wsiMemory],0);
         WriteByte(FWasmSections[wsiMemory],0);
@@ -4455,6 +4467,7 @@ implementation
         WriteWasmSection(wsiTable);
         WriteWasmSection(wsiTable);
         WriteWasmSection(wsiMemory);
         WriteWasmSection(wsiMemory);
         WriteWasmSection(wsiGlobal);
         WriteWasmSection(wsiGlobal);
+        WriteWasmSection(wsiExport);
         WriteWasmSection(wsiElement);
         WriteWasmSection(wsiElement);
         WriteWasmSection(wsiDataCount);
         WriteWasmSection(wsiDataCount);
         WriteWasmSection(wsiCode);
         WriteWasmSection(wsiCode);