Handle SH, MIPS and ARM in COFF binaries ##bin

This commit is contained in:
wargio 2022-02-14 00:57:27 +01:00 committed by Sergi Àlvarez i Capilla
parent ea85949d18
commit dc7c60b1bb
2 changed files with 30 additions and 1 deletions

View File

@ -9,6 +9,9 @@
bool r_coff_supported_arch(const ut8 *buf) {
ut16 arch = *(ut16*)buf;
switch (arch) {
case COFF_FILE_MACHINE_MIPS16:
case COFF_FILE_MACHINE_MIPSFPU:
case COFF_FILE_MACHINE_MIPSFPU16:
case COFF_FILE_MACHINE_AMD64:
case COFF_FILE_MACHINE_I386:
case COFF_FILE_MACHINE_H8300:
@ -16,8 +19,13 @@ bool r_coff_supported_arch(const ut8 *buf) {
case COFF_FILE_MACHINE_R4000:
case COFF_FILE_MACHINE_AMD29KBE:
case COFF_FILE_MACHINE_AMD29KLE:
case COFF_FILE_MACHINE_ARM64:
case COFF_FILE_MACHINE_SH3:
case COFF_FILE_MACHINE_SH3DSP:
case COFF_FILE_MACHINE_SH4:
case COFF_FILE_MACHINE_SH5:
case COFF_FILE_MACHINE_THUMB:
case COFF_FILE_MACHINE_ARM:
case COFF_FILE_MACHINE_ARM64:
case COFF_FILE_MACHINE_ARMNT:
return true;
default:

View File

@ -549,6 +549,14 @@ static RBinInfo *info(RBinFile *bf) {
}
switch (obj->hdr.f_magic) {
case COFF_FILE_MACHINE_R4000:
case COFF_FILE_MACHINE_MIPS16:
case COFF_FILE_MACHINE_MIPSFPU:
case COFF_FILE_MACHINE_MIPSFPU16:
ret->machine = strdup ("mips");
ret->arch = strdup ("mips");
ret->bits = 32;
break;
case COFF_FILE_MACHINE_I386:
ret->machine = strdup ("i386");
ret->arch = strdup ("x86");
@ -559,6 +567,11 @@ static RBinInfo *info(RBinFile *bf) {
ret->arch = strdup ("arm");
ret->bits = 64;
break;
case COFF_FILE_MACHINE_THUMB:
ret->machine = strdup ("arm");
ret->arch = strdup ("arm");
ret->bits = 16;
break;
case COFF_FILE_MACHINE_ARM:
ret->machine = strdup ("ARM");
ret->arch = strdup ("arm");
@ -586,6 +599,14 @@ static RBinInfo *info(RBinFile *bf) {
ret->arch = strdup ("arm");
ret->bits = 32;
break;
case COFF_FILE_MACHINE_SH3:
case COFF_FILE_MACHINE_SH3DSP:
case COFF_FILE_MACHINE_SH4:
case COFF_FILE_MACHINE_SH5:
ret->machine = strdup ("sh");
ret->arch = strdup ("sh");
ret->bits = 32;
break;
case COFF_FILE_TI_COFF:
switch (obj->target_id) {
case COFF_FILE_MACHINE_TMS320C54: