|
@@ -40,6 +40,9 @@ interface
|
|
PE_DATADIR_ENTRIES = 16;
|
|
PE_DATADIR_ENTRIES = 16;
|
|
|
|
|
|
type
|
|
type
|
|
|
|
+
|
|
|
|
+ TObjSymbolArray = array of TObjSymbol;
|
|
|
|
+ TObjSectionArray = array of TObjSection;
|
|
tcoffpedatadir = packed record
|
|
tcoffpedatadir = packed record
|
|
vaddr : longword;
|
|
vaddr : longword;
|
|
size : longword;
|
|
size : longword;
|
|
@@ -178,10 +181,10 @@ interface
|
|
FCoffStrs : TAnsiCharDynArray;
|
|
FCoffStrs : TAnsiCharDynArray;
|
|
FCoffStrSize: longword;
|
|
FCoffStrSize: longword;
|
|
{ Convert symidx -> TObjSymbol }
|
|
{ Convert symidx -> TObjSymbol }
|
|
- FSymTbl : ^TObjSymbolArray;
|
|
|
|
|
|
+ FSymTbl : TObjSymbolArray;
|
|
{ Convert secidx -> TObjSection }
|
|
{ Convert secidx -> TObjSection }
|
|
FSecCount : Longint;
|
|
FSecCount : Longint;
|
|
- FSecTbl : ^TObjSectionArray;
|
|
|
|
|
|
+ FSecTbl : TObjSectionArray;
|
|
win32 : boolean;
|
|
win32 : boolean;
|
|
bigobj : boolean;
|
|
bigobj : boolean;
|
|
function GetSection(secidx:longint):TObjSection;
|
|
function GetSection(secidx:longint):TObjSection;
|
|
@@ -252,9 +255,6 @@ interface
|
|
procedure MemPos_ExeSection(const aname:string);override;
|
|
procedure MemPos_ExeSection(const aname:string);override;
|
|
end;
|
|
end;
|
|
|
|
|
|
- TObjSymbolArray = array[0..high(word)] of TObjSymbol;
|
|
|
|
- TObjSectionArray = array[0..high(smallint)] of TObjSection;
|
|
|
|
-
|
|
|
|
TDJCoffAssembler = class(tinternalassembler)
|
|
TDJCoffAssembler = class(tinternalassembler)
|
|
constructor create(info: pasminfo; smart:boolean);override;
|
|
constructor create(info: pasminfo; smart:boolean);override;
|
|
end;
|
|
end;
|
|
@@ -2271,10 +2271,8 @@ const pemagic : array[0..3] of byte = (
|
|
begin
|
|
begin
|
|
FCoffSyms.free;
|
|
FCoffSyms.free;
|
|
FCoffStrs:=nil;
|
|
FCoffStrs:=nil;
|
|
- if assigned(FSymTbl) then
|
|
|
|
- freemem(FSymTbl);
|
|
|
|
- if assigned(FSecTbl) then
|
|
|
|
- freemem(FSecTbl);
|
|
|
|
|
|
+ FSymTbl:=nil;
|
|
|
|
+ FSecTbl:=nil;
|
|
inherited destroy;
|
|
inherited destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2287,7 +2285,7 @@ const pemagic : array[0..3] of byte = (
|
|
InputError('Failed reading coff file, invalid section index');
|
|
InputError('Failed reading coff file, invalid section index');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
- result:=FSecTbl^[secidx];
|
|
|
|
|
|
+ result:=FSecTbl[secidx];
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -2407,7 +2405,7 @@ const pemagic : array[0..3] of byte = (
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
- p:=FSymTbl^[rel.sym];
|
|
|
|
|
|
+ p:=FSymTbl[rel.sym];
|
|
if assigned(p) then
|
|
if assigned(p) then
|
|
s.addsymreloc(rel.address-s.mempos,p,rel_type)
|
|
s.addsymreloc(rel.address-s.mempos,p,rel_type)
|
|
else
|
|
else
|
|
@@ -2456,7 +2454,7 @@ const pemagic : array[0..3] of byte = (
|
|
else
|
|
else
|
|
nsyms:=FCoffSyms.Size div sizeof(CoffSymbol);
|
|
nsyms:=FCoffSyms.Size div sizeof(CoffSymbol);
|
|
{ Allocate memory for symidx -> TObjSymbol table }
|
|
{ Allocate memory for symidx -> TObjSymbol table }
|
|
- FSymTbl:=AllocMem(nsyms*sizeof(TObjSymbol));
|
|
|
|
|
|
+ SetLength(FSymTbl,nsyms);
|
|
{ Load the Symbols }
|
|
{ Load the Symbols }
|
|
FCoffSyms.Seek(0);
|
|
FCoffSyms.Seek(0);
|
|
symidx:=0;
|
|
symidx:=0;
|
|
@@ -2575,7 +2573,7 @@ const pemagic : array[0..3] of byte = (
|
|
else
|
|
else
|
|
UnsupportedSymbolType;
|
|
UnsupportedSymbolType;
|
|
end;
|
|
end;
|
|
- FSymTbl^[symidx]:=objsym;
|
|
|
|
|
|
+ FSymTbl[symidx]:=objsym;
|
|
{ read aux records }
|
|
{ read aux records }
|
|
|
|
|
|
{ handle COMDAT symbols }
|
|
{ handle COMDAT symbols }
|
|
@@ -2786,7 +2784,7 @@ const pemagic : array[0..3] of byte = (
|
|
FSecCount:=longint(boheader.NumberOfSections)
|
|
FSecCount:=longint(boheader.NumberOfSections)
|
|
else
|
|
else
|
|
FSecCount:=header.nsects;
|
|
FSecCount:=header.nsects;
|
|
- FSecTbl:=AllocMem((FSecCount+1)*sizeof(TObjSection));
|
|
|
|
|
|
+ SetLength(FSecTbl,(FSecCount+1));
|
|
if bigobj then
|
|
if bigobj then
|
|
secofs:=sizeof(tcoffbigobjheader)
|
|
secofs:=sizeof(tcoffbigobjheader)
|
|
else
|
|
else
|
|
@@ -2849,7 +2847,7 @@ const pemagic : array[0..3] of byte = (
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
objsec:=TCoffObjSection(createsection(secname,secalign,secoptions,false));
|
|
objsec:=TCoffObjSection(createsection(secname,secalign,secoptions,false));
|
|
- FSecTbl^[i]:=objsec;
|
|
|
|
|
|
+ FSecTbl[i]:=objsec;
|
|
if not win32 then
|
|
if not win32 then
|
|
objsec.mempos:=sechdr.rvaofs;
|
|
objsec.mempos:=sechdr.rvaofs;
|
|
objsec.orgmempos:=sechdr.rvaofs;
|
|
objsec.orgmempos:=sechdr.rvaofs;
|