|
@@ -223,15 +223,15 @@ implementation
|
|
|
|
|
|
const
|
|
const
|
|
{$ifdef i386}
|
|
{$ifdef i386}
|
|
- COFF_MAGIC = $14c;
|
|
|
|
|
|
+ COFF_MAGIC = $14c;
|
|
COFF_OPT_MAGIC = $10b;
|
|
COFF_OPT_MAGIC = $10b;
|
|
{$endif i386}
|
|
{$endif i386}
|
|
{$ifdef arm}
|
|
{$ifdef arm}
|
|
- COFF_MAGIC = $1c0;
|
|
|
|
|
|
+ COFF_MAGIC = $1c0;
|
|
COFF_OPT_MAGIC = $10b;
|
|
COFF_OPT_MAGIC = $10b;
|
|
{$endif arm}
|
|
{$endif arm}
|
|
{$ifdef x86_64}
|
|
{$ifdef x86_64}
|
|
- COFF_MAGIC = $14c;
|
|
|
|
|
|
+ COFF_MAGIC = $8664;
|
|
COFF_OPT_MAGIC = $20b;
|
|
COFF_OPT_MAGIC = $20b;
|
|
{$endif x86_64}
|
|
{$endif x86_64}
|
|
|
|
|
|
@@ -1360,7 +1360,7 @@ const win32stub : array[0..131] of byte=(
|
|
result:=nil;
|
|
result:=nil;
|
|
if (secidx<1) or (secidx>FSecCount) then
|
|
if (secidx<1) or (secidx>FSecCount) then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file, invalid section index');
|
|
|
|
|
|
+ InputError('Failed reading coff file, invalid section index');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
result:=FSecTbl^[secidx];
|
|
result:=FSecTbl^[secidx];
|
|
@@ -1394,7 +1394,7 @@ const win32stub : array[0..131] of byte=(
|
|
$07 : rel_type:=RELOC_RVA;
|
|
$07 : rel_type:=RELOC_RVA;
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ InputError('Failed reading coff file, illegal reloctype $'+system.hexstr(rel.reloctype,4));
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1408,7 +1408,7 @@ const win32stub : array[0..131] of byte=(
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ InputError('Failed reading coff file, can''t resolve symbol of relocation');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1507,7 +1507,7 @@ const win32stub : array[0..131] of byte=(
|
|
COFF_SYM_SECTION :
|
|
COFF_SYM_SECTION :
|
|
begin
|
|
begin
|
|
if sym.section=0 then
|
|
if sym.section=0 then
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ InputError('Failed reading coff file, illegal section');
|
|
objsec:=GetSection(sym.section);
|
|
objsec:=GetSection(sym.section);
|
|
if sym.value>=objsec.mempos then
|
|
if sym.value>=objsec.mempos then
|
|
address:=sym.value-objsec.mempos;
|
|
address:=sym.value-objsec.mempos;
|
|
@@ -1552,7 +1552,7 @@ const win32stub : array[0..131] of byte=(
|
|
Reader.Seek(datapos);
|
|
Reader.Seek(datapos);
|
|
if not Reader.ReadArray(data,Size) then
|
|
if not Reader.ReadArray(data,Size) then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ Comment(V_Error,'Error reading coff file, can''t read object data');
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1600,12 +1600,12 @@ const win32stub : array[0..131] of byte=(
|
|
{ Read COFF header }
|
|
{ Read COFF header }
|
|
if not reader.read(header,sizeof(coffheader)) then
|
|
if not reader.read(header,sizeof(coffheader)) then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ Comment(V_Error,'Error reading coff file, can''t read header: '+reader.filename);
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
if header.mach<>COFF_MAGIC then
|
|
if header.mach<>COFF_MAGIC then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Not a coff file');
|
|
|
|
|
|
+ Comment(V_Error,'Not a coff file, illegal magic: '+reader.filename);
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
{ Strings }
|
|
{ Strings }
|
|
@@ -1622,7 +1622,7 @@ const win32stub : array[0..131] of byte=(
|
|
end;
|
|
end;
|
|
if not Reader.ReadArray(FCoffStrs,Strsize-4) then
|
|
if not Reader.ReadArray(FCoffStrs,Strsize-4) then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ Comment(V_Error,'Error reading coff file: '+reader.filename);
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
{ Section headers }
|
|
{ Section headers }
|
|
@@ -1635,7 +1635,7 @@ const win32stub : array[0..131] of byte=(
|
|
begin
|
|
begin
|
|
if not reader.read(sechdr,sizeof(sechdr)) then
|
|
if not reader.read(sechdr,sizeof(sechdr)) then
|
|
begin
|
|
begin
|
|
- Comment(V_Error,'Error reading coff file');
|
|
|
|
|
|
+ Comment(V_Error,'Error reading coff file, can''t read section header: '+reader.filename);
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
move(sechdr.name,secnamebuf,8);
|
|
move(sechdr.name,secnamebuf,8);
|