Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit ed42e32

Browse files
committed
[[ AndroidArchs ]] Fix deploy command for new archs in ELF header
1 parent d780d79 commit ed42e32

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

engine/src/deploy_linux.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ typedef struct
194194
#define EM_860 7 /* Intel 80860 */
195195
#define EM_MIPS 8 /* MIPS R3000 big-endian */
196196
#define EM_S370 9 /* IBM System/370 */
197-
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
198-
#define EM_ARM 40
197+
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
198+
#define EM_ARM 40 /* ARM */
199+
#define EM_X86_64 62 /* AMD x86-64 */
200+
#define EM_AARCH64 183 /* ARM AArch64 */
199201

200202
/* Legal values for e_version (version). */
201203

@@ -452,6 +454,17 @@ static void swap_ElfX_Phdr(Elf64_Phdr& x)
452454

453455
////////////////////////////////////////////////////////////////////////////////
454456

457+
static bool MCDeployIsValidAndroidArch(uint16_t p_machine)
458+
{
459+
if (p_machine == EM_ARM ||
460+
p_machine == EM_AARCH64 ||
461+
p_machine == EM_386 ||
462+
p_machine == EM_X86_64)
463+
return true;
464+
465+
return false;
466+
}
467+
455468
template<typename T>
456469
static bool MCDeployToLinuxReadHeader(MCDeployFileRef p_file, bool p_is_android, typename T::Ehdr& r_header)
457470
{
@@ -487,7 +500,7 @@ static bool MCDeployToLinuxReadHeader(MCDeployFileRef p_file, bool p_is_android,
487500
else
488501
{
489502
if (r_header . e_type != ET_DYN ||
490-
r_header . e_machine != EM_ARM ||
503+
!MCDeployIsValidAndroidArch(r_header.e_machine) ||
491504
r_header . e_version != EV_CURRENT)
492505
return MCDeployThrow(kMCDeployErrorLinuxBadImage);
493506
}

0 commit comments

Comments
 (0)