From 02fb7bbf281b9329060b4c95993d49c878c93593 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 23 Feb 2025 23:36:23 +0100 Subject: [PATCH] [LLD][COFF] Use primary symbol table machine in Writer::writeHeader (NFC) Instead of duplicating the logic from LinkerDriver::setMachine. --- lld/COFF/Writer.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 58727c1615769..3efbcdb452ebe 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -1758,16 +1758,7 @@ template void Writer::writeHeader() { assert(coffHeaderOffset == buf - buffer->getBufferStart()); auto *coff = reinterpret_cast(buf); buf += sizeof(*coff); - switch (config->machine) { - case ARM64EC: - coff->Machine = AMD64; - break; - case ARM64X: - coff->Machine = ARM64; - break; - default: - coff->Machine = config->machine; - } + coff->Machine = ctx.symtab.isEC() ? AMD64 : ctx.symtab.machine; coff->NumberOfSections = ctx.outputSections.size(); coff->Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE; if (config->largeAddressAware)