mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 01:39:26 +02:00
+ write a MODEND (end of module) record at the end of the omf file
git-svn-id: trunk@30454 -
This commit is contained in:
parent
28dc9fe68b
commit
b67fea70bd
@ -285,6 +285,7 @@ implementation
|
|||||||
Translator_COMENT: TOmfRecord_COMENT;
|
Translator_COMENT: TOmfRecord_COMENT;
|
||||||
LinkPassSeparator_COMENT: TOmfRecord_COMENT;
|
LinkPassSeparator_COMENT: TOmfRecord_COMENT;
|
||||||
LNamesRec: TOmfRecord_LNAMES;
|
LNamesRec: TOmfRecord_LNAMES;
|
||||||
|
ModEnd: TOmfRecord_MODEND;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
SegDef: TOmfRecord_SEGDEF;
|
SegDef: TOmfRecord_SEGDEF;
|
||||||
GrpDef: TOmfRecord_GRPDEF;
|
GrpDef: TOmfRecord_GRPDEF;
|
||||||
@ -363,6 +364,12 @@ implementation
|
|||||||
{ write section content, interleaved with fixups }
|
{ write section content, interleaved with fixups }
|
||||||
WriteSections(Data);
|
WriteSections(Data);
|
||||||
|
|
||||||
|
{ write MODEND record }
|
||||||
|
ModEnd:=TOmfRecord_MODEND.Create;
|
||||||
|
ModEnd.EncodeTo(RawRecord);
|
||||||
|
RawRecord.WriteTo(FWriter);
|
||||||
|
ModEnd.Free;
|
||||||
|
|
||||||
RawRecord.Free;
|
RawRecord.Free;
|
||||||
result:=true;
|
result:=true;
|
||||||
end;
|
end;
|
||||||
|
@ -317,6 +317,26 @@ interface
|
|||||||
property SegmentList: TSegmentList read FSegmentList write FSegmentList;
|
property SegmentList: TSegmentList read FSegmentList write FSegmentList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TOmfRecord_MODEND }
|
||||||
|
|
||||||
|
TOmfRecord_MODEND = class(TOmfParsedRecord)
|
||||||
|
private
|
||||||
|
FIs32Bit: Boolean;
|
||||||
|
FIsMainModule: Boolean;
|
||||||
|
FHasStartAddress: Boolean;
|
||||||
|
FSegmentBit: Boolean;
|
||||||
|
FLogicalStartAddress: Boolean;
|
||||||
|
public
|
||||||
|
procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
|
||||||
|
procedure EncodeTo(RawRecord: TOmfRawRecord);override;
|
||||||
|
|
||||||
|
property Is32Bit: Boolean read FIs32Bit write FIs32Bit;
|
||||||
|
property IsMainModule: Boolean read FIsMainModule write FIsMainModule;
|
||||||
|
property HasStartAddress: Boolean read FHasStartAddress write FHasStartAddress;
|
||||||
|
property SegmentBit: Boolean read FSegmentBit write FSegmentBit;
|
||||||
|
property LogicalStartAddress: Boolean read FLogicalStartAddress write FLogicalStartAddress;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TOmfSubRecord_FIXUP }
|
{ TOmfSubRecord_FIXUP }
|
||||||
|
|
||||||
TOmfSubRecord_FIXUP = class
|
TOmfSubRecord_FIXUP = class
|
||||||
@ -776,6 +796,35 @@ implementation
|
|||||||
RawRecord.CalculateChecksumByte;
|
RawRecord.CalculateChecksumByte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TOmfRecord_MODEND }
|
||||||
|
|
||||||
|
procedure TOmfRecord_MODEND.DecodeFrom(RawRecord: TOmfRawRecord);
|
||||||
|
begin
|
||||||
|
{TODO: implement}
|
||||||
|
internalerror(2015040101);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOmfRecord_MODEND.EncodeTo(RawRecord: TOmfRawRecord);
|
||||||
|
var
|
||||||
|
ModTyp: Byte;
|
||||||
|
NextOfs: Integer;
|
||||||
|
begin
|
||||||
|
if Is32Bit then
|
||||||
|
RawRecord.RecordType:=RT_MODEND32
|
||||||
|
else
|
||||||
|
RawRecord.RecordType:=RT_MODEND;
|
||||||
|
ModTyp:=(Ord(IsMainModule) shl 7)+(Ord(HasStartAddress) shl 6)+(Ord(SegmentBit) shl 5)+Ord(LogicalStartAddress);
|
||||||
|
RawRecord.RawData[0]:=ModTyp;
|
||||||
|
NextOfs:=1;
|
||||||
|
if HasStartAddress then
|
||||||
|
begin
|
||||||
|
{TODO: implement writing a start address}
|
||||||
|
internalerror(2015040101);
|
||||||
|
end;
|
||||||
|
RawRecord.RecordLength:=NextOfs+1;
|
||||||
|
RawRecord.CalculateChecksumByte;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TOmfSubRecord_FIXUP }
|
{ TOmfSubRecord_FIXUP }
|
||||||
|
|
||||||
function TOmfSubRecord_FIXUP.GetDataRecordOffset: Integer;
|
function TOmfSubRecord_FIXUP.GetDataRecordOffset: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user