|
@@ -89,7 +89,7 @@ interface
|
|
|
|
|
|
TObjSectionOptions = set of TObjSectionOption;
|
|
TObjSectionOptions = set of TObjSectionOption;
|
|
|
|
|
|
- TObjSymbol = class(TNamedIndexItem)
|
|
|
|
|
|
+ TObjSymbol = class(TFPHashObject)
|
|
public
|
|
public
|
|
bind : TAsmsymbind;
|
|
bind : TAsmsymbind;
|
|
typ : TAsmsymtype;
|
|
typ : TAsmsymtype;
|
|
@@ -101,7 +101,7 @@ interface
|
|
size : aint;
|
|
size : aint;
|
|
{ Used for external and common solving during linking }
|
|
{ Used for external and common solving during linking }
|
|
exesymbol : TExeSymbol;
|
|
exesymbol : TExeSymbol;
|
|
- constructor create(const s:string);
|
|
|
|
|
|
+ constructor create(AList:TFPHashObjectList;const AName:string);
|
|
function address:aint;
|
|
function address:aint;
|
|
procedure SetAddress(apass:byte;aobjsec:TObjSection;abind:TAsmsymbind;atyp:Tasmsymtype);
|
|
procedure SetAddress(apass:byte;aobjsec:TObjSection;abind:TAsmsymbind;atyp:Tasmsymtype);
|
|
end;
|
|
end;
|
|
@@ -127,7 +127,7 @@ interface
|
|
constructor CreateSection(ADataOffset:aint;aobjsec:TObjSection;Atyp:TObjRelocationType);
|
|
constructor CreateSection(ADataOffset:aint;aobjsec:TObjSection;Atyp:TObjRelocationType);
|
|
end;
|
|
end;
|
|
|
|
|
|
- TObjSection = class(TNamedIndexItem)
|
|
|
|
|
|
+ TObjSection = class(TFPHashObject)
|
|
private
|
|
private
|
|
FData : TDynamicArray;
|
|
FData : TDynamicArray;
|
|
FSecOptions : TObjSectionOptions;
|
|
FSecOptions : TObjSectionOptions;
|
|
@@ -149,7 +149,7 @@ interface
|
|
ExeSection : TExeSection;
|
|
ExeSection : TExeSection;
|
|
Used : boolean;
|
|
Used : boolean;
|
|
VTRefList : TFPObjectList;
|
|
VTRefList : TFPObjectList;
|
|
- constructor create(const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);virtual;
|
|
|
|
|
|
+ constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);virtual;
|
|
destructor destroy;override;
|
|
destructor destroy;override;
|
|
function write(const d;l:aint):aint;
|
|
function write(const d;l:aint):aint;
|
|
function writestr(const s:string):aint;
|
|
function writestr(const s:string):aint;
|
|
@@ -172,14 +172,10 @@ interface
|
|
private
|
|
private
|
|
FName : string[80];
|
|
FName : string[80];
|
|
FCurrObjSec : TObjSection;
|
|
FCurrObjSec : TObjSection;
|
|
- { ObjSections will be stored in order in SectsIndex, this is at least
|
|
|
|
- required for stabs debuginfo. The SectsDict is only used for lookups (PFV) }
|
|
|
|
- FObjSectionDict : TDictionary;
|
|
|
|
- FObjSectionList : TFPObjectList;
|
|
|
|
|
|
+ FObjSectionList : TFPHashObjectList;
|
|
FCObjSection : TObjSectionClass;
|
|
FCObjSection : TObjSectionClass;
|
|
{ Symbols that will be defined in this object file }
|
|
{ Symbols that will be defined in this object file }
|
|
- FObjSymbolList : TFPObjectList;
|
|
|
|
- FObjSymbolDict : TDictionary;
|
|
|
|
|
|
+ FObjSymbolList : TFPHashObjectList;
|
|
FCachedAsmSymbolList : TFPObjectList;
|
|
FCachedAsmSymbolList : TFPObjectList;
|
|
{ Special info sections that are written to during object generation }
|
|
{ Special info sections that are written to during object generation }
|
|
FStabsObjSec,
|
|
FStabsObjSec,
|
|
@@ -226,8 +222,8 @@ interface
|
|
procedure resetsections;
|
|
procedure resetsections;
|
|
property Name:string[80] read FName;
|
|
property Name:string[80] read FName;
|
|
property CurrObjSec:TObjSection read FCurrObjSec;
|
|
property CurrObjSec:TObjSection read FCurrObjSec;
|
|
- property ObjSymbolList:TFPObjectList read FObjSymbolList;
|
|
|
|
- property ObjSectionList:TFPObjectList read FObjSectionList;
|
|
|
|
|
|
+ property ObjSymbolList:TFPHashObjectList read FObjSymbolList;
|
|
|
|
+ property ObjSectionList:TFPHashObjectList read FObjSectionList;
|
|
end;
|
|
end;
|
|
TObjDataClass = class of TObjData;
|
|
TObjDataClass = class of TObjData;
|
|
|
|
|
|
@@ -293,15 +289,14 @@ interface
|
|
function VTableRef(VTableIdx:Longint):TObjRelocation;
|
|
function VTableRef(VTableIdx:Longint):TObjRelocation;
|
|
end;
|
|
end;
|
|
|
|
|
|
- TExeSymbol = class(TNamedIndexItem)
|
|
|
|
|
|
+ TExeSymbol = class(TFPHashObject)
|
|
ObjSymbol : TObjSymbol;
|
|
ObjSymbol : TObjSymbol;
|
|
ExeSection : TExeSection;
|
|
ExeSection : TExeSection;
|
|
{ Used for vmt references optimization }
|
|
{ Used for vmt references optimization }
|
|
VTable : TExeVTable;
|
|
VTable : TExeVTable;
|
|
- constructor create(sym:TObjSymbol);
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
- TExeSection = class(tnamedindexitem)
|
|
|
|
|
|
+ TExeSection = class(TFPHashObject)
|
|
private
|
|
private
|
|
FSecSymIdx : longint;
|
|
FSecSymIdx : longint;
|
|
FObjSectionList : TFPObjectList;
|
|
FObjSectionList : TFPObjectList;
|
|
@@ -311,7 +306,7 @@ interface
|
|
MemPos : aint;
|
|
MemPos : aint;
|
|
SecAlign : shortint;
|
|
SecAlign : shortint;
|
|
SecOptions : TObjSectionOptions;
|
|
SecOptions : TObjSectionOptions;
|
|
- constructor create(const n:string);virtual;
|
|
|
|
|
|
+ constructor create(AList:TFPHashObjectList;const AName:string);virtual;
|
|
destructor destroy;override;
|
|
destructor destroy;override;
|
|
procedure AddObjSection(objsec:TObjSection);
|
|
procedure AddObjSection(objsec:TObjSection);
|
|
property ObjSectionList:TFPObjectList read FObjSectionList;
|
|
property ObjSectionList:TFPObjectList read FObjSectionList;
|
|
@@ -325,12 +320,10 @@ interface
|
|
FCObjData : TObjDataClass;
|
|
FCObjData : TObjDataClass;
|
|
FCExeSection : TExeSectionClass;
|
|
FCExeSection : TExeSectionClass;
|
|
FCurrExeSec : TExeSection;
|
|
FCurrExeSec : TExeSection;
|
|
- FExeSectionList : TFPObjectList;
|
|
|
|
- FExeSectionDict : TDictionary;
|
|
|
|
|
|
+ FExeSectionList : TFPHashObjectList;
|
|
Fzeronr : longint;
|
|
Fzeronr : longint;
|
|
{ Symbols }
|
|
{ Symbols }
|
|
- FExeSymbolDict : TDictionary;
|
|
|
|
- FExeSymbolList,
|
|
|
|
|
|
+ FExeSymbolList : TFPHashObjectList;
|
|
FUnresolvedExeSymbols : TFPObjectList;
|
|
FUnresolvedExeSymbols : TFPObjectList;
|
|
FExternalObjSymbols,
|
|
FExternalObjSymbols,
|
|
FCommonObjSymbols : TFPObjectList;
|
|
FCommonObjSymbols : TFPObjectList;
|
|
@@ -385,10 +378,9 @@ interface
|
|
procedure ResolveExternals(const libname:string);virtual;
|
|
procedure ResolveExternals(const libname:string);virtual;
|
|
function writeexefile(const fn:string):boolean;
|
|
function writeexefile(const fn:string):boolean;
|
|
property Writer:TObjectWriter read FWriter;
|
|
property Writer:TObjectWriter read FWriter;
|
|
- property ExeSections:TFPObjectList read FExeSectionList;
|
|
|
|
|
|
+ property ExeSections:TFPHashObjectList read FExeSectionList;
|
|
property ObjDataList:TFPObjectList read FObjDataList;
|
|
property ObjDataList:TFPObjectList read FObjDataList;
|
|
- property ExeSymbolDict:TDictionary read FExeSymbolDict;
|
|
|
|
- property ExeSymbolList:TFPObjectList read FExeSymbolList;
|
|
|
|
|
|
+ property ExeSymbolList:TFPHashObjectList read FExeSymbolList;
|
|
property UnresolvedExeSymbols:TFPObjectList read FUnresolvedExeSymbols;
|
|
property UnresolvedExeSymbols:TFPObjectList read FUnresolvedExeSymbols;
|
|
property ExternalObjSymbols:TFPObjectList read FExternalObjSymbols;
|
|
property ExternalObjSymbols:TFPObjectList read FExternalObjSymbols;
|
|
property CommonObjSymbols:TFPObjectList read FCommonObjSymbols;
|
|
property CommonObjSymbols:TFPObjectList read FCommonObjSymbols;
|
|
@@ -411,16 +403,21 @@ implementation
|
|
cutils,globals,verbose,fmodule,ogmap;
|
|
cutils,globals,verbose,fmodule,ogmap;
|
|
|
|
|
|
const
|
|
const
|
|
- sectionDatagrowsize = 1024;
|
|
|
|
|
|
+ sectionDatagrowsize = 256-sizeof(ptrint);
|
|
|
|
|
|
|
|
+{$ifdef MEMDEBUG}
|
|
|
|
+ var
|
|
|
|
+ memobjsymbols,
|
|
|
|
+ memobjsections : TMemDebug;
|
|
|
|
+{$endif MEMDEBUG}
|
|
|
|
|
|
{*****************************************************************************
|
|
{*****************************************************************************
|
|
TObjSymbol
|
|
TObjSymbol
|
|
*****************************************************************************}
|
|
*****************************************************************************}
|
|
|
|
|
|
- constructor TObjSymbol.create(const s:string);
|
|
|
|
|
|
+ constructor TObjSymbol.create(AList:TFPHashObjectList;const AName:string);
|
|
begin;
|
|
begin;
|
|
- inherited createname(s);
|
|
|
|
|
|
+ inherited create(AList,AName);
|
|
bind:=AB_EXTERNAL;
|
|
bind:=AB_EXTERNAL;
|
|
typ:=AT_NONE;
|
|
typ:=AT_NONE;
|
|
symidx:=-1;
|
|
symidx:=-1;
|
|
@@ -508,10 +505,9 @@ implementation
|
|
TObjSection
|
|
TObjSection
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
- constructor TObjSection.create(const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);
|
|
|
|
|
|
+ constructor TObjSection.create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);
|
|
begin
|
|
begin
|
|
- inherited createname(Aname);
|
|
|
|
- name:=Aname;
|
|
|
|
|
|
+ inherited Create(AList,Aname);
|
|
{ Data }
|
|
{ Data }
|
|
Size:=0;
|
|
Size:=0;
|
|
Datapos:=0;
|
|
Datapos:=0;
|
|
@@ -670,17 +666,11 @@ implementation
|
|
begin
|
|
begin
|
|
inherited create;
|
|
inherited create;
|
|
FName:=SplitFileName(n);
|
|
FName:=SplitFileName(n);
|
|
- { sections, the SectsIndex owns the items, the FObjSectionDict
|
|
|
|
- is only used for lookups }
|
|
|
|
- FObjSectionDict:=tdictionary.create;
|
|
|
|
- FObjSectionDict.noclear:=true;
|
|
|
|
- FObjSectionList:=TFPObjectList.Create(true);
|
|
|
|
|
|
+ FObjSectionList:=TFPHashObjectList.Create(true);
|
|
FStabsObjSec:=nil;
|
|
FStabsObjSec:=nil;
|
|
FStabStrObjSec:=nil;
|
|
FStabStrObjSec:=nil;
|
|
{ symbols }
|
|
{ symbols }
|
|
- FObjSymbolDict:=tdictionary.create;
|
|
|
|
- FObjSymbolDict.noclear:=true;
|
|
|
|
- FObjSymbolList:=TFPObjectList.Create(true);
|
|
|
|
|
|
+ FObjSymbolList:=TFPHashObjectList.Create(true);
|
|
FCachedAsmSymbolList:=TFPObjectList.Create(false);
|
|
FCachedAsmSymbolList:=TFPObjectList.Create(false);
|
|
{ section class type for creating of new sections }
|
|
{ section class type for creating of new sections }
|
|
FCObjSection:=TObjSection;
|
|
FCObjSection:=TObjSection;
|
|
@@ -695,20 +685,22 @@ implementation
|
|
begin
|
|
begin
|
|
{$ifdef MEMDEBUG}
|
|
{$ifdef MEMDEBUG}
|
|
d:=tmemdebug.create(name+' - ObjData symbols');
|
|
d:=tmemdebug.create(name+' - ObjData symbols');
|
|
|
|
+ MemObjSymbols.Start;
|
|
{$endif}
|
|
{$endif}
|
|
ResetCachedAsmSymbols;
|
|
ResetCachedAsmSymbols;
|
|
FCachedAsmSymbolList.free;
|
|
FCachedAsmSymbolList.free;
|
|
- FObjSymbolDict.free;
|
|
|
|
FObjSymbolList.free;
|
|
FObjSymbolList.free;
|
|
{$ifdef MEMDEBUG}
|
|
{$ifdef MEMDEBUG}
|
|
|
|
+ MemObjSymbols.Stop;
|
|
d.free;
|
|
d.free;
|
|
{$endif}
|
|
{$endif}
|
|
{$ifdef MEMDEBUG}
|
|
{$ifdef MEMDEBUG}
|
|
d:=tmemdebug.create(name+' - ObjData sections');
|
|
d:=tmemdebug.create(name+' - ObjData sections');
|
|
|
|
+ MemObjSections.Start;
|
|
{$endif}
|
|
{$endif}
|
|
- FObjSectionDict.free;
|
|
|
|
FObjSectionList.free;
|
|
FObjSectionList.free;
|
|
{$ifdef MEMDEBUG}
|
|
{$ifdef MEMDEBUG}
|
|
|
|
+ MemObjSections.Stop;
|
|
d.free;
|
|
d.free;
|
|
{$endif}
|
|
{$endif}
|
|
inherited destroy;
|
|
inherited destroy;
|
|
@@ -788,12 +780,10 @@ implementation
|
|
|
|
|
|
function TObjData.createsection(const aname:string;aalign:shortint;aoptions:TObjSectionOptions):TObjSection;
|
|
function TObjData.createsection(const aname:string;aalign:shortint;aoptions:TObjSectionOptions):TObjSection;
|
|
begin
|
|
begin
|
|
- result:=TObjSection(FObjSectionDict.search(aname));
|
|
|
|
|
|
+ result:=TObjSection(FObjSectionList.Find(aname));
|
|
if not assigned(result) then
|
|
if not assigned(result) then
|
|
begin
|
|
begin
|
|
- result:=CObjSection.create(aname,aalign,aoptions);
|
|
|
|
- FObjSectionDict.Insert(result);
|
|
|
|
- FObjSectionList.Add(result);
|
|
|
|
|
|
+ result:=CObjSection.create(FObjSectionList,aname,aalign,aoptions);
|
|
result.ObjData:=self;
|
|
result.ObjData:=self;
|
|
end;
|
|
end;
|
|
FCurrObjSec:=result;
|
|
FCurrObjSec:=result;
|
|
@@ -807,7 +797,7 @@ implementation
|
|
|
|
|
|
function TObjData.FindSection(const aname:string):TObjSection;
|
|
function TObjData.FindSection(const aname:string):TObjSection;
|
|
begin
|
|
begin
|
|
- result:=TObjSection(FObjSectionDict.Search(aname));
|
|
|
|
|
|
+ result:=TObjSection(FObjSectionList.Find(aname));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -821,13 +811,9 @@ implementation
|
|
|
|
|
|
function TObjData.createsymbol(const aname:string):TObjSymbol;
|
|
function TObjData.createsymbol(const aname:string):TObjSymbol;
|
|
begin
|
|
begin
|
|
- result:=TObjSymbol(FObjSymbolDict.search(aname));
|
|
|
|
|
|
+ result:=TObjSymbol(FObjSymbolList.Find(aname));
|
|
if not assigned(result) then
|
|
if not assigned(result) then
|
|
- begin
|
|
|
|
- result:=TObjSymbol.Create(aname);
|
|
|
|
- FObjSymbolDict.Insert(result);
|
|
|
|
- FObjSymbolList.Add(result);
|
|
|
|
- end;
|
|
|
|
|
|
+ result:=TObjSymbol.Create(FObjSymbolList,aname);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1173,23 +1159,12 @@ implementation
|
|
|
|
|
|
|
|
|
|
{****************************************************************************
|
|
{****************************************************************************
|
|
- TExeSymbol
|
|
|
|
|
|
+ TExeSection
|
|
****************************************************************************}
|
|
****************************************************************************}
|
|
|
|
|
|
- constructor TExeSymbol.create(sym:TObjSymbol);
|
|
|
|
|
|
+ constructor TExeSection.create(AList:TFPHashObjectList;const AName:string);
|
|
begin
|
|
begin
|
|
- inherited createname(sym.name);
|
|
|
|
- ObjSymbol:=sym;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-{****************************************************************************
|
|
|
|
- tExeSection
|
|
|
|
-****************************************************************************}
|
|
|
|
-
|
|
|
|
- constructor tExeSection.create(const n:string);
|
|
|
|
- begin
|
|
|
|
- inherited createname(n);
|
|
|
|
|
|
+ inherited create(AList,AName);
|
|
Size:=0;
|
|
Size:=0;
|
|
MemPos:=0;
|
|
MemPos:=0;
|
|
DataPos:=0;
|
|
DataPos:=0;
|
|
@@ -1198,14 +1173,14 @@ implementation
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- destructor tExeSection.destroy;
|
|
|
|
|
|
+ destructor TExeSection.destroy;
|
|
begin
|
|
begin
|
|
ObjSectionList.Free;
|
|
ObjSectionList.Free;
|
|
inherited destroy;
|
|
inherited destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
- procedure tExeSection.AddObjSection(objsec:TObjSection);
|
|
|
|
|
|
+ procedure TExeSection.AddObjSection(objsec:TObjSection);
|
|
begin
|
|
begin
|
|
ObjSectionList.Add(objsec);
|
|
ObjSectionList.Add(objsec);
|
|
if (SecOptions<>[]) then
|
|
if (SecOptions<>[]) then
|
|
@@ -1236,19 +1211,14 @@ implementation
|
|
{ object files }
|
|
{ object files }
|
|
FObjDataList:=TFPObjectList.Create(true);
|
|
FObjDataList:=TFPObjectList.Create(true);
|
|
{ symbols }
|
|
{ symbols }
|
|
- FExeSymbolDict:=tdictionary.create;
|
|
|
|
- FExeSymbolDict.noclear:=true;
|
|
|
|
- FExeSymbolDict.usehash;
|
|
|
|
- FExeSymbolList:=TFPObjectList.Create(true);
|
|
|
|
|
|
+ FExeSymbolList:=TFPHashObjectList.Create(true);
|
|
FUnresolvedExeSymbols:=TFPObjectList.Create(false);
|
|
FUnresolvedExeSymbols:=TFPObjectList.Create(false);
|
|
FExternalObjSymbols:=TFPObjectList.Create(false);
|
|
FExternalObjSymbols:=TFPObjectList.Create(false);
|
|
FCommonObjSymbols:=TFPObjectList.Create(false);
|
|
FCommonObjSymbols:=TFPObjectList.Create(false);
|
|
FExeVTableList:=TFPObjectList.Create(false);
|
|
FExeVTableList:=TFPObjectList.Create(false);
|
|
FEntryName:='start';
|
|
FEntryName:='start';
|
|
{ sections }
|
|
{ sections }
|
|
- FExeSectionDict:=TDictionary.create;
|
|
|
|
- FExeSectionDict.noclear:=true;
|
|
|
|
- FExeSectionList:=TFPObjectList.Create(true);
|
|
|
|
|
|
+ FExeSectionList:=TFPHashObjectList.Create(true);
|
|
FImageBase:=0;
|
|
FImageBase:=0;
|
|
SectionMemAlign:=$1000;
|
|
SectionMemAlign:=$1000;
|
|
SectionDataAlign:=$200;
|
|
SectionDataAlign:=$200;
|
|
@@ -1259,13 +1229,11 @@ implementation
|
|
|
|
|
|
destructor TExeOutput.destroy;
|
|
destructor TExeOutput.destroy;
|
|
begin
|
|
begin
|
|
- FExeSymbolDict.free;
|
|
|
|
FExeSymbolList.free;
|
|
FExeSymbolList.free;
|
|
UnresolvedExeSymbols.free;
|
|
UnresolvedExeSymbols.free;
|
|
ExternalObjSymbols.free;
|
|
ExternalObjSymbols.free;
|
|
CommonObjSymbols.free;
|
|
CommonObjSymbols.free;
|
|
ExeVTableList.free;
|
|
ExeVTableList.free;
|
|
- FExeSectionDict.free;
|
|
|
|
FExeSectionList.free;
|
|
FExeSectionList.free;
|
|
ObjDatalist.free;
|
|
ObjDatalist.free;
|
|
FWriter.free;
|
|
FWriter.free;
|
|
@@ -1301,7 +1269,7 @@ implementation
|
|
|
|
|
|
function TExeOutput.FindExeSection(const aname:string):TExeSection;
|
|
function TExeOutput.FindExeSection(const aname:string):TExeSection;
|
|
begin
|
|
begin
|
|
- result:=TExeSection(FExeSectionDict.Search(aname));
|
|
|
|
|
|
+ result:=TExeSection(FExeSectionList.Find(aname));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1347,11 +1315,7 @@ implementation
|
|
begin
|
|
begin
|
|
sec:=FindExeSection(aname);
|
|
sec:=FindExeSection(aname);
|
|
if not assigned(sec) then
|
|
if not assigned(sec) then
|
|
- begin
|
|
|
|
- sec:=CExeSection.create(aname);
|
|
|
|
- FExeSectionDict.Insert(sec);
|
|
|
|
- FExeSectionList.Add(sec);
|
|
|
|
- end;
|
|
|
|
|
|
+ sec:=CExeSection.create(FExeSectionList,aname);
|
|
{ Clear ExeSection contents }
|
|
{ Clear ExeSection contents }
|
|
FCurrExeSec:=sec;
|
|
FCurrExeSec:=sec;
|
|
end;
|
|
end;
|
|
@@ -1401,7 +1365,7 @@ implementation
|
|
procedure TExeOutput.Order_Align(const aname:string);
|
|
procedure TExeOutput.Order_Align(const aname:string);
|
|
var
|
|
var
|
|
code : integer;
|
|
code : integer;
|
|
- alignval : longint;
|
|
|
|
|
|
+ alignval : shortint;
|
|
objsec : TObjSection;
|
|
objsec : TObjSection;
|
|
begin
|
|
begin
|
|
val(aname,alignval,code);
|
|
val(aname,alignval,code);
|
|
@@ -1521,8 +1485,8 @@ implementation
|
|
k:=Pos('$$',hs);
|
|
k:=Pos('$$',hs);
|
|
if k=0 then
|
|
if k=0 then
|
|
internalerror(200603311);
|
|
internalerror(200603311);
|
|
- childexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,1,k-1)));
|
|
|
|
- parentexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,k+2,length(hs)-k-1)));
|
|
|
|
|
|
+ childexesym:=texesymbol(FExeSymbolList.Find(Copy(hs,1,k-1)));
|
|
|
|
+ parentexesym:=texesymbol(FExeSymbolList.Find(Copy(hs,k+2,length(hs)-k-1)));
|
|
if not assigned(childexesym) or
|
|
if not assigned(childexesym) or
|
|
not assigned(parentexesym)then
|
|
not assigned(parentexesym)then
|
|
internalerror(200603312);
|
|
internalerror(200603312);
|
|
@@ -1551,7 +1515,7 @@ implementation
|
|
k:=Pos('$$',hs);
|
|
k:=Pos('$$',hs);
|
|
if k=0 then
|
|
if k=0 then
|
|
internalerror(200603319);
|
|
internalerror(200603319);
|
|
- vtableexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,1,k-1)));
|
|
|
|
|
|
+ vtableexesym:=texesymbol(FExeSymbolList.Find(Copy(hs,1,k-1)));
|
|
val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code);
|
|
val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code);
|
|
if (code<>0) then
|
|
if (code<>0) then
|
|
internalerror(200603318);
|
|
internalerror(200603318);
|
|
@@ -1618,13 +1582,9 @@ implementation
|
|
continue;
|
|
continue;
|
|
end;
|
|
end;
|
|
{ Search for existing exesymbol }
|
|
{ Search for existing exesymbol }
|
|
- exesym:=texesymbol(FExeSymbolDict.search(objsym.name));
|
|
|
|
|
|
+ exesym:=texesymbol(FExeSymbolList.Find(objsym.name));
|
|
if not assigned(exesym) then
|
|
if not assigned(exesym) then
|
|
- begin
|
|
|
|
- exesym:=texesymbol.createname(objsym.name);
|
|
|
|
- FExeSymbolDict.insert(exesym);
|
|
|
|
- FExeSymbolList.Add(exesym);
|
|
|
|
- end;
|
|
|
|
|
|
+ exesym:=texesymbol.Create(FExeSymbolList,objsym.name);
|
|
{ Defining the symbol? }
|
|
{ Defining the symbol? }
|
|
if objsym.bind=AB_GLOBAL then
|
|
if objsym.bind=AB_GLOBAL then
|
|
begin
|
|
begin
|
|
@@ -1684,7 +1644,7 @@ implementation
|
|
Comment(V_Debug,'Number of unresolved externals in objects '+tostr(UnresolvedExeSymbols.Count));
|
|
Comment(V_Debug,'Number of unresolved externals in objects '+tostr(UnresolvedExeSymbols.Count));
|
|
|
|
|
|
{ Find entry symbol and print in map }
|
|
{ Find entry symbol and print in map }
|
|
- exesym:=texesymbol(ExeSymbolDict.search(EntryName));
|
|
|
|
|
|
+ exesym:=texesymbol(ExeSymbolList.Find(EntryName));
|
|
if assigned(exesym) then
|
|
if assigned(exesym) then
|
|
begin
|
|
begin
|
|
EntrySym:=exesym.ObjSymbol;
|
|
EntrySym:=exesym.ObjSymbol;
|
|
@@ -1964,8 +1924,7 @@ implementation
|
|
) then
|
|
) then
|
|
begin
|
|
begin
|
|
Comment(V_Debug,'Deleting empty section '+exesec.name);
|
|
Comment(V_Debug,'Deleting empty section '+exesec.name);
|
|
- FExeSectionDict.Delete(exesec.name);
|
|
|
|
- FExeSectionList[i]:=nil;
|
|
|
|
|
|
+ FExeSectionList.Delete(i);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
ExeSections.Pack;
|
|
ExeSections.Pack;
|
|
@@ -2097,7 +2056,7 @@ implementation
|
|
k:=Pos('$$',hs);
|
|
k:=Pos('$$',hs);
|
|
if k=0 then
|
|
if k=0 then
|
|
internalerror(200603314);
|
|
internalerror(200603314);
|
|
- vtableexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,1,k-1)));
|
|
|
|
|
|
+ vtableexesym:=texesymbol(FExeSymbolList.Find(Copy(hs,1,k-1)));
|
|
val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code);
|
|
val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code);
|
|
if (code<>0) then
|
|
if (code<>0) then
|
|
internalerror(200603317);
|
|
internalerror(200603317);
|
|
@@ -2141,6 +2100,8 @@ implementation
|
|
for i:=0 to ExeSections.Count-1 do
|
|
for i:=0 to ExeSections.Count-1 do
|
|
begin
|
|
begin
|
|
exesec:=TExeSection(ExeSections[i]);
|
|
exesec:=TExeSection(ExeSections[i]);
|
|
|
|
+ if not assigned(exesec) then
|
|
|
|
+ continue;
|
|
for j:=0 to exesec.ObjSectionlist.count-1 do
|
|
for j:=0 to exesec.ObjSectionlist.count-1 do
|
|
begin
|
|
begin
|
|
objsec:=TObjSection(exesec.ObjSectionlist[j]);
|
|
objsec:=TObjSection(exesec.ObjSectionlist[j]);
|
|
@@ -2192,4 +2153,16 @@ implementation
|
|
Comment(V_Error,s+' while reading '+reader.filename);
|
|
Comment(V_Error,s+' while reading '+reader.filename);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
|
|
+{$ifdef MEMDEBUG}
|
|
|
|
+initialization
|
|
|
|
+ memobjsymbols:=TMemDebug.create('ObjSymbols');
|
|
|
|
+ memobjsymbols.stop;
|
|
|
|
+ memobjsections:=TMemDebug.create('ObjSections');
|
|
|
|
+ memobjsections.stop;
|
|
|
|
+
|
|
|
|
+finalization
|
|
|
|
+ memobjsymbols.free;
|
|
|
|
+ memobjsections.free;
|
|
|
|
+{$endif MEMDEBUG}
|
|
end.
|
|
end.
|