Next: , Previous: , Up: Top   [Contents][Index]


12 ELF Relocations

ELF supports two kind of relocations: relocations without addend (REL relocations) and relocations with addend (RELA relocations).

REL relocations are implemented by the Elf32_Rel and Elf64_Rel types. RELA relocations are implementd by the Elf32_Rela and Elf64_Rela types.

12.1 Overview

type Elf32_RelInfo =
  struct Elf_Word
    {
      uint<24> r_sym;
      uint<8> r_type;
    };

type Elf32_Rel =
  struct
  {
    Elf32_Addr r_offset;
    Elf32_RelInfo r_info;
  };

type Elf32_Rela =
  struct
  {
    Elf32_Addr r_offset;
    Elf32_RelInfo r_info;
    Elf_Sword r_addend;
  };

type Elf64_RelInfo =
  struct Elf64_Xword
  {
    uint<32> r_sym;
    uint<32> r_type;
  };

type Elf64_Rel =
  struct
  {
    Elf64_Addr r_offset;
    Elf64_RelInfo r_info;
  };

type Elf64_Rela =
  struct
  {
    Elf64_Addr r_offset;
    Elf64_RelInfo r_info;
    Elf64_Sxword r_addend;
  };

12.2 Fields

r_offset

This field specifies the location at which to apply the relocation action, which itself depends on the specific kind of relocation.

This is the byte offset from the beginning of the section whose contents are to be relocated. In executables and shared objects this offset is a virtual address; in all other ELF files this refers to the stored data.

r_info

XXX

r_sym

XXX

r_type

XXX

r_addend

XXX