소스 검색

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

Nikolay Nikolov 1 년 전
부모
커밋
c4a77a832f
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      compiler/ogwasm.pas

+ 13 - 0
compiler/ogwasm.pas

@@ -4431,6 +4431,17 @@ implementation
             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
         result:=false;
 
@@ -4440,6 +4451,7 @@ implementation
         WriteDataSegments;
         WriteTableAndElemSections;
         WriteGlobalSection;
+        WriteExportSection;
 
         WriteUleb(FWasmSections[wsiMemory],1);
         WriteByte(FWasmSections[wsiMemory],0);
@@ -4455,6 +4467,7 @@ implementation
         WriteWasmSection(wsiTable);
         WriteWasmSection(wsiMemory);
         WriteWasmSection(wsiGlobal);
+        WriteWasmSection(wsiExport);
         WriteWasmSection(wsiElement);
         WriteWasmSection(wsiDataCount);
         WriteWasmSection(wsiCode);