+ wasm internal linker: fill ExeFunctionIndex of alias code symbols as well

This commit is contained in:
Nikolay Nikolov 2024-01-01 14:01:43 +02:00
parent cf79ca16b4
commit 50986967f5

View File

@ -4270,10 +4270,11 @@ implementation
procedure TWasmExeOutput.PrepareFunctions;
var
i: Integer;
i, j: Integer;
exesec: TExeSection;
objsec: TWasmObjSection;
fsym: TWasmObjSymbol;
objdata: TObjData;
begin
if assigned(exemap) then
begin
@ -4302,6 +4303,21 @@ implementation
exemap.Add(' Function[' + tostr(fsym.LinkingData.ExeFunctionIndex) + '] ' + fsym.Name + fsym.LinkingData.FuncType.ToString);
end;
end;
{ set ExeFunctionIndex to the alias symbols as well }
for i:=0 to ObjDataList.Count-1 do
begin
objdata:=TObjData(ObjDataList[i]);
for j:=0 to objdata.ObjSymbolList.Count-1 do
begin
fsym:=TWasmObjSymbol(objdata.ObjSymbolList[j]);
if assigned(fsym.objsection) and fsym.objsection.USed and (fsym.typ=AT_FUNCTION) and (fsym.LinkingData.ExeFunctionIndex=-1) then
begin
fsym.LinkingData.ExeFunctionIndex:=TWasmObjSection(fsym.objsection).MainFuncSymbol.LinkingData.ExeFunctionIndex;
if fsym.LinkingData.ExeFunctionIndex=-1 then
internalerror(2024010102);
end;
end;
end;
end;