mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 08:51:10 +02:00
+ actually produce relocations in TRelObjData.writeReloc
git-svn-id: trunk@45251 -
This commit is contained in:
parent
256597be58
commit
ab878adfff
@ -156,18 +156,51 @@ implementation
|
|||||||
procedure TRelObjData.writeReloc(Data: TRelocDataInt; len: aword; p: TObjSymbol; Reloctype: TObjRelocationType);
|
procedure TRelObjData.writeReloc(Data: TRelocDataInt; len: aword; p: TObjSymbol; Reloctype: TObjRelocationType);
|
||||||
var
|
var
|
||||||
bytes: array [0..1] of Byte;
|
bytes: array [0..1] of Byte;
|
||||||
|
symaddr: QWord;
|
||||||
|
objreloc: TObjRelocation;
|
||||||
begin
|
begin
|
||||||
if len=2 then
|
if CurrObjSec=nil then
|
||||||
|
internalerror(200403072);
|
||||||
|
objreloc:=nil;
|
||||||
|
if assigned(p) then
|
||||||
begin
|
begin
|
||||||
bytes[0]:=Byte(Data);
|
{ real address of the symbol }
|
||||||
bytes[1]:=Byte(Data shr 8);
|
symaddr:=p.address;
|
||||||
writebytes(bytes,2);
|
|
||||||
end
|
if p.bind=AB_EXTERNAL then
|
||||||
else if len=1 then
|
begin
|
||||||
begin
|
objreloc:=TObjRelocation.CreateSymbol(CurrObjSec.Size,p,Reloctype);
|
||||||
bytes[0]:=Byte(Data);
|
CurrObjSec.ObjRelocations.Add(objreloc);
|
||||||
writebytes(bytes,1);
|
end
|
||||||
|
{ relative relocations within the same section can be calculated directly,
|
||||||
|
without the need to emit a relocation entry }
|
||||||
|
else if (p.objsection=CurrObjSec) and
|
||||||
|
(p.bind<>AB_COMMON) and
|
||||||
|
(Reloctype=RELOC_RELATIVE) then
|
||||||
|
begin
|
||||||
|
data:=data+symaddr-len-CurrObjSec.Size;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
objreloc:=TObjRelocation.CreateSection(CurrObjSec.Size,p.objsection,Reloctype);
|
||||||
|
CurrObjSec.ObjRelocations.Add(objreloc);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
case len of
|
||||||
|
2:
|
||||||
|
begin
|
||||||
|
bytes[0]:=Byte(Data);
|
||||||
|
bytes[1]:=Byte(Data shr 8);
|
||||||
|
writebytes(bytes,2);
|
||||||
|
end;
|
||||||
|
1:
|
||||||
|
begin
|
||||||
|
bytes[0]:=Byte(Data);
|
||||||
|
writebytes(bytes,1);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2020050423);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user