Fix #8573 - Detect D's main

This commit is contained in:
pancake 2017-09-20 16:42:28 +02:00
parent e36248e9d3
commit aa3eb6a9ad
2 changed files with 6 additions and 1 deletions

View File

@ -2309,6 +2309,10 @@ ut64 MACH0_(get_main)(struct MACH0_(obj_t)* bin) {
}
for (i = 0; !symbols[i].last; i++) {
const char *name = symbols[i].name;
if (!strcmp (name, "__Dmain")) {
addr = symbols[i].addr;
break;
}
if (strstr (name, "4main") && !strstr (name, "STATIC")) {
addr = symbols[i].addr;
break;

View File

@ -744,8 +744,9 @@ static RBinAddr* binsym(RBinFile *arch, int sym) {
switch (sym) {
case R_BIN_SYM_MAIN:
addr = MACH0_(get_main) (arch->o->bin_obj);
if (!addr || !(ret = R_NEW0 (RBinAddr)))
if (!addr || !(ret = R_NEW0 (RBinAddr))) {
return NULL;
}
//if (arch->o->info && arch->o->info->bits == 16) {
// align for thumb
ret->vaddr = ((addr >>1)<<1);