mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 23:59:10 +02:00
+ support segments (sections) with a primary group, other than 'DGROUP' in the
OMF internal object writer git-svn-id: trunk@39245 -
This commit is contained in:
parent
400861a907
commit
5eb69edf9e
@ -123,8 +123,7 @@ interface
|
|||||||
procedure AddSegment(const name,segclass,ovlname: string;
|
procedure AddSegment(const name,segclass,ovlname: string;
|
||||||
Alignment: TOmfSegmentAlignment; Combination: TOmfSegmentCombination;
|
Alignment: TOmfSegmentAlignment; Combination: TOmfSegmentCombination;
|
||||||
Use: TOmfSegmentUse; Size: TObjSectionOfs);
|
Use: TOmfSegmentUse; Size: TObjSectionOfs);
|
||||||
procedure AddGroup(const groupname: string; seglist: array of const);
|
procedure AddSegmentToGroup(const groupname: string; segindex: Integer);
|
||||||
procedure AddGroup(const groupname: string; seglist: TSegmentList);
|
|
||||||
procedure WriteSections(Data:TObjData);
|
procedure WriteSections(Data:TObjData);
|
||||||
procedure WriteSectionContentAndFixups(sec: TObjSection);
|
procedure WriteSectionContentAndFixups(sec: TObjSection);
|
||||||
procedure WriteLinNumRecords(sec: TOmfObjSection);
|
procedure WriteLinNumRecords(sec: TOmfObjSection);
|
||||||
@ -757,42 +756,18 @@ implementation
|
|||||||
s.SegmentLength:=Size;
|
s.SegmentLength:=Size;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOmfObjOutput.AddGroup(const groupname: string; seglist: array of const);
|
procedure TOmfObjOutput.AddSegmentToGroup(const groupname: string; segindex: Integer);
|
||||||
var
|
var
|
||||||
g: TOmfRecord_GRPDEF;
|
g: TOmfRecord_GRPDEF;
|
||||||
I: Integer;
|
|
||||||
SegListStr: TSegmentList;
|
|
||||||
begin
|
begin
|
||||||
g:=TOmfRecord_GRPDEF.Create;
|
g:=TOmfRecord_GRPDEF(Groups.Find(groupname));
|
||||||
Groups.Add(groupname,g);
|
if g=nil then
|
||||||
g.GroupNameIndex:=LNames.Add(groupname);
|
|
||||||
SetLength(SegListStr,Length(seglist));
|
|
||||||
for I:=0 to High(seglist) do
|
|
||||||
begin
|
begin
|
||||||
case seglist[I].VType of
|
g:=TOmfRecord_GRPDEF.Create;
|
||||||
vtString:
|
Groups.Add(groupname,g);
|
||||||
SegListStr[I]:=Segments.FindIndexOf(seglist[I].VString^);
|
g.GroupNameIndex:=LNames.Add(groupname);
|
||||||
vtAnsiString:
|
|
||||||
SegListStr[I]:=Segments.FindIndexOf(AnsiString(seglist[I].VAnsiString));
|
|
||||||
vtWideString:
|
|
||||||
SegListStr[I]:=Segments.FindIndexOf(AnsiString(WideString(seglist[I].VWideString)));
|
|
||||||
vtUnicodeString:
|
|
||||||
SegListStr[I]:=Segments.FindIndexOf(AnsiString(UnicodeString(seglist[I].VUnicodeString)));
|
|
||||||
else
|
|
||||||
internalerror(2015040402);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
g.SegmentList:=SegListStr;
|
g.AddSegmentIndex(segindex);
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TOmfObjOutput.AddGroup(const groupname: string; seglist: TSegmentList);
|
|
||||||
var
|
|
||||||
g: TOmfRecord_GRPDEF;
|
|
||||||
begin
|
|
||||||
g:=TOmfRecord_GRPDEF.Create;
|
|
||||||
Groups.Add(groupname,g);
|
|
||||||
g.GroupNameIndex:=LNames.Add(groupname);
|
|
||||||
g.SegmentList:=Copy(seglist);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOmfObjOutput.WriteSections(Data: TObjData);
|
procedure TOmfObjOutput.WriteSections(Data: TObjData);
|
||||||
@ -1042,7 +1017,6 @@ implementation
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
SegDef: TOmfRecord_SEGDEF;
|
SegDef: TOmfRecord_SEGDEF;
|
||||||
GrpDef: TOmfRecord_GRPDEF;
|
GrpDef: TOmfRecord_GRPDEF;
|
||||||
DGroupSegments: TSegmentList;
|
|
||||||
nsections: Integer;
|
nsections: Integer;
|
||||||
objsym: TObjSymbol;
|
objsym: TObjSymbol;
|
||||||
begin
|
begin
|
||||||
@ -1094,19 +1068,11 @@ implementation
|
|||||||
|
|
||||||
for i:=0 to Data.ObjSectionList.Count-1 do
|
for i:=0 to Data.ObjSectionList.Count-1 do
|
||||||
with TOmfObjSection(Data.ObjSectionList[I]) do
|
with TOmfObjSection(Data.ObjSectionList[I]) do
|
||||||
AddSegment(Name,ClassName,OverlayName,OmfAlignment,Combination,Use,Size);
|
begin
|
||||||
|
AddSegment(Name,ClassName,OverlayName,OmfAlignment,Combination,Use,Size);
|
||||||
|
if PrimaryGroup<>'' then
|
||||||
{ create group "DGROUP" }
|
AddSegmentToGroup(PrimaryGroup,index);
|
||||||
SetLength(DGroupSegments,0);
|
end;
|
||||||
for i:=0 to Data.ObjSectionList.Count-1 do
|
|
||||||
with TOmfObjSection(Data.ObjSectionList[I]) do
|
|
||||||
if PrimaryGroup='DGROUP' then
|
|
||||||
begin
|
|
||||||
SetLength(DGroupSegments,Length(DGroupSegments)+1);
|
|
||||||
DGroupSegments[High(DGroupSegments)]:=index;
|
|
||||||
end;
|
|
||||||
AddGroup('DGROUP',DGroupSegments);
|
|
||||||
|
|
||||||
{ write LNAMES record(s) }
|
{ write LNAMES record(s) }
|
||||||
LNamesRec:=TOmfRecord_LNAMES.Create;
|
LNamesRec:=TOmfRecord_LNAMES.Create;
|
||||||
|
@ -383,6 +383,8 @@ interface
|
|||||||
procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
|
procedure DecodeFrom(RawRecord: TOmfRawRecord);override;
|
||||||
procedure EncodeTo(RawRecord: TOmfRawRecord);override;
|
procedure EncodeTo(RawRecord: TOmfRawRecord);override;
|
||||||
|
|
||||||
|
procedure AddSegmentIndex(segidx: Integer);
|
||||||
|
|
||||||
property GroupNameIndex: Integer read FGroupNameIndex write FGroupNameIndex;
|
property GroupNameIndex: Integer read FGroupNameIndex write FGroupNameIndex;
|
||||||
property SegmentList: TSegmentList read FSegmentList write FSegmentList;
|
property SegmentList: TSegmentList read FSegmentList write FSegmentList;
|
||||||
end;
|
end;
|
||||||
@ -1737,9 +1739,15 @@ implementation
|
|||||||
RawRecord.CalculateChecksumByte;
|
RawRecord.CalculateChecksumByte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOmfRecord_GRPDEF.AddSegmentIndex(segidx: Integer);
|
||||||
|
begin
|
||||||
|
SetLength(FSegmentList,Length(FSegmentList)+1);
|
||||||
|
FSegmentList[High(FSegmentList)]:=segidx;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TOmfPublicNameElement }
|
{ TOmfPublicNameElement }
|
||||||
|
|
||||||
function TOmfPublicNameElement.GetLengthInFile(Is32Bit: Boolean): Integer;
|
function TOmfPublicNameElement.GetLengthInFile(Is32Bit: Boolean): Integer;
|
||||||
begin
|
begin
|
||||||
Result:=1+Length(Name)+2+1;
|
Result:=1+Length(Name)+2+1;
|
||||||
if Is32Bit then
|
if Is32Bit then
|
||||||
|
Loading…
Reference in New Issue
Block a user