* wasm32 obj writer: use Data.ObjSectionList.Find to find the debug section by name in MaybeWriteDebugSection

This commit is contained in:
Nikolay Nikolov 2022-08-03 22:02:19 +03:00
parent e959422753
commit cc260eb7b2

View File

@ -1401,23 +1401,19 @@ implementation
procedure MaybeWriteDebugSection(const sn: string; st: TWasmCustomSectionType); procedure MaybeWriteDebugSection(const sn: string; st: TWasmCustomSectionType);
var var
i: Integer;
objsec: TWasmObjSection; objsec: TWasmObjSection;
begin begin
for i:=0 to Data.ObjSectionList.Count-1 do objsec:=TWasmObjSection(Data.ObjSectionList.Find(sn));
if Assigned(objsec) then
begin begin
objsec:=TWasmObjSection(Data.ObjSectionList[i]); if oso_Data in objsec.SecOptions then
if objsec.Name=sn then
begin begin
if oso_Data in objsec.SecOptions then objsec.Data.seek(0);
begin CopyDynamicArray(objsec.Data,FWasmCustomSections[st],objsec.Size);
objsec.Data.seek(0); end
CopyDynamicArray(objsec.Data,FWasmCustomSections[st],objsec.Size); else
end WriteZeros(FWasmCustomSections[st],objsec.Size);
else WriteWasmCustomSection(st);
WriteZeros(FWasmCustomSections[st],objsec.Size);
WriteWasmCustomSection(st);
end;
end; end;
end; end;