diff --git a/compiler/i386/cpuelf.pas b/compiler/i386/cpuelf.pas index 12e65ad8ed..3f6e278195 100644 --- a/compiler/i386/cpuelf.pas +++ b/compiler/i386/cpuelf.pas @@ -122,6 +122,11 @@ implementation end; + function elf_i386_relocname(reltyp:byte):string; + begin + result:='TODO'; + end; + {**************************************************************************** TElfExeOutput386 ****************************************************************************} @@ -464,6 +469,7 @@ implementation exe_image_base: $8048000; machine_code: EM_386; relocs_use_addend: false; + relocname: @elf_i386_relocName; encodereloc: @elf_i386_encodeReloc; loadreloc: @elf_i386_loadReloc; loadsection: nil; diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index 5988842cf0..09a43a7436 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -144,6 +144,7 @@ interface class function CanReadObjData(AReader:TObjectreader):boolean;override; end; + TRelocNameProc=function(reltyp:byte):string; TEncodeRelocProc=function(objrel:TObjRelocation):byte; TLoadRelocProc=procedure(objrel:TObjRelocation); TLoadSectionProc=function(objinput:TElfObjInput;objdata:TObjData;const shdr:TElfsechdr;shindex:longint):boolean; @@ -153,6 +154,7 @@ interface exe_image_base: longword; machine_code: word; relocs_use_addend: boolean; + relocname: TRelocNameProc; encodereloc: TEncodeRelocProc; loadreloc: TLoadRelocProc; loadsection: TLoadSectionProc; @@ -246,6 +248,8 @@ interface procedure WritePLTEntry(exesym:TExeSymbol);virtual; procedure WriteIndirectPLTEntry(exesym:TExeSymbol);virtual; 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 constructor Create;override; destructor Destroy;override; @@ -2814,6 +2818,20 @@ implementation 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 ****************************************************************************} diff --git a/compiler/sparc/cpuelf.pas b/compiler/sparc/cpuelf.pas index 1ceeef8105..1b313e55b1 100644 --- a/compiler/sparc/cpuelf.pas +++ b/compiler/sparc/cpuelf.pas @@ -80,6 +80,12 @@ implementation end; + function elf_sparc_relocname(reltyp:byte):string; + begin + result:='TODO'; + end; + + procedure elf_sparc.loadreloc(objrel:TObjRelocation); begin end; @@ -97,6 +103,7 @@ implementation exe_image_base: $8000; // fixme machine_code: EM_SPARC; relocs_use_addend: false; + relocname: @elf_sparc_relocName; encodereloc: @elf_sparc_encodeReloc; loadreloc: @elf_sparc_loadReloc; loadsection: nil; diff --git a/compiler/x86_64/cpuelf.pas b/compiler/x86_64/cpuelf.pas index f8fcc90457..c7d676aa01 100644 --- a/compiler/x86_64/cpuelf.pas +++ b/compiler/x86_64/cpuelf.pas @@ -35,10 +35,7 @@ implementation type TElfExeOutputx86_64=class(TElfExeOutput) private - function RelocName(reltyp:byte):string; 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 procedure WriteFirstPLTEntry;override; procedure WritePLTEntry(exesym:TExeSymbol);override; @@ -185,11 +182,7 @@ implementation end; -{**************************************************************************** - TELFExeOutputx86_64 -****************************************************************************} - - function TElfExeOutputx86_64.RelocName(reltyp:byte):string; + function elf_x86_64_relocname(reltyp:byte):string; begin if reltyp<=high(relocprops) then result:=relocprops[reltyp].name @@ -197,20 +190,9 @@ implementation result:='unknown ('+tostr(reltyp)+')'; end; - - procedure TElfExeOutputx86_64.ReportNonDSOReloc(reltyp:byte;objsec:TObjSection;ObjReloc:TObjRelocation); - 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; - +{**************************************************************************** + TELFExeOutputx86_64 +****************************************************************************} procedure TElfExeOutputx86_64.GOTRelocPass1(objsec:TObjSection;var idx:longint); var @@ -595,6 +577,7 @@ implementation exe_image_base: $400000; machine_code: EM_X86_64; relocs_use_addend: true; + relocname: @elf_x86_64_relocName; encodereloc: @elf_x86_64_encodeReloc; loadreloc: @elf_x86_64_loadReloc; loadsection: nil;