@@ -884,42 +884,46 @@ static int get_bits_mips(ELFOBJ *bin) {
884884 return get_bits_mips_common (mips_type );
885885}
886886
887+ static inline bool arch_is (ELFOBJ * bin , ut64 machine_id ) {
888+ return bin -> ehdr .e_machine == machine_id ;
889+ }
890+
887891static inline bool arch_is_nanomips (ELFOBJ * bin ) {
888- return bin -> ehdr . e_machine == EM_IMG1 ;
892+ return arch_is ( bin , EM_IMG1 ) ;
889893}
890894
891- static bool arch_is_mips (ELFOBJ * bin ) {
895+ static inline bool arch_is_mips (ELFOBJ * bin ) {
892896 return bin -> ehdr .e_machine == EM_MIPS ||
893897 bin -> ehdr .e_machine == EM_MIPS_RS3_LE ||
894898 bin -> ehdr .e_machine == EM_MIPS_X ||
895899 arch_is_nanomips (bin );
896900}
897901
898- static bool arch_is_h8xx (ELFOBJ * bin ) {
902+ static inline bool arch_is_h8xx (ELFOBJ * bin ) {
899903 return bin -> ehdr .e_machine == EM_H8_300 ||
900904 bin -> ehdr .e_machine == EM_H8_300H ||
901905 bin -> ehdr .e_machine == EM_H8S ||
902906 bin -> ehdr .e_machine == EM_H8_500 ;
903907}
904908
905- static bool arch_is_sparc (ELFOBJ * bin ) {
909+ static inline bool arch_is_sparc (ELFOBJ * bin ) {
906910 return bin -> ehdr .e_machine == EM_SPARC ||
907911 bin -> ehdr .e_machine == EM_SPARC32PLUS ||
908912 bin -> ehdr .e_machine == EM_SPARCV9 ;
909913}
910914
911- static bool arch_is_arm (ELFOBJ * bin ) {
915+ static inline bool arch_is_arm (ELFOBJ * bin ) {
912916 return bin -> ehdr .e_machine == EM_ARM || bin -> ehdr .e_machine == EM_AARCH64 ;
913917}
914918
915- static bool arch_is_arcompact (ELFOBJ * bin ) {
919+ static inline bool arch_is_arcompact (ELFOBJ * bin ) {
916920 return bin -> ehdr .e_machine == EM_ARC_A5 ||
917921 bin -> ehdr .e_machine == EM_ARC_COMPACT3_64 ||
918922 bin -> ehdr .e_machine == EM_ARC_COMPACT3 ;
919923}
920924
921- static bool arch_is_parisc (ELFOBJ * bin ) {
922- return bin -> ehdr . e_machine == EM_PARISC ;
925+ static inline bool arch_is_parisc (ELFOBJ * bin ) {
926+ return arch_is ( bin , EM_PARISC ) ;
923927}
924928
925929static bool arch_is_riscv (ELFOBJ * bin ) {
@@ -2389,8 +2393,9 @@ bool Elf_(rz_bin_elf_is_static)(RZ_NONNULL ELFOBJ *bin) {
23892393int Elf_ (rz_bin_elf_get_bits )(RZ_NONNULL ELFOBJ * bin ) {
23902394 rz_return_val_if_fail (bin , 0 );
23912395
2392- /* Hack for ARCompact */
2393- if (arch_is_arcompact (bin )) {
2396+ if (arch_is_arcompact (bin ) ||
2397+ arch_is_h8xx (bin ) ||
2398+ arch_is (bin , EM_MSP430 )) {
23942399 return 16 ;
23952400 }
23962401
@@ -2399,10 +2404,6 @@ int Elf_(rz_bin_elf_get_bits)(RZ_NONNULL ELFOBJ *bin) {
23992404 return get_bits_mips (bin );
24002405 }
24012406
2402- if (arch_is_h8xx (bin )) {
2403- return 16 ;
2404- }
2405-
24062407 /* Hack for Thumb */
24072408 if (Elf_ (rz_bin_elf_is_arm_binary_supporting_thumb )(bin )) {
24082409 if (!Elf_ (rz_bin_elf_is_static )(bin ) && has_thumb_symbol (bin )) {
0 commit comments