Skip to content

Commit dbc6cc2

Browse files
authoredOct 7, 2020
Fix compile if HAS_ARM is defined but HAS_ARM_EB isn't (unicorn-engine#1338)
1 parent 198e432 commit dbc6cc2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎uc.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ uc_err uc_open(uc_arch arch, uc_mode mode, uc_engine **result)
193193
return UC_ERR_MODE;
194194
}
195195
if (mode & UC_MODE_BIG_ENDIAN) {
196+
#ifdef UNICORN_HAS_ARMEB
196197
uc->init_arch = armeb_uc_init;
198+
#else
199+
return UC_ERR_MODE;
200+
#endif
197201
} else {
198202
uc->init_arch = arm_uc_init;
199203
}
@@ -1299,7 +1303,13 @@ static size_t cpu_context_size(uc_arch arch, uc_mode mode)
12991303
case UC_ARCH_X86: return X86_REGS_STORAGE_SIZE;
13001304
#endif
13011305
#ifdef UNICORN_HAS_ARM
1302-
case UC_ARCH_ARM: return mode & UC_MODE_BIG_ENDIAN ? ARM_REGS_STORAGE_SIZE_armeb : ARM_REGS_STORAGE_SIZE_arm;
1306+
case UC_ARCH_ARM: return mode & UC_MODE_BIG_ENDIAN ?
1307+
#ifdef UNICORN_HAS_ARMEB
1308+
ARM_REGS_STORAGE_SIZE_armeb
1309+
#else
1310+
0
1311+
#endif
1312+
: ARM_REGS_STORAGE_SIZE_arm;
13031313
#endif
13041314
#ifdef UNICORN_HAS_ARM64
13051315
case UC_ARCH_ARM64: return mode & UC_MODE_BIG_ENDIAN ? ARM64_REGS_STORAGE_SIZE_aarch64eb : ARM64_REGS_STORAGE_SIZE_aarch64;

0 commit comments

Comments
 (0)
Please sign in to comment.