mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 01:09:27 +02:00
+ implemented support for the 'dgroup' (addr_dgroup) relocation type in the omf
internal object writer git-svn-id: trunk@30800 -
This commit is contained in:
parent
37840bc811
commit
0da38dbc79
compiler
@ -70,6 +70,8 @@ interface
|
||||
RELOC_FARPTR,
|
||||
RELOC_SEG,
|
||||
RELOC_SEGREL,
|
||||
RELOC_DGROUP,
|
||||
RELOC_DGROUPREL,
|
||||
{$endif i8086}
|
||||
{$ifdef arm}
|
||||
RELOC_RELATIVE_24,
|
||||
|
@ -48,6 +48,7 @@ interface
|
||||
FOmfFixup: TOmfSubRecord_FIXUP;
|
||||
function GetGroupIndex(const groupname: string): Integer;
|
||||
public
|
||||
constructor CreateSection(ADataOffset:aword;aobjsec:TObjSection;Atyp:TObjRelocationType);
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure BuildOmfFixup;
|
||||
@ -142,6 +143,17 @@ implementation
|
||||
internalerror(2014040703);
|
||||
end;
|
||||
|
||||
constructor TOmfRelocation.CreateSection(ADataOffset: aword; aobjsec: TObjSection; Atyp: TObjRelocationType);
|
||||
begin
|
||||
if not (Atyp in [RELOC_DGROUP,RELOC_DGROUPREL]) and not assigned(aobjsec) then
|
||||
internalerror(200603036);
|
||||
DataOffset:=ADataOffset;
|
||||
Symbol:=nil;
|
||||
OrgSize:=0;
|
||||
ObjSection:=aobjsec;
|
||||
ftype:=ord(Atyp);
|
||||
end;
|
||||
|
||||
destructor TOmfRelocation.Destroy;
|
||||
begin
|
||||
FOmfFixup.Free;
|
||||
@ -150,6 +162,7 @@ implementation
|
||||
|
||||
procedure TOmfRelocation.BuildOmfFixup;
|
||||
begin
|
||||
Writeln(typ, ' ', ObjSection<>nil, ' ', symbol<>nil);
|
||||
FreeAndNil(FOmfFixup);
|
||||
FOmfFixup:=TOmfSubRecord_FIXUP.Create;
|
||||
if ObjSection<>nil then
|
||||
@ -219,6 +232,22 @@ implementation
|
||||
FOmfFixup.TargetDatum:=symbol.symidx;
|
||||
FOmfFixup.FrameMethod:=ffmTarget;
|
||||
end
|
||||
else if typ in [RELOC_DGROUP,RELOC_DGROUPREL] then
|
||||
begin
|
||||
FOmfFixup.LocationOffset:=DataOffset;
|
||||
FOmfFixup.LocationType:=fltBase;
|
||||
FOmfFixup.FrameDeterminedByThread:=False;
|
||||
FOmfFixup.TargetDeterminedByThread:=False;
|
||||
if typ=RELOC_DGROUP then
|
||||
FOmfFixup.Mode:=fmSegmentRelative
|
||||
else if typ=RELOC_DGROUPREL then
|
||||
FOmfFixup.Mode:=fmSelfRelative
|
||||
else
|
||||
internalerror(2015041401);
|
||||
FOmfFixup.FrameMethod:=ffmTarget;
|
||||
FOmfFixup.TargetMethod:=ftmGroupIndexNoDisp;
|
||||
FOmfFixup.TargetDatum:=GetGroupIndex('dgroup');
|
||||
end
|
||||
else
|
||||
internalerror(2015040702);
|
||||
end;
|
||||
@ -423,6 +452,7 @@ implementation
|
||||
objreloc: TOmfRelocation;
|
||||
symaddr: AWord;
|
||||
begin
|
||||
Writeln(Reloctype);
|
||||
{ RELOC_FARPTR = RELOC_ABSOLUTE+RELOC_SEG }
|
||||
if Reloctype=RELOC_FARPTR then
|
||||
begin
|
||||
@ -452,7 +482,12 @@ implementation
|
||||
CurrObjSec.ObjRelocations.Add(objreloc);
|
||||
inc(data,symaddr);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else if Reloctype in [RELOC_DGROUP,RELOC_DGROUPREL] then
|
||||
begin
|
||||
objreloc:=TOmfRelocation.CreateSection(CurrObjSec.Size,nil,Reloctype);
|
||||
CurrObjSec.ObjRelocations.Add(objreloc);
|
||||
end;
|
||||
CurrObjSec.write(data,len);
|
||||
end;
|
||||
|
||||
|
@ -2554,6 +2554,12 @@ implementation
|
||||
currabsreloc:=RELOC_SEG;
|
||||
currabsreloc32:=RELOC_SEG;
|
||||
end
|
||||
else if oper[opidx]^.ref^.refaddr=addr_dgroup then
|
||||
begin
|
||||
currrelreloc:=RELOC_DGROUPREL;
|
||||
currabsreloc:=RELOC_DGROUP;
|
||||
currabsreloc32:=RELOC_DGROUP;
|
||||
end
|
||||
else
|
||||
{$endif i8086}
|
||||
{$ifdef i386}
|
||||
@ -2903,7 +2909,11 @@ implementation
|
||||
if (currval<-65536) or (currval>65535) then
|
||||
Message2(asmw_e_value_exceeds_bounds,'word',tostr(currval));
|
||||
{$endif i8086}
|
||||
if assigned(currsym) then
|
||||
if assigned(currsym)
|
||||
{$ifdef i8086}
|
||||
or (currabsreloc=RELOC_DGROUP)
|
||||
{$endif i8086}
|
||||
then
|
||||
objdata_writereloc(currval,2,currsym,currabsreloc)
|
||||
else
|
||||
objdata.writebytes(currval,2);
|
||||
|
Loading…
Reference in New Issue
Block a user