* quick fix for broken relocation in stabs

git-svn-id: trunk@4874 -
This commit is contained in:
peter 2006-10-12 21:56:16 +00:00
parent 71a692368b
commit b7386124c4
2 changed files with 24 additions and 12 deletions

View File

@ -1037,11 +1037,6 @@ const pemagic : array[0..3] of byte = (
begin
if not assigned(StabsSec) then
internalerror(200602256);
{ Win32 does not need an offset if a symbol relocation is used }
if win32 and
assigned(ps) and
(ps.bind<>AB_LOCAL) then
offset:=0;
if assigned(p) and (p[0]<>#0) then
begin
stabstrlen:=strlen(p);
@ -1080,12 +1075,24 @@ const pemagic : array[0..3] of byte = (
begin
{ current address }
curraddr:=StabsSec.mempos+StabsSec.Size;
if DLLSource and RelocSection then
{ avoid relocation in the .stab section
because it ends up in the .reloc section instead }
StabsSec.addsymreloc(curraddr-4,ps,RELOC_RVA)
else
StabsSec.addsymreloc(curraddr-4,ps,RELOC_ABSOLUTE);
if ps.bind=AB_LOCAL then
begin
{ avoid relocation in the .stab section
because it ends up in the .reloc section instead }
if DLLSource and RelocSection then
StabsSec.addsectionreloc(curraddr-4,ps.ObjSection,RELOC_RVA)
else
StabsSec.addsectionreloc(curraddr-4,ps.ObjSection,RELOC_ABSOLUTE);
end
else
begin
{ avoid relocation in the .stab section
because it ends up in the .reloc section instead }
if DLLSource and RelocSection then
StabsSec.addsymreloc(curraddr-4,ps,RELOC_RVA)
else
StabsSec.addsymreloc(curraddr-4,ps,RELOC_ABSOLUTE);
end;
end;
end;

View File

@ -671,7 +671,12 @@ implementation
stab.nvalue:=offset;
stabssec.write(stab,sizeof(stab));
if assigned(ps) then
stabssec.addsymreloc(stabssec.Size-4,ps,RELOC_ABSOLUTE);
begin
if ps.bind=AB_LOCAL then
stabssec.addsectionreloc(stabssec.Size-4,ps.Objsection,RELOC_ABSOLUTE)
else
stabssec.addsymreloc(stabssec.Size-4,ps,RELOC_ABSOLUTE);
end;
end;