Class ElfRelocationAddend

java.lang.Object
net.fornwall.jelf.ElfRelocationAddend

public final class ElfRelocationAddend extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    final long
    This member specifies a constant addend used to compute the value to be stored into the relocatable field.
    final long
    This member gives both the symbol table index with respect to which the relocation must be made and the type of relocation to apply.
    final long
    This member gives the location at which to apply the relocation action.
  • Method Summary

    Modifier and Type
    Method
    Description
    The symbol table index, with respect to which the relocation must be made.
    int
    The symbol table index, with respect to which the relocation must be made.
    long
    Corresponds to the ELF32_R_TYPE / ELF64_R_TYPE macros.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • r_offset

      public final long r_offset
      This 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_info
      This 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_addend
      This 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. Use getSymbol() to get the resolved ElfSymbol from this index.

      Corresponds to the ELF32_R_SYM / ELF64_R_SYM macros.

    • getSymbol

      public ElfSymbol getSymbol()
      The symbol table index, with respect to which the relocation must be made. Use getSymbolIndex()} to get the resolved ElfSymbol from this index.