[lld] [LLD][COFF] Use primary symbol table machine in Writer::writeHeader (NFC) (PR #128442)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 14:40:02 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-coff
Author: Jacek Caban (cjacek)
<details>
<summary>Changes</summary>
Instead of duplicating the logic from `LinkerDriver::setMachine`.
---
Full diff: https://github.com/llvm/llvm-project/pull/128442.diff
1 Files Affected:
- (modified) lld/COFF/Writer.cpp (+1-10)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/128442
More information about the llvm-commits
mailing list