* Fixed a bug introduced in r23077: relative_reloc_count must be increased only once per GOT entry, not every time a relocation to that entry is seen.

git-svn-id: trunk@23126 -
This commit is contained in:
sergei 2012-12-09 06:39:43 +00:00
parent 4ab7c432c0
commit a771d68685
2 changed files with 7 additions and 5 deletions

View File

@ -244,7 +244,7 @@ interface
dynreloclist: TFPObjectList;
tlsseg: TElfSegment;
relative_reloc_count: longint;
procedure AllocGOTSlot(objsym: TObjSymbol);
function AllocGOTSlot(objsym: TObjSymbol):boolean;
procedure WriteDynRelocEntry(dataofs:aword;typ:byte;symidx:aword;addend:aword);
procedure WriteFirstPLTEntry;virtual;abstract;
procedure WritePLTEntry(exesym:TExeSymbol);virtual;
@ -1994,10 +1994,11 @@ implementation
end;
procedure TElfExeOutput.AllocGOTSlot(objsym:TObjSymbol);
function TElfExeOutput.AllocGOTSlot(objsym:TObjSymbol):boolean;
var
exesym: TExeSymbol;
begin
result:=false;
exesym:=objsym.exesymbol;
{ Although local symbols should not be accessed through GOT,
@ -2019,6 +2020,7 @@ implementation
only the latter applies. }
if IsSharedLibrary or (exesym.dynindex>0) then
dynrelocsec.alloc(dynrelocsec.shentsize);
result:=true;
end;

View File

@ -241,9 +241,9 @@ implementation
R_X86_64_GOTPCREL,
R_X86_64_GOTPCREL64:
begin
AllocGOTSlot(objreloc.symbol);
if IsSharedLibrary and (objreloc.symbol.exesymbol.dynindex=0) then
Inc(relative_reloc_count);
if AllocGOTSlot(objreloc.symbol) then
if IsSharedLibrary and (objreloc.symbol.exesymbol.dynindex=0) then
Inc(relative_reloc_count);
end;
//R_X86_64_TLSGD,