mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-09 12:39:52 +01:00
* add FSectsIndex that stores the sections in order, the old FSects is renamed to FSectsDict
and will only be used for lookups git-svn-id: trunk@1165 -
This commit is contained in:
parent
c7cd9ff06b
commit
0edbc24e91
@ -158,7 +158,10 @@ interface
|
|||||||
private
|
private
|
||||||
FName : string[80];
|
FName : string[80];
|
||||||
FCurrSec : TAsmSection;
|
FCurrSec : TAsmSection;
|
||||||
FSects : TDictionary;
|
{ Sections will be stored in order in SectsIndex, this is at least
|
||||||
|
required for stabs debuginfo. The SectsDict is only used for lookups (PFV) }
|
||||||
|
FSectsDict : TDictionary;
|
||||||
|
FSectsIndex : TIndexArray;
|
||||||
FCAsmSection : TAsmSectionClass;
|
FCAsmSection : TAsmSectionClass;
|
||||||
{ Symbols that will be defined in this object file }
|
{ Symbols that will be defined in this object file }
|
||||||
FSymbols : TIndexArray;
|
FSymbols : TIndexArray;
|
||||||
@ -193,10 +196,10 @@ interface
|
|||||||
procedure afterwrite;virtual;
|
procedure afterwrite;virtual;
|
||||||
procedure resetsections;
|
procedure resetsections;
|
||||||
procedure fixuprelocs;
|
procedure fixuprelocs;
|
||||||
property Name:string{$ifndef VER1_9_4}[80]{$endif} read FName;
|
property Name:string[80] read FName;
|
||||||
property CurrSec:TAsmSection read FCurrSec;
|
property CurrSec:TAsmSection read FCurrSec;
|
||||||
property Symbols:TindexArray read FSymbols;
|
property Symbols:TindexArray read FSymbols;
|
||||||
property Sects:TDictionary read FSects;
|
property Sects:TIndexArray read FSectsIndex;
|
||||||
end;
|
end;
|
||||||
TAsmObjectDataClass = class of TAsmObjectData;
|
TAsmObjectDataClass = class of TAsmObjectData;
|
||||||
|
|
||||||
@ -259,6 +262,7 @@ implementation
|
|||||||
verbose;
|
verbose;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
sectsgrow = 100;
|
||||||
symbolsgrow = 100;
|
symbolsgrow = 100;
|
||||||
|
|
||||||
|
|
||||||
@ -549,8 +553,11 @@ implementation
|
|||||||
begin
|
begin
|
||||||
inherited create;
|
inherited create;
|
||||||
FName:=n;
|
FName:=n;
|
||||||
{ sections }
|
{ sections, the SectsIndex owns the items, the FSectsDict
|
||||||
FSects:=tdictionary.create;
|
is only used for lookups }
|
||||||
|
FSectsDict:=tdictionary.create;
|
||||||
|
FSectsDict.noclear:=true;
|
||||||
|
FSectsIndex:=tindexarray.create(sectsgrow);
|
||||||
FStabsRecSize:=1;
|
FStabsRecSize:=1;
|
||||||
FStabsSec:=nil;
|
FStabsSec:=nil;
|
||||||
FStabStrSec:=nil;
|
FStabStrSec:=nil;
|
||||||
@ -564,7 +571,8 @@ implementation
|
|||||||
|
|
||||||
destructor TAsmObjectData.destroy;
|
destructor TAsmObjectData.destroy;
|
||||||
begin
|
begin
|
||||||
FSects.free;
|
FSectsDict.free;
|
||||||
|
FSectsIndex.free;
|
||||||
FSymbols.free;
|
FSymbols.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -595,14 +603,15 @@ implementation
|
|||||||
secname : string;
|
secname : string;
|
||||||
begin
|
begin
|
||||||
secname:=sectionname(atype,aname);
|
secname:=sectionname(atype,aname);
|
||||||
result:=TasmSection(FSects.search(secname));
|
result:=TasmSection(FSectsDict.search(secname));
|
||||||
if not assigned(result) then
|
if not assigned(result) then
|
||||||
begin
|
begin
|
||||||
{$warning TODO make alloconly configurable}
|
{$warning TODO make alloconly configurable}
|
||||||
if atype=sec_bss then
|
if atype=sec_bss then
|
||||||
include(aoptions,aso_alloconly);
|
include(aoptions,aso_alloconly);
|
||||||
result:=CAsmSection.create(secname,atype,aalign,aoptions);
|
result:=CAsmSection.create(secname,atype,aalign,aoptions);
|
||||||
FSects.Insert(result);
|
FSectsDict.Insert(result);
|
||||||
|
FSectsIndex.Insert(result);
|
||||||
result.owner:=self;
|
result.owner:=self;
|
||||||
end;
|
end;
|
||||||
FCurrSec:=result;
|
FCurrSec:=result;
|
||||||
@ -699,13 +708,13 @@ implementation
|
|||||||
|
|
||||||
procedure TAsmObjectData.resetsections;
|
procedure TAsmObjectData.resetsections;
|
||||||
begin
|
begin
|
||||||
FSects.foreach(@section_reset,nil);
|
FSectsDict.foreach(@section_reset,nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TAsmObjectData.fixuprelocs;
|
procedure TAsmObjectData.fixuprelocs;
|
||||||
begin
|
begin
|
||||||
FSects.foreach(@section_fixuprelocs,nil);
|
FSectsDict.foreach(@section_fixuprelocs,nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -304,8 +304,6 @@ implementation
|
|||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
constructor telf32objectdata.create(const n:string);
|
constructor telf32objectdata.create(const n:string);
|
||||||
var
|
|
||||||
s : string;
|
|
||||||
begin
|
begin
|
||||||
inherited create(n);
|
inherited create(n);
|
||||||
CAsmSection:=TElf32Section;
|
CAsmSection:=TElf32Section;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user