mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-01 13:22:37 +02:00
* Function RelocName made a member of TElfTarget, so it can be used outside of TElfExeOutput class.
* Methods ReportNonDSOReloc and ReportRelocOverflow moved to TElfExeOutput, they are applicable to all target-specific descendants. git-svn-id: trunk@23094 -
This commit is contained in:
parent
5adb28a935
commit
c4d8396158
@ -122,6 +122,11 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function elf_i386_relocname(reltyp:byte):string;
|
||||||
|
begin
|
||||||
|
result:='TODO';
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TElfExeOutput386
|
TElfExeOutput386
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -464,6 +469,7 @@ implementation
|
|||||||
exe_image_base: $8048000;
|
exe_image_base: $8048000;
|
||||||
machine_code: EM_386;
|
machine_code: EM_386;
|
||||||
relocs_use_addend: false;
|
relocs_use_addend: false;
|
||||||
|
relocname: @elf_i386_relocName;
|
||||||
encodereloc: @elf_i386_encodeReloc;
|
encodereloc: @elf_i386_encodeReloc;
|
||||||
loadreloc: @elf_i386_loadReloc;
|
loadreloc: @elf_i386_loadReloc;
|
||||||
loadsection: nil;
|
loadsection: nil;
|
||||||
|
@ -144,6 +144,7 @@ interface
|
|||||||
class function CanReadObjData(AReader:TObjectreader):boolean;override;
|
class function CanReadObjData(AReader:TObjectreader):boolean;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TRelocNameProc=function(reltyp:byte):string;
|
||||||
TEncodeRelocProc=function(objrel:TObjRelocation):byte;
|
TEncodeRelocProc=function(objrel:TObjRelocation):byte;
|
||||||
TLoadRelocProc=procedure(objrel:TObjRelocation);
|
TLoadRelocProc=procedure(objrel:TObjRelocation);
|
||||||
TLoadSectionProc=function(objinput:TElfObjInput;objdata:TObjData;const shdr:TElfsechdr;shindex:longint):boolean;
|
TLoadSectionProc=function(objinput:TElfObjInput;objdata:TObjData;const shdr:TElfsechdr;shindex:longint):boolean;
|
||||||
@ -153,6 +154,7 @@ interface
|
|||||||
exe_image_base: longword;
|
exe_image_base: longword;
|
||||||
machine_code: word;
|
machine_code: word;
|
||||||
relocs_use_addend: boolean;
|
relocs_use_addend: boolean;
|
||||||
|
relocname: TRelocNameProc;
|
||||||
encodereloc: TEncodeRelocProc;
|
encodereloc: TEncodeRelocProc;
|
||||||
loadreloc: TLoadRelocProc;
|
loadreloc: TLoadRelocProc;
|
||||||
loadsection: TLoadSectionProc;
|
loadsection: TLoadSectionProc;
|
||||||
@ -246,6 +248,8 @@ interface
|
|||||||
procedure WritePLTEntry(exesym:TExeSymbol);virtual;
|
procedure WritePLTEntry(exesym:TExeSymbol);virtual;
|
||||||
procedure WriteIndirectPLTEntry(exesym:TExeSymbol);virtual;
|
procedure WriteIndirectPLTEntry(exesym:TExeSymbol);virtual;
|
||||||
procedure GOTRelocPass1(objsec:TObjSection;var idx:longint);virtual;abstract;
|
procedure GOTRelocPass1(objsec:TObjSection;var idx:longint);virtual;abstract;
|
||||||
|
procedure ReportNonDSOReloc(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
||||||
|
procedure ReportRelocOverflow(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
||||||
public
|
public
|
||||||
constructor Create;override;
|
constructor Create;override;
|
||||||
destructor Destroy;override;
|
destructor Destroy;override;
|
||||||
@ -2814,6 +2818,20 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TElfExeOutput.ReportNonDSOReloc(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
||||||
|
begin
|
||||||
|
{ TODO: include objsec properties into message }
|
||||||
|
Comment(v_error,'Relocation '+ElfTarget.RelocName(reltyp)+' against '''+objreloc.TargetName+''' cannot be used when linking a shared object; recompile with -Cg');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TElfExeOutput.ReportRelocOverflow(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
||||||
|
begin
|
||||||
|
{ TODO: include objsec properties into message }
|
||||||
|
Comment(v_error,'Relocation truncated to fit: '+ElfTarget.RelocName(reltyp)+' against '''+objreloc.TargetName+'''');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TElfExeSection
|
TElfExeSection
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
@ -80,6 +80,12 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function elf_sparc_relocname(reltyp:byte):string;
|
||||||
|
begin
|
||||||
|
result:='TODO';
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure elf_sparc.loadreloc(objrel:TObjRelocation);
|
procedure elf_sparc.loadreloc(objrel:TObjRelocation);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
@ -97,6 +103,7 @@ implementation
|
|||||||
exe_image_base: $8000; // fixme
|
exe_image_base: $8000; // fixme
|
||||||
machine_code: EM_SPARC;
|
machine_code: EM_SPARC;
|
||||||
relocs_use_addend: false;
|
relocs_use_addend: false;
|
||||||
|
relocname: @elf_sparc_relocName;
|
||||||
encodereloc: @elf_sparc_encodeReloc;
|
encodereloc: @elf_sparc_encodeReloc;
|
||||||
loadreloc: @elf_sparc_loadReloc;
|
loadreloc: @elf_sparc_loadReloc;
|
||||||
loadsection: nil;
|
loadsection: nil;
|
||||||
|
@ -35,10 +35,7 @@ implementation
|
|||||||
type
|
type
|
||||||
TElfExeOutputx86_64=class(TElfExeOutput)
|
TElfExeOutputx86_64=class(TElfExeOutput)
|
||||||
private
|
private
|
||||||
function RelocName(reltyp:byte):string;
|
|
||||||
procedure MaybeWriteGOTEntry(reltyp:byte;relocval:aint;objsym:TObjSymbol);
|
procedure MaybeWriteGOTEntry(reltyp:byte;relocval:aint;objsym:TObjSymbol);
|
||||||
procedure ReportNonDSOReloc(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
|
||||||
procedure ReportRelocOverflow(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
|
||||||
protected
|
protected
|
||||||
procedure WriteFirstPLTEntry;override;
|
procedure WriteFirstPLTEntry;override;
|
||||||
procedure WritePLTEntry(exesym:TExeSymbol);override;
|
procedure WritePLTEntry(exesym:TExeSymbol);override;
|
||||||
@ -185,11 +182,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
function elf_x86_64_relocname(reltyp:byte):string;
|
||||||
TELFExeOutputx86_64
|
|
||||||
****************************************************************************}
|
|
||||||
|
|
||||||
function TElfExeOutputx86_64.RelocName(reltyp:byte):string;
|
|
||||||
begin
|
begin
|
||||||
if reltyp<=high(relocprops) then
|
if reltyp<=high(relocprops) then
|
||||||
result:=relocprops[reltyp].name
|
result:=relocprops[reltyp].name
|
||||||
@ -197,20 +190,9 @@ implementation
|
|||||||
result:='unknown ('+tostr(reltyp)+')';
|
result:='unknown ('+tostr(reltyp)+')';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{****************************************************************************
|
||||||
procedure TElfExeOutputx86_64.ReportNonDSOReloc(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
TELFExeOutputx86_64
|
||||||
begin
|
****************************************************************************}
|
||||||
{ TODO: include objsec properties into message }
|
|
||||||
Comment(v_error,'Relocation '+RelocName(reltyp)+' against '''+objreloc.TargetName+''' cannot be used when linking a shared object; recompile with -Cg');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TElfExeOutputx86_64.ReportRelocOverflow(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation);
|
|
||||||
begin
|
|
||||||
{ TODO: include objsec properties into message }
|
|
||||||
Comment(v_error,'Relocation truncated to fit: '+RelocName(reltyp)+' against '''+objreloc.TargetName+'''');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TElfExeOutputx86_64.GOTRelocPass1(objsec:TObjSection;var idx:longint);
|
procedure TElfExeOutputx86_64.GOTRelocPass1(objsec:TObjSection;var idx:longint);
|
||||||
var
|
var
|
||||||
@ -595,6 +577,7 @@ implementation
|
|||||||
exe_image_base: $400000;
|
exe_image_base: $400000;
|
||||||
machine_code: EM_X86_64;
|
machine_code: EM_X86_64;
|
||||||
relocs_use_addend: true;
|
relocs_use_addend: true;
|
||||||
|
relocname: @elf_x86_64_relocName;
|
||||||
encodereloc: @elf_x86_64_encodeReloc;
|
encodereloc: @elf_x86_64_encodeReloc;
|
||||||
loadreloc: @elf_x86_64_loadReloc;
|
loadreloc: @elf_x86_64_loadReloc;
|
||||||
loadsection: nil;
|
loadsection: nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user