Package net.fornwall.jelf
Class ElfRelocationAddend
java.lang.Object
net.fornwall.jelf.ElfRelocationAddend
Relocation is the process of connecting symbolic references with symbolic definitions.
For example, when a program calls a function, the associated call instruction must transfer
control to the proper destination address at execution. Relocatable files must have
information that describes how to modify their section contents. This information allows
executable and shared object files to hold the right information for a process's program
image. Relocation entries are these data.
These elf relocation entries can be obtained from ElfRelocationAddend:s.
Corresponds to the below C structs:
typedef struct {
Elf32_Addr r_offset;
uint32_t r_info;
int32_t r_addend;
} Elf32_Rela;
typedef struct {
Elf64_Addr r_offset;
uint64_t r_info;
int64_t r_addend;
} Elf64_Rela;
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal longThis member specifies a constant addend used to compute the value to be stored into the relocatable field.final longThis member gives both the symbol table index with respect to which the relocation must be made and the type of relocation to apply.final longThis member gives the location at which to apply the relocation action. -
Method Summary
Modifier and TypeMethodDescriptionThe symbol table index, with respect to which the relocation must be made.intThe symbol table index, with respect to which the relocation must be made.longgetType()Corresponds to the ELF32_R_TYPE / ELF64_R_TYPE macros.
-
Field Details
-
r_offset
public final long r_offsetThis member gives the location at which to apply the relocation action. For a relocatable file, the value is the byte offset from the beginning of the section to the storage unit affected by the relocation. For an executable file or shared object, the value is the virtual address of the storage unit affected by the relocation. -
r_info
public final long r_infoThis member gives both the symbol table index with respect to which the relocation must be made and the type of relocation to apply. Relocation types are processor- specific. When the text refers to a relocation entry's relocation type or symbol table index, it means the result of applying ELF[32|64]_R_TYPE or ELF[32|64]_R_SYM, respectively, to the entry's r_info member. -
r_addend
public final long r_addendThis member specifies a constant addend used to compute the value to be stored into the relocatable field.
-
-
Method Details
-
getType
public long getType()Corresponds to the ELF32_R_TYPE / ELF64_R_TYPE macros.- See Also:
-
getSymbolIndex
public int getSymbolIndex()The symbol table index, with respect to which the relocation must be made. UsegetSymbol()to get the resolvedElfSymbolfrom this index.Corresponds to the ELF32_R_SYM / ELF64_R_SYM macros.
-
getSymbol
The symbol table index, with respect to which the relocation must be made. UsegetSymbolIndex()} to get the resolvedElfSymbolfrom this index.
-