diff --git a/util/cbfstool/elf.h b/util/cbfstool/elf.h index 01af81988a..65898b4440 100644 --- a/util/cbfstool/elf.h +++ b/util/cbfstool/elf.h @@ -244,6 +244,8 @@ typedef struct #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ #define EM_NUM 95 +#define EM_AARCH64 183 /* ARM Aarch64 Architecture */ + /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision with official or non-GNU unofficial values. */ diff --git a/util/cbfstool/elfheaders.c b/util/cbfstool/elfheaders.c index cb3611219c..dd047f24df 100644 --- a/util/cbfstool/elfheaders.c +++ b/util/cbfstool/elfheaders.c @@ -273,6 +273,7 @@ elf_headers(const struct buffer *pinput, // The tool may work in architecture-independent way. if (arch != CBFS_ARCHITECTURE_UNKNOWN && + !((ehdr->e_machine == EM_AARCH64) && (arch == CBFS_ARCHITECTURE_AARCH64)) && !((ehdr->e_machine == EM_ARM) && (arch == CBFS_ARCHITECTURE_ARM)) && !((ehdr->e_machine == EM_386) && (arch == CBFS_ARCHITECTURE_X86))) { ERROR("The stage file has the wrong architecture\n");