Exemplo n.º 1
0
int
elf_fix_phdr(Elf_Phdr *ph, void *v)
{
    ph->p_type = swap32(ph->p_type);
    ph->p_flags = swap32(ph->p_flags);
    ph->p_offset = swap_off(ph->p_offset);
    ph->p_vaddr = swap_addr(ph->p_vaddr);
    ph->p_paddr = swap_addr(ph->p_paddr);
    ph->p_filesz = swap_xword(ph->p_filesz);
    ph->p_memsz = swap_xword(ph->p_memsz);
    ph->p_align = swap_xword(ph->p_align);

    return 1;
}
Exemplo n.º 2
0
int
elf_fix_rel(Elf_Ehdr *eh, Elf_Rel *rel)
{
	/* nothing to do */
	if (eh->e_ident[EI_DATA] == ELF_TARG_DATA)
		return (0);

	rel->r_offset = swap_addr(rel->r_offset);
	rel->r_info = swap_xword(rel->r_info);

	return (1);
}
Exemplo n.º 3
0
int
elf_fix_sym(const Elf_Ehdr *eh, Elf_Sym *sym)
{
    /* nothing to do */
    if (eh->e_ident[EI_DATA] == ELF_TARG_DATA)
        return (0);

    sym->st_name = swap32(sym->st_name);
    sym->st_shndx = swap16(sym->st_shndx);
    sym->st_value = swap_addr(sym->st_value);
    sym->st_size = swap_xword(sym->st_size);

    return (1);
}