From 5be2b5dfd92e1fe99412a541091472a0dd2cde84 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Tue, 22 Oct 2024 10:19:37 -0700 Subject: [PATCH] alias for amd64 machine --- src/coff/coff.c | 11 +++++++---- src/linker/lnk.c | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/coff/coff.c b/src/coff/coff.c index 30b8b81a..7ebd33d7 100644 --- a/src/coff/coff.c +++ b/src/coff/coff.c @@ -1196,6 +1196,7 @@ read_only struct } g_coff_machine_map[] = { { str8_lit_comp(""), COFF_MachineType_UNKNOWN }, { str8_lit_comp("X86"), COFF_MachineType_X86 }, + { str8_lit_comp("AMD64"), COFF_MachineType_X64 }, { str8_lit_comp("X64"), COFF_MachineType_X64 }, { str8_lit_comp("AM33"), COFF_MachineType_AM33 }, { str8_lit_comp("ARM"), COFF_MachineType_ARM }, @@ -1248,10 +1249,12 @@ coff_string_from_comdat_select_type(COFF_ComdatSelectType select) internal String8 coff_string_from_machine_type(COFF_MachineType machine) { - Assert(machine < ArrayCount(g_coff_machine_map)); - Assert(machine == g_coff_machine_map[machine].machine); - String8 string = g_coff_machine_map[machine].string; - return string; + for (U64 i = 0; i < ArrayCount(g_coff_machine_map); ++i) { + if (g_coff_machine_map[i].machine == machine) { + return g_coff_machine_map[i].string; + } + } + return str8_zero(); } internal String8 diff --git a/src/linker/lnk.c b/src/linker/lnk.c index df0976f7..6fc2168b 100644 --- a/src/linker/lnk.c +++ b/src/linker/lnk.c @@ -3617,11 +3617,11 @@ l.count += 1; \ // is obj machine compatible? if (obj->machine != COFF_MachineType_UNKNOWN && // obj with unknown machine type is compatible with any other machine type config->machine != obj->machine) { - lnk_error(LNK_Error_IncompatibleObj, - "conflicting machine types expected %S but got %S in obj %S", - coff_string_from_machine_type(config->machine), - coff_string_from_machine_type(obj->machine), - obj->path); + lnk_error_obj(LNK_Error_IncompatibleObj, + obj, + "conflicting machine types expected %S but got %S", + coff_string_from_machine_type(config->machine), + coff_string_from_machine_type(obj->machine)); } } ProfEnd();