From 3a714774ffec45484fce4547c7b2fa72a6ddc789 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sat, 15 Feb 2025 23:18:24 +0200 Subject: [PATCH] + WebAssembly internal linker: write the export section to the linker map file --- compiler/ogwasm.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 103512fa6a..2a925d7edf 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -5097,6 +5097,8 @@ implementation i: Integer; objsec: TWasmObjSection; begin + if assigned(exemap) then + exemap.AddHeader('Export section'); FunctionExportsCount:=0; textsec:=FindExeSection('.text'); if not assigned(textsec) then @@ -5115,6 +5117,8 @@ implementation WriteName(FWasmSections[wsiExport],'memory'); WriteByte(FWasmSections[wsiExport],$02); { mem } WriteUleb(FWasmSections[wsiExport],0); { memidx = 0 } + if assigned(exemap) then + exemap.Add(' Memory[0] -> "memory"'); for i:=0 to textsec.ObjSectionList.Count-1 do begin @@ -5124,6 +5128,8 @@ implementation WriteName(FWasmSections[wsiExport],objsec.MainFuncSymbol.LinkingData.ExportName); WriteByte(FWasmSections[wsiExport],$00); { func } WriteUleb(FWasmSections[wsiExport],objsec.MainFuncSymbol.LinkingData.ExeFunctionIndex); { funcidx } + if assigned(exemap) then + exemap.Add(' Function['+tostr(objsec.MainFuncSymbol.LinkingData.ExeFunctionIndex)+'] -> "'+objsec.MainFuncSymbol.LinkingData.ExportName+'"'); end; end; end;