mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 02:49:28 +02:00
+ introduced a new type TRelocDataInt for use as the 'data' parameter for
TObjData.writeReloc; on i8086 it was changed to longint to allow using 32-bit relocations + added support for writing 32-bit OMF relocations git-svn-id: trunk@32936 -
This commit is contained in:
parent
4f8baf29c6
commit
db5e67c3fe
@ -307,6 +307,14 @@ interface
|
|||||||
Owner: TObjData;
|
Owner: TObjData;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef i8086}
|
||||||
|
{ on i8086 we use a longint, to support 32-bit relocations as well (e.g.
|
||||||
|
for allowing 386+ instructions with 32-bit addresses in inline asm code) }
|
||||||
|
TRelocDataInt = longint;
|
||||||
|
{$else i8086}
|
||||||
|
TRelocDataInt = aint;
|
||||||
|
{$endif i8086}
|
||||||
|
|
||||||
TObjData = class(TLinkedListItem)
|
TObjData = class(TLinkedListItem)
|
||||||
private
|
private
|
||||||
FCurrObjSec : TObjSection;
|
FCurrObjSec : TObjSection;
|
||||||
@ -357,7 +365,7 @@ interface
|
|||||||
procedure alloc(len:aword);
|
procedure alloc(len:aword);
|
||||||
procedure allocalign(len:shortint);
|
procedure allocalign(len:shortint);
|
||||||
procedure writebytes(const Data;len:aword);
|
procedure writebytes(const Data;len:aword);
|
||||||
procedure writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);virtual;abstract;
|
procedure writeReloc(Data:TRelocDataInt;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);virtual;abstract;
|
||||||
procedure beforealloc;virtual;
|
procedure beforealloc;virtual;
|
||||||
procedure beforewrite;virtual;
|
procedure beforewrite;virtual;
|
||||||
procedure afteralloc;virtual;
|
procedure afteralloc;virtual;
|
||||||
|
@ -105,7 +105,7 @@ interface
|
|||||||
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
||||||
function createsection(atype:TAsmSectionType;const aname:string='';aorder:TAsmSectionOrder=secorder_default):TObjSection;override;
|
function createsection(atype:TAsmSectionType;const aname:string='';aorder:TAsmSectionOrder=secorder_default):TObjSection;override;
|
||||||
function reffardatasection:TObjSection;
|
function reffardatasection:TObjSection;
|
||||||
procedure writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);override;
|
procedure writeReloc(Data:TRelocDataInt;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TOmfObjOutput }
|
{ TOmfObjOutput }
|
||||||
@ -358,21 +358,23 @@ implementation
|
|||||||
if ObjSection<>nil then
|
if ObjSection<>nil then
|
||||||
begin
|
begin
|
||||||
FOmfFixup.LocationOffset:=DataOffset;
|
FOmfFixup.LocationOffset:=DataOffset;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_RELATIVE] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_RELATIVE16] then
|
||||||
FOmfFixup.LocationType:=fltOffset
|
FOmfFixup.LocationType:=fltOffset
|
||||||
|
else if typ in [RELOC_ABSOLUTE32,RELOC_RELATIVE32] then
|
||||||
|
FOmfFixup.LocationType:=fltOffset32
|
||||||
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
||||||
FOmfFixup.LocationType:=fltBase
|
FOmfFixup.LocationType:=fltBase
|
||||||
else
|
else
|
||||||
internalerror(2015041501);
|
internalerror(2015041501);
|
||||||
FOmfFixup.FrameDeterminedByThread:=False;
|
FOmfFixup.FrameDeterminedByThread:=False;
|
||||||
FOmfFixup.TargetDeterminedByThread:=False;
|
FOmfFixup.TargetDeterminedByThread:=False;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_SEG] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG] then
|
||||||
FOmfFixup.Mode:=fmSegmentRelative
|
FOmfFixup.Mode:=fmSegmentRelative
|
||||||
else if typ in [RELOC_RELATIVE,RELOC_SEGREL] then
|
else if typ in [RELOC_RELATIVE16,RELOC_RELATIVE32,RELOC_SEGREL] then
|
||||||
FOmfFixup.Mode:=fmSelfRelative
|
FOmfFixup.Mode:=fmSelfRelative
|
||||||
else
|
else
|
||||||
internalerror(2015041401);
|
internalerror(2015041401);
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_RELATIVE] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_RELATIVE16,RELOC_RELATIVE32] then
|
||||||
begin
|
begin
|
||||||
FOmfFixup.TargetMethod:=ftmSegmentIndexNoDisp;
|
FOmfFixup.TargetMethod:=ftmSegmentIndexNoDisp;
|
||||||
FOmfFixup.TargetDatum:=ObjSection.Index;
|
FOmfFixup.TargetDatum:=ObjSection.Index;
|
||||||
@ -402,17 +404,19 @@ implementation
|
|||||||
else if symbol<>nil then
|
else if symbol<>nil then
|
||||||
begin
|
begin
|
||||||
FOmfFixup.LocationOffset:=DataOffset;
|
FOmfFixup.LocationOffset:=DataOffset;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_RELATIVE] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_RELATIVE16] then
|
||||||
FOmfFixup.LocationType:=fltOffset
|
FOmfFixup.LocationType:=fltOffset
|
||||||
|
else if typ in [RELOC_ABSOLUTE32,RELOC_RELATIVE32] then
|
||||||
|
FOmfFixup.LocationType:=fltOffset32
|
||||||
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
||||||
FOmfFixup.LocationType:=fltBase
|
FOmfFixup.LocationType:=fltBase
|
||||||
else
|
else
|
||||||
internalerror(2015041501);
|
internalerror(2015041501);
|
||||||
FOmfFixup.FrameDeterminedByThread:=False;
|
FOmfFixup.FrameDeterminedByThread:=False;
|
||||||
FOmfFixup.TargetDeterminedByThread:=False;
|
FOmfFixup.TargetDeterminedByThread:=False;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_SEG] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG] then
|
||||||
FOmfFixup.Mode:=fmSegmentRelative
|
FOmfFixup.Mode:=fmSegmentRelative
|
||||||
else if typ in [RELOC_RELATIVE,RELOC_SEGREL] then
|
else if typ in [RELOC_RELATIVE16,RELOC_RELATIVE32,RELOC_SEGREL] then
|
||||||
FOmfFixup.Mode:=fmSelfRelative
|
FOmfFixup.Mode:=fmSelfRelative
|
||||||
else
|
else
|
||||||
internalerror(2015041401);
|
internalerror(2015041401);
|
||||||
@ -423,17 +427,19 @@ implementation
|
|||||||
else if group<>nil then
|
else if group<>nil then
|
||||||
begin
|
begin
|
||||||
FOmfFixup.LocationOffset:=DataOffset;
|
FOmfFixup.LocationOffset:=DataOffset;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_RELATIVE] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_RELATIVE16] then
|
||||||
FOmfFixup.LocationType:=fltOffset
|
FOmfFixup.LocationType:=fltOffset
|
||||||
|
else if typ in [RELOC_ABSOLUTE32,RELOC_RELATIVE32] then
|
||||||
|
FOmfFixup.LocationType:=fltOffset32
|
||||||
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
else if typ in [RELOC_SEG,RELOC_SEGREL] then
|
||||||
FOmfFixup.LocationType:=fltBase
|
FOmfFixup.LocationType:=fltBase
|
||||||
else
|
else
|
||||||
internalerror(2015041501);
|
internalerror(2015041501);
|
||||||
FOmfFixup.FrameDeterminedByThread:=False;
|
FOmfFixup.FrameDeterminedByThread:=False;
|
||||||
FOmfFixup.TargetDeterminedByThread:=False;
|
FOmfFixup.TargetDeterminedByThread:=False;
|
||||||
if typ in [RELOC_ABSOLUTE,RELOC_SEG] then
|
if typ in [RELOC_ABSOLUTE16,RELOC_ABSOLUTE32,RELOC_SEG] then
|
||||||
FOmfFixup.Mode:=fmSegmentRelative
|
FOmfFixup.Mode:=fmSegmentRelative
|
||||||
else if typ in [RELOC_RELATIVE,RELOC_SEGREL] then
|
else if typ in [RELOC_RELATIVE16,RELOC_RELATIVE32,RELOC_SEGREL] then
|
||||||
FOmfFixup.Mode:=fmSelfRelative
|
FOmfFixup.Mode:=fmSelfRelative
|
||||||
else
|
else
|
||||||
internalerror(2015041401);
|
internalerror(2015041401);
|
||||||
@ -564,7 +570,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOmfObjData.writeReloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
|
procedure TOmfObjData.writeReloc(Data:TRelocDataInt;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
|
||||||
var
|
var
|
||||||
objreloc: TOmfRelocation;
|
objreloc: TOmfRelocation;
|
||||||
symaddr: AWord;
|
symaddr: AWord;
|
||||||
|
@ -2654,7 +2654,7 @@ implementation
|
|||||||
objdata.writebytes(b67,1);
|
objdata.writebytes(b67,1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure objdata_writereloc(Data:aint;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
|
procedure objdata_writereloc(Data:TRelocDataInt;len:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
|
||||||
begin
|
begin
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{ Special case of '_GLOBAL_OFFSET_TABLE_'
|
{ Special case of '_GLOBAL_OFFSET_TABLE_'
|
||||||
|
Loading…
Reference in New Issue
Block a user