+ Added codes of dynamic relocations to TElfTarget; since most targets use similar dynamic relocation model differing only in code values, this will allow to do majority of handling in the base class.

git-svn-id: trunk@23154 -
This commit is contained in:
sergei 2012-12-16 09:36:34 +00:00
parent c37c039905
commit 0aa7204707
4 changed files with 30 additions and 1 deletions

View File

@ -469,6 +469,13 @@ implementation
exe_image_base: $8048000;
machine_code: EM_386;
relocs_use_addend: false;
dyn_reloc_codes: (
R_386_RELATIVE,
R_386_GLOB_DAT,
R_386_JUMP_SLOT,
R_386_COPY,
R_386_IRELATIVE
);
relocname: @elf_i386_relocName;
encodereloc: @elf_i386_encodeReloc;
loadreloc: @elf_i386_loadReloc;

View File

@ -150,12 +150,20 @@ interface
TEncodeRelocProc=function(objrel:TObjRelocation):byte;
TLoadRelocProc=procedure(objrel:TObjRelocation);
TLoadSectionProc=function(objinput:TElfObjInput;objdata:TObjData;const shdr:TElfsechdr;shindex:longint):boolean;
TDynamicReloc=(
dr_relative,
dr_glob_dat,
dr_jump_slot,
dr_copy,
dr_irelative
);
TElfTarget=record
max_page_size: longword;
exe_image_base: longword;
machine_code: word;
relocs_use_addend: boolean;
dyn_reloc_codes: array[TDynamicReloc] of byte;
relocname: TRelocNameProc;
encodereloc: TEncodeRelocProc;
loadreloc: TLoadRelocProc;
@ -2805,7 +2813,6 @@ implementation
procedure TElfExeOutput.GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);
var
i:longint;
exportlist: TCmdStrList;
sym: TExeSymbol;
begin

View File

@ -103,6 +103,13 @@ implementation
exe_image_base: $8000; // fixme
machine_code: EM_SPARC;
relocs_use_addend: false;
dyn_reloc_codes: (
R_SPARC_RELATIVE,
R_SPARC_GLOB_DAT,
R_SPARC_JUMP_SLOT,
R_SPARC_COPY,
0 // IRELATIVE is absent(?)
);
relocname: @elf_sparc_relocName;
encodereloc: @elf_sparc_encodeReloc;
loadreloc: @elf_sparc_loadReloc;

View File

@ -393,6 +393,7 @@ implementation
R_X86_64_PC32,
R_X86_64_PC64:
begin
// TODO: ld rejects PC32 relocations to dynamic symbols, they must use @PLT
address:=address+relocval-PC;
end;
@ -577,6 +578,13 @@ implementation
exe_image_base: $400000;
machine_code: EM_X86_64;
relocs_use_addend: true;
dyn_reloc_codes: (
R_X86_64_RELATIVE,
R_X86_64_GLOB_DAT,
R_X86_64_JUMP_SLOT,
R_X86_64_COPY,
R_X86_64_IRELATIVE
);
relocname: @elf_x86_64_relocName;
encodereloc: @elf_x86_64_encodeReloc;
loadreloc: @elf_x86_64_loadReloc;