mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 22:46:01 +02:00
+ count omf sections and set their index starting with 1
git-svn-id: trunk@30477 -
This commit is contained in:
parent
e87148c425
commit
1d236e8386
@ -98,6 +98,8 @@ interface
|
|||||||
procedure WriteSections(Data:TObjData);
|
procedure WriteSections(Data:TObjData);
|
||||||
procedure WriteSectionContentAndFixups(sec: TObjSection);
|
procedure WriteSectionContentAndFixups(sec: TObjSection);
|
||||||
|
|
||||||
|
procedure section_count_sections(p:TObject;arg:pointer);
|
||||||
|
|
||||||
property LNames: TOmfOrderedNameCollection read FLNames;
|
property LNames: TOmfOrderedNameCollection read FLNames;
|
||||||
property Segments: TFPHashObjectList read FSegments;
|
property Segments: TFPHashObjectList read FSegments;
|
||||||
property Groups: TFPHashObjectList read FGroups;
|
property Groups: TFPHashObjectList read FGroups;
|
||||||
@ -440,6 +442,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOmfObjOutput.section_count_sections(p: TObject; arg: pointer);
|
||||||
|
begin
|
||||||
|
TOmfObjSection(p).index:=pinteger(arg)^;
|
||||||
|
inc(pinteger(arg)^);
|
||||||
|
end;
|
||||||
|
|
||||||
function TOmfObjOutput.writeData(Data:TObjData):boolean;
|
function TOmfObjOutput.writeData(Data:TObjData):boolean;
|
||||||
var
|
var
|
||||||
RawRecord: TOmfRawRecord;
|
RawRecord: TOmfRawRecord;
|
||||||
@ -451,7 +459,15 @@ implementation
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
SegDef: TOmfRecord_SEGDEF;
|
SegDef: TOmfRecord_SEGDEF;
|
||||||
GrpDef: TOmfRecord_GRPDEF;
|
GrpDef: TOmfRecord_GRPDEF;
|
||||||
|
nsections: Integer;
|
||||||
begin
|
begin
|
||||||
|
{ calc amount of sections we have and set their index, starting with 1 }
|
||||||
|
nsections:=1;
|
||||||
|
data.ObjSectionList.ForEachCall(@section_count_sections,@nsections);
|
||||||
|
{ maximum amount of sections supported in the omf format is $7fff }
|
||||||
|
if (nsections-1)>$7fff then
|
||||||
|
internalerror(2015040701);
|
||||||
|
|
||||||
{ write header record }
|
{ write header record }
|
||||||
RawRecord:=TOmfRawRecord.Create;
|
RawRecord:=TOmfRawRecord.Create;
|
||||||
Header:=TOmfRecord_THEADR.Create;
|
Header:=TOmfRecord_THEADR.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user