Exemplo n.º 1
0
void fixup_branch_end(elf_bf_exec_t *ee, size_t index, size_t diff)
{
  //diff is the number of rela instructions between the start of the
  //first branch statement and the start of the last branch
  elf_bf_Rela r0, r1, jump;
  elf_bf_link_map_t *lm = &(ee->ee_lm);
  reloc_get_reloc_entry(lm, index, &r0);
  reloc_get_reloc_entry(lm, index+1, &r1);
  reloc_get_reloc_entry(lm, index-diff, &jump);
  reloc_set_reladdend(&r0, jump.addr);
  reloc_set_reladdend(&r1,ee->ee_dt_relasz_value - ((index-diff) * sizeof(Elf64_Rela)));
}
Exemplo n.º 2
0
void fixup_branch_start(elf_bf_exec_t *ee, size_t index, size_t diff, size_t afterend)
{
  //diff is the number of rela instructions between the start of the
  //first branch statement and the start of the last branch
  elf_bf_Rela r0, r1, next;
  elf_bf_link_map_t *lm = &(ee->ee_lm);
  //index of first entry in ']'
  reloc_get_reloc_entry(lm, (index) - (diff+4), &r0);
  reloc_get_reloc_entry(lm, (index) - (diff+3), &r1);
  reloc_get_reloc_entry(lm, afterend, &next);
  reloc_set_reladdend(&r0, next.addr);
  reloc_set_reladdend(&r1, ee->ee_dt_relasz_value - (afterend * sizeof(Elf64_Rela)));
}
Exemplo n.º 3
0
void reloc_set_rela(elf_bf_Rela *r, Elf64_Word type, Elf64_Word sym, Elf64_Addr off, Elf64_Addr val)
{
    if (r->rel) {
        reloc_set_relatype(r,type);
        reloc_set_relasym(r, sym);
        reloc_set_relaoffset(r, off);
        reloc_set_reladdend(r, val);
    }
}