From patch submitted by Willibald Krenn in Bug Report 17500.

* assemble.pas (TInternalAssembler.WriteStab): Use RELOC_ABSOLUTE32 for
   32-bit stab entry.
 * ogcoff.pas: Add check for correct generated reloc section size.
 * systems/t_win.pas: Use 0x400000 image base for x86_64 programs using
   stabs debug information format.

git-svn-id: trunk@16056 -
This commit is contained in:
pierre 2010-09-28 10:06:54 +00:00
parent 7199ac4ad7
commit 7c04d8d13b
3 changed files with 22 additions and 10 deletions

View File

@ -899,7 +899,7 @@ Implementation
oldsec:=ObjData.CurrObjSec;
ObjData.SetSection(ObjData.StabsSec);
ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4);
ObjData.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE);
ObjData.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE32);
ObjData.setsection(oldsec);
end;
if assigned(pendquote) then

View File

@ -959,15 +959,19 @@ const pemagic : array[0..3] of byte = (
data.Seek(objreloc.dataoffset);
data.Write(address,address_size);
{$ifdef cpu64bitaddr}
if objreloc.typ = RELOC_ABSOLUTE32 then begin
if assigned(objreloc.symbol) then
s:=objreloc.symbol.Name
else
s:=objreloc.objsection.Name;
Message2(link_w_32bit_absolute_reloc, ObjData.Name, s);
end;
if (objreloc.typ = RELOC_ABSOLUTE32) and (name <> '.stab') then
begin
if assigned(objreloc.symbol) then
s:=objreloc.symbol.Name
else
s:=objreloc.objsection.Name;
Message2(link_w_32bit_absolute_reloc, ObjData.Name, s);
end;
{$endif cpu64bitaddr}
end;
{for size = 0 data is not valid PM }
if assigned(data) and (data.size <> size) then
internalerror(2010092801);
end;
@ -1089,7 +1093,8 @@ const pemagic : array[0..3] of byte = (
{$endif cpu64bitaddr}
RELOC_RELATIVE :
begin
inc(data,symaddr-len-CurrObjSec.Size);
//inc(data,symaddr-len-CurrObjSec.Size);
data:=data+symaddr-len-CurrObjSec.Size;
end;
RELOC_RVA :
begin

View File

@ -969,7 +969,14 @@ implementation
if target_info.system in systems_wince then
imagebase:=$10000
else
imagebase:={$ifdef cpu64bitaddr} $100000000 {$else} $400000 {$endif};
{$ifdef cpu64bitaddr}
if (paratargetdbg = dbg_stabs) then
imagebase:=$400000
else
imagebase:= $100000000;
{$else}
imagebase:=$400000;
{$endif}
end;
Concat('IMAGEBASE $' + hexStr(imagebase, SizeOf(imagebase)*2));
Concat('HEADER');