[lld] 94f34c0 - [LLD][COFF] Use primary symbol table machine in Writer::writeHeader (NFC) (#128442)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 12:53:13 PST 2025
Author: Jacek Caban
Date: 2025-02-27T21:53:10+01:00
New Revision: 94f34c00f28c6f6abfcedbb3ab9c12a0bf046ecd
URL: https://github.com/llvm/llvm-project/commit/94f34c00f28c6f6abfcedbb3ab9c12a0bf046ecd
DIFF: https://github.com/llvm/llvm-project/commit/94f34c00f28c6f6abfcedbb3ab9c12a0bf046ecd.diff
LOG: [LLD][COFF] Use primary symbol table machine in Writer::writeHeader (NFC) (#128442)
Instead of duplicating the logic from `LinkerDriver::setMachine`.
Added:
Modified:
lld/COFF/Writer.cpp
Removed:
################################################################################
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 <typename PEHeaderTy> void Writer::writeHeader() {
assert(coffHeaderOffset == buf - buffer->getBufferStart());
auto *coff = reinterpret_cast<coff_file_header *>(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)
More information about the llvm-commits
mailing list