* Fixed stabs generation for DLLs by internal assembler (use RELOC_ABSOLUTE in all cases).

* Do not generate relocs by internal linker for sections which are not loaded in memory.

git-svn-id: trunk@7829 -
This commit is contained in:
yury 2007-06-26 22:51:21 +00:00
parent c00021373a
commit 04147151e4
2 changed files with 7 additions and 10 deletions

View File

@ -796,7 +796,6 @@ Implementation
pcurr, pcurr,
pendquote : pchar; pendquote : pchar;
oldsec : TObjSection; oldsec : TObjSection;
reltype : TObjRelocationType;
begin begin
pcurr:=nil; pcurr:=nil;
pstr:=nil; pstr:=nil;
@ -885,13 +884,7 @@ Implementation
oldsec:=ObjData.CurrObjSec; oldsec:=ObjData.CurrObjSec;
ObjData.SetSection(ObjData.StabsSec); ObjData.SetSection(ObjData.StabsSec);
ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4); ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4);
if assigned(relocsym) and ObjData.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE);
(target_info.system in system_windows+system_wince) and
(DLLSource and RelocSection) then
reltype:=RELOC_RVA
else
reltype:=RELOC_ABSOLUTE;
ObjData.Writereloc(stab.nvalue,4,relocsym,reltype);
ObjData.setsection(oldsec); ObjData.setsection(oldsec);
end; end;
if assigned(pendquote) then if assigned(pendquote) then

View File

@ -1501,7 +1501,6 @@ const pemagic : array[0..3] of byte = (
rel_type : TObjRelocationType; rel_type : TObjRelocationType;
i : longint; i : longint;
p : TObjSymbol; p : TObjSymbol;
extradist : longint;
begin begin
for i:=1 to s.coffrelocs do for i:=1 to s.coffrelocs do
begin begin
@ -2532,12 +2531,17 @@ const pemagic : array[0..3] of byte = (
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]);
{ create relocs only for sections which are loaded in memory }
if not (oso_load in objsec.SecOptions) then
continue;
for k:=0 to objsec.ObjRelocations.Count-1 do for k:=0 to objsec.ObjRelocations.Count-1 do
begin begin
objreloc:=TObjRelocation(objsec.ObjRelocations[k]); objreloc:=TObjRelocation(objsec.ObjRelocations[k]);
if not (objreloc.typ in [{$ifdef x86_64}RELOC_ABSOLUTE32,{$endif x86_64}RELOC_ABSOLUTE]) then if not (objreloc.typ in [{$ifdef x86_64}RELOC_ABSOLUTE32,{$endif x86_64}RELOC_ABSOLUTE]) then
continue; continue;
offset:=objsec.MemPos+objreloc.dataoffset; offset:=objsec.MemPos+objreloc.dataoffset;
if offset<pgaddr then
Internalerror(2007062701);
if (offset-pgaddr>=4096) or (pgaddr=-1) then if (offset-pgaddr>=4096) or (pgaddr=-1) then
begin begin
FinishBlock; FinishBlock;
@ -2566,7 +2570,7 @@ const pemagic : array[0..3] of byte = (
exesec:=FindExeSection('.reloc'); exesec:=FindExeSection('.reloc');
if exesec=nil then if exesec=nil then
exit; exit;
exesec.SecOptions:=exesec.SecOptions + [oso_Data,oso_keep]; exesec.SecOptions:=exesec.SecOptions + [oso_Data,oso_keep,oso_load];
end; end;