mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 10:51:01 +00:00
fii
This commit is contained in:
parent
da3175f680
commit
c4ed5950d8
@ -4320,6 +4320,7 @@ static void _set_arm_thumb_bits(struct Elf_(obj_t) *eo, RBinSymbol **symp) {
|
||||
RBinSymbol *sym = *symp;
|
||||
const char *name = r_bin_name_tostring2 (sym->name, 'o');
|
||||
int len = strlen (name);
|
||||
sym->bits = bin_bits;
|
||||
if (name[0] == '$' && (len >= 2 && !name[2])) {
|
||||
switch (name[1]) {
|
||||
case 'a' : // arm
|
||||
@ -4334,14 +4335,16 @@ static void _set_arm_thumb_bits(struct Elf_(obj_t) *eo, RBinSymbol **symp) {
|
||||
sym->paddr--;
|
||||
}
|
||||
return;
|
||||
#if 0
|
||||
case 'd': // data
|
||||
sym->bits = 32;
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
sym->bits = bin_bits;
|
||||
if (bin_bits != 64) {
|
||||
if (sym->bits != 64) {
|
||||
sym->bits = 32;
|
||||
if (sym->paddr != UT64_MAX) {
|
||||
if (sym->vaddr & 1) {
|
||||
|
@ -709,7 +709,7 @@ static void load_types_from(RCore *core, const char *fmt, ...) {
|
||||
|
||||
R_API void r_core_anal_type_init(RCore *core) {
|
||||
R_RETURN_IF_FAIL (core && core->anal);
|
||||
int bits = core->rasm->config->bits;
|
||||
const int bits = core->rasm->config->bits;
|
||||
Sdb *types = core->anal->sdb_types;
|
||||
// make sure they are empty this is initializing
|
||||
sdb_reset (types);
|
||||
@ -2418,30 +2418,36 @@ static void handle_arm_special_symbol(RCore *core, RBinSymbol *symbol, int va) {
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_arm_hint(RCore *core, RBinInfo *info, ut64 paddr, ut64 vaddr, int bits, int va) {
|
||||
if (info->bits > 32) { // we look at 16 or 32 bit only
|
||||
static void handle_arm_hint(RCore *core, RBinInfo *bi, ut64 paddr, ut64 vaddr, int sym_bits, int va) {
|
||||
if (bi->bits > 32) { // we look at 16 or 32 bit only
|
||||
return;
|
||||
}
|
||||
|
||||
int force_bits = 0;
|
||||
ut64 addr = compute_addr (core->bin, paddr, vaddr, va);
|
||||
if (paddr & 1 || bits == 16) {
|
||||
if (paddr & 1 || sym_bits == 16) {
|
||||
force_bits = 16;
|
||||
} else if (info->bits == 16 && bits == 32) {
|
||||
} else if (bi->bits == 16 && sym_bits == 32) {
|
||||
#if 1
|
||||
// ignore this case, which causes false positives on half-arm-thumb binaries
|
||||
if (vaddr & 1) {
|
||||
force_bits = 16;
|
||||
} else {
|
||||
RAnalHint *hint = r_anal_hint_get (core->anal, vaddr);
|
||||
// XXX ruseli fails
|
||||
force_bits = 32;
|
||||
#if 0
|
||||
RAnalHint *hint = r_anal_hint_get (core->anal, addr);
|
||||
if (hint && hint->bits == 32) {
|
||||
force_bits = 32;
|
||||
} else {
|
||||
return;
|
||||
force_bits = 32;
|
||||
//return;
|
||||
// force_bits = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
} else if (!(paddr & 1) && bits == 32) {
|
||||
} else if (!(paddr & 1) && sym_bits == 32) {
|
||||
force_bits = 32;
|
||||
}
|
||||
if (force_bits) {
|
||||
@ -2753,8 +2759,8 @@ next:
|
||||
|
||||
// handle thumb and arm for entry point since they are not present in symbols
|
||||
if (is_arm) {
|
||||
r_list_foreach (entries, iter, entry) {
|
||||
if (IS_MODE_SET (mode)) {
|
||||
if (IS_MODE_SET (mode)) {
|
||||
r_list_foreach (entries, iter, entry) {
|
||||
handle_arm_entry (r, entry, info, va);
|
||||
}
|
||||
}
|
||||
|
@ -71,3 +71,45 @@ svc 0x42
|
||||
svc 0xb6
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=arm/thumb imports
|
||||
FILE=bins/elf/libmagic.so
|
||||
CMDS=<<EOF
|
||||
pd 10
|
||||
?en ahb32=
|
||||
ahb*~b 32?
|
||||
?en ahb16=
|
||||
ahb*~b 16?
|
||||
0x00005e34
|
||||
ahb.
|
||||
-b asm.lines=0
|
||||
pd 4
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
: ;-- section..text:
|
||||
: ;-- entry0:
|
||||
: ;-- entry.fini0:
|
||||
: 0x00005fa8 04009fe5 ldr r0, [0x00005fb4] ; [0x5fb4:4]=0x1104c ; [09] -r-x section size 53128 named .text
|
||||
: 0x00005fac 00008fe0 add r0, pc, r0
|
||||
`=< 0x00005fb0 93ffffea b sym.imp.__cxa_finalize
|
||||
0x00005fb4 4c100100 andeq r1, r1, ip, asr 32
|
||||
;-- entry.init0:
|
||||
0x00005fb8 10402de9 push {r4, lr}
|
||||
0x00005fbc 40409fe5 ldr r4, [0x00006004] ; [0x6004:4]=0x11064
|
||||
0x00005fc0 40109fe5 ldr r1, [0x00006008] ; [0x6008:4]=0x29e0 "xxabiv115__forced_unwindD2Ev"
|
||||
0x00005fc4 04408fe0 add r4, pc, r4
|
||||
0x00005fc8 0030a0e3 mov r3, 0
|
||||
0x00005fcc 0400a0e1 mov r0, r4
|
||||
ahb32=323
|
||||
ahb16=65
|
||||
32
|
||||
;-- rsym.strdup:
|
||||
;-- strdup:
|
||||
0x00005e34 00c68fe2 add ip, pc, 0, 12
|
||||
0x00005e38 11ca8ce2 add ip, ip, 0x11000
|
||||
0x00005e3c 48f1bce5 ldr pc, [ip, 0x148]!
|
||||
;-- rsym.strstr:
|
||||
;-- strstr:
|
||||
0x00005e40 00c68fe2 add ip, pc, 0, 12
|
||||
EOF
|
||||
RUN
|
||||
|
Loading…
Reference in New Issue
Block a user