mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 02:41:08 +00:00
Implement relocs for MIPS32 big endian ELF binaries (openwrt)
This commit is contained in:
parent
7c76d45ab7
commit
3c1a4eb040
@ -301,7 +301,9 @@ static int fcn_recurse(RAnal *anal, RAnalFunction *fcn, ut64 addr, ut8 *buf, ut6
|
||||
|
||||
// check if address is readable //:
|
||||
if (!anal->iob.is_valid_offset (anal->iob.io, addr, 0)) {
|
||||
eprintf ("Invalid address. Try with io.va=true\n");
|
||||
if (addr != UT64_MAX && !anal->iob.io->va) {
|
||||
eprintf ("Invalid address 0x%"PFMT64x". Try with io.va=true\n", addr);
|
||||
}
|
||||
return R_ANAL_RET_ERROR; // MUST BE TOO DEEP
|
||||
}
|
||||
|
||||
|
@ -399,6 +399,10 @@ ut64 Elf_(r_bin_elf_get_section_addr)(struct Elf_(r_bin_elf_obj_t) *bin, const c
|
||||
return section? section->rva: UT64_MAX;
|
||||
}
|
||||
|
||||
ut64 Elf_(r_bin_elf_get_section_addr_end)(struct Elf_(r_bin_elf_obj_t) *bin, const char *section_name) {
|
||||
RBinElfSection *section = get_section_by_name (bin, section_name);
|
||||
return section? section->rva + section->size: UT64_MAX;
|
||||
}
|
||||
#define REL (is_rela ? (void*)rela : (void*)rel)
|
||||
#define REL_BUF is_rela ? (ut8*)(&rela[k]) : (ut8*)(&rel[k])
|
||||
#define REL_OFFSET is_rela ? rela[k].r_offset : rel[k].r_offset
|
||||
@ -527,6 +531,19 @@ static ut64 get_import_addr(struct Elf_(r_bin_elf_obj_t) *bin, int sym) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
// MIPS32 BIG ENDIAN relocs
|
||||
{
|
||||
RBinElfSection *s = get_section_by_name(bin, ".rela.plt");
|
||||
if (s) {
|
||||
plt_addr = s->rva + s->size;
|
||||
plt_addr += 108;
|
||||
plt_addr += k * 16;
|
||||
free (REL);
|
||||
return plt_addr;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eprintf ("Unsupported relocs for this arch %d\n",
|
||||
bin->ehdr.e_machine);
|
||||
|
Loading…
Reference in New Issue
Block a user