+ add tag names to the WebAssembly name section

This commit is contained in:
Nikolay Nikolov 2024-09-21 09:40:25 +03:00
parent 44d9234f38
commit 1ea876b517

View File

@ -299,10 +299,12 @@ interface
FFunctionNameMap: TCustomSectionNameMap;
FGlobalNameMap: TCustomSectionNameMap;
FDataNameMap: TCustomSectionNameMap;
FTagNameMap: TCustomSectionNameMap;
procedure AddToNameMap(var nm: TCustomSectionNameMap; aidx: UInt32; const aname: string);
procedure AddToFunctionNameMap(aidx: UInt32; const aname: string);
procedure AddToGlobalNameMap(aidx: UInt32; const aname: string);
procedure AddToDataNameMap(aidx: UInt32; const aname: string);
procedure AddToTagNameMap(aidx: UInt32; const aname: string);
procedure WriteWasmSection(wsid: TWasmSectionID);
procedure WriteWasmSectionIfNotEmpty(wsid: TWasmSectionID);
procedure WriteWasmCustomSection(wcst: TWasmCustomSectionType);
@ -4805,6 +4807,11 @@ implementation
AddToNameMap(FDataNameMap,aidx,aname);
end;
procedure TWasmExeOutput.AddToTagNameMap(aidx: UInt32; const aname: string);
begin
AddToNameMap(FTagNameMap,aidx,aname);
end;
procedure TWasmExeOutput.WriteWasmSection(wsid: TWasmSectionID);
var
b: byte;
@ -5072,6 +5079,7 @@ implementation
objsec:=TWasmObjSection(exesec.ObjSectionList[i]);
WriteByte(FWasmSections[wsiTag],0);
WriteUleb(FWasmSections[wsiTag],objsec.MainFuncSymbol.LinkingData.ExeTypeIndex);
AddToTagNameMap(i,objsec.MainFuncSymbol.Name);
end;
end;
@ -5159,11 +5167,13 @@ implementation
WriteNameMap(FFunctionNameMap,FWasmNameSubsections[wnstFunctionNames]);
WriteNameMap(FGlobalNameMap,FWasmNameSubsections[wnstGlobalNames]);
WriteNameMap(FDataNameMap,FWasmNameSubsections[wnstDataNames]);
WriteNameMap(FTagNameMap,FWasmNameSubsections[wnstTagNames]);
WriteNameSubsection(wnstModuleName);
WriteNameSubsection(wnstFunctionNames);
WriteNameSubsection(wnstGlobalNames);
WriteNameSubsection(wnstDataNames);
WriteNameSubsection(wnstTagNames);
end;
var