Browse Source

+ WebAssembly internal linker: write the contents of the memory section to the linker map file

Nikolay Nikolov 5 months ago
parent
commit
847ae42cc1
1 changed files with 6 additions and 0 deletions
  1. 6 0
      compiler/ogwasm.pas

+ 6 - 0
compiler/ogwasm.pas

@@ -5212,17 +5212,23 @@ implementation
 
 
         if not (ts_wasm_threads in current_settings.targetswitches) then
         if not (ts_wasm_threads in current_settings.targetswitches) then
           begin
           begin
+            if assigned(exemap) then
+              exemap.AddHeader('Memory section');
             WriteUleb(FWasmSections[wsiMemory],1);
             WriteUleb(FWasmSections[wsiMemory],1);
             if FMaxMemoryPages>=FMinMemoryPages then
             if FMaxMemoryPages>=FMinMemoryPages then
               begin
               begin
                 WriteByte(FWasmSections[wsiMemory],1);
                 WriteByte(FWasmSections[wsiMemory],1);
                 WriteUleb(FWasmSections[wsiMemory],FMinMemoryPages);
                 WriteUleb(FWasmSections[wsiMemory],FMinMemoryPages);
                 WriteUleb(FWasmSections[wsiMemory],FMaxMemoryPages);
                 WriteUleb(FWasmSections[wsiMemory],FMaxMemoryPages);
+                if assigned(exemap) then
+                  exemap.Add('  Memory[0] pages: initial='+tostr(FMinMemoryPages)+' max='+tostr(FMaxMemoryPages));
               end
               end
             else
             else
               begin
               begin
                 WriteByte(FWasmSections[wsiMemory],0);
                 WriteByte(FWasmSections[wsiMemory],0);
                 WriteUleb(FWasmSections[wsiMemory],FMinMemoryPages);
                 WriteUleb(FWasmSections[wsiMemory],FMinMemoryPages);
+                if assigned(exemap) then
+                  exemap.Add('  Memory[0] pages: initial='+tostr(FMinMemoryPages));
               end;
               end;
           end;
           end;