LibELF: Add EM_AARCH64 as expected architecture for ELF validation

This commit is contained in:
Timon Kruiper 2023-01-29 13:11:30 +01:00 committed by Linus Groh
parent 163e3ac90b
commit daf7f43135

View file

@ -59,12 +59,12 @@ bool validate_elf_header(ElfW(Ehdr) const& elf_header, size_t file_size, bool ve
return false;
}
auto expected_machine = EM_X86_64;
auto expected_machine_name = "x86-64";
auto expected_machines = Array { EM_X86_64, EM_AARCH64 };
auto expected_machine_names = Array { "x86-64"sv, "aarch64"sv };
if (expected_machine != elf_header.e_machine) {
if (!expected_machines.span().contains_slow(elf_header.e_machine)) {
if (verbose)
dbgln("File has unknown machine ({}), expected {} ({})!", elf_header.e_machine, expected_machine_name, expected_machine);
dbgln("File has unknown machine ({}), expected {} ({})!", elf_header.e_machine, expected_machine_names.span(), expected_machines.span());
return false;
}