* 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,
pendquote : pchar;
oldsec : TObjSection;
reltype : TObjRelocationType;
begin
pcurr:=nil;
pstr:=nil;
@ -885,13 +884,7 @@ Implementation
oldsec:=ObjData.CurrObjSec;
ObjData.SetSection(ObjData.StabsSec);
ObjData.Writebytes(stab,sizeof(TObjStabEntry)-4);
if assigned(relocsym) and
(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.Writereloc(stab.nvalue,4,relocsym,RELOC_ABSOLUTE);
ObjData.setsection(oldsec);
end;
if assigned(pendquote) then

View File

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