|
@@ -44,6 +44,7 @@ interface
|
|
|
|
|
|
TWasmObjSection = class(TObjSection)
|
|
TWasmObjSection = class(TObjSection)
|
|
public
|
|
public
|
|
|
|
+ SegIdx: Integer;
|
|
function IsCode: Boolean;
|
|
function IsCode: Boolean;
|
|
function IsData: Boolean;
|
|
function IsData: Boolean;
|
|
end;
|
|
end;
|
|
@@ -265,7 +266,20 @@ implementation
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
objsec: TWasmObjSection;
|
|
objsec: TWasmObjSection;
|
|
|
|
+ segment_count: Integer = 0;
|
|
begin
|
|
begin
|
|
|
|
+ for i:=0 to Data.ObjSectionList.Count-1 do
|
|
|
|
+ begin
|
|
|
|
+ objsec:=TWasmObjSection(Data.ObjSectionList[i]);
|
|
|
|
+ if objsec.IsCode then
|
|
|
|
+ objsec.SegIdx:=-1
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ objsec.SegIdx:=segment_count;
|
|
|
|
+ Inc(segment_count);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+
|
|
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
|
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
|
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
|
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
|
|
|
|
|
@@ -273,7 +287,7 @@ implementation
|
|
for i:=0 to Data.ObjSectionList.Count-1 do
|
|
for i:=0 to Data.ObjSectionList.Count-1 do
|
|
begin
|
|
begin
|
|
objsec:=TWasmObjSection(Data.ObjSectionList[i]);
|
|
objsec:=TWasmObjSection(Data.ObjSectionList[i]);
|
|
- Writeln(objsec.Name, ' IsCode=', objsec.IsCode, ' IsData=', objsec.IsData, ' Size=', objsec.Size, ' MemPos=', objsec.MemPos, ' Data.Size=', objsec.Data.size, ' DataPos=', objsec.DataPos);
|
|
|
|
|
|
+ Writeln(objsec.Name, ' IsCode=', objsec.IsCode, ' IsData=', objsec.IsData, ' Size=', objsec.Size, ' MemPos=', objsec.MemPos, ' Data.Size=', objsec.Data.size, ' DataPos=', objsec.DataPos, ' SegIdx=', objsec.SegIdx);
|
|
end;
|
|
end;
|
|
|
|
|
|
result:=true;
|
|
result:=true;
|