mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 00:59:12 +02:00
+ introduced TWasmObjSection.IsCode and .IsData
This commit is contained in:
parent
698b5de389
commit
eea8f32772
@ -43,6 +43,9 @@ interface
|
|||||||
{ TWasmObjSection }
|
{ TWasmObjSection }
|
||||||
|
|
||||||
TWasmObjSection = class(TObjSection)
|
TWasmObjSection = class(TObjSection)
|
||||||
|
public
|
||||||
|
function IsCode: Boolean;
|
||||||
|
function IsData: Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWasmObjData }
|
{ TWasmObjData }
|
||||||
@ -74,6 +77,23 @@ interface
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{****************************************************************************
|
||||||
|
TWasmObjSection
|
||||||
|
****************************************************************************}
|
||||||
|
|
||||||
|
function TWasmObjSection.IsCode: Boolean;
|
||||||
|
const
|
||||||
|
CodePrefix = '.text';
|
||||||
|
begin
|
||||||
|
result:=(Length(Name)>=Length(CodePrefix)) and
|
||||||
|
(Copy(Name,1,Length(CodePrefix))=CodePrefix);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TWasmObjSection.IsData: Boolean;
|
||||||
|
begin
|
||||||
|
result:=not IsCode;
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TWasmObjData
|
TWasmObjData
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -244,7 +264,7 @@ implementation
|
|||||||
function TWasmObjOutput.writeData(Data:TObjData):boolean;
|
function TWasmObjOutput.writeData(Data:TObjData):boolean;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
objsec: TObjSection;
|
objsec: TWasmObjSection;
|
||||||
begin
|
begin
|
||||||
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
Writer.write(WasmModuleMagic,SizeOf(WasmModuleMagic));
|
||||||
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
Writer.write(WasmVersion,SizeOf(WasmVersion));
|
||||||
@ -252,8 +272,8 @@ implementation
|
|||||||
Writeln('ObjSectionList:');
|
Writeln('ObjSectionList:');
|
||||||
for i:=0 to Data.ObjSectionList.Count-1 do
|
for i:=0 to Data.ObjSectionList.Count-1 do
|
||||||
begin
|
begin
|
||||||
objsec:=TObjSection(Data.ObjSectionList[i]);
|
objsec:=TWasmObjSection(Data.ObjSectionList[i]);
|
||||||
Writeln(objsec.Name, ' 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);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
result:=true;
|
result:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user