Skip to content

Commit 94f34c0

Browse files
authored
[LLD][COFF] Use primary symbol table machine in Writer::writeHeader (NFC) (#128442)
Instead of duplicating the logic from `LinkerDriver::setMachine`.
1 parent b31175a commit 94f34c0

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lld/COFF/Writer.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,16 +1758,7 @@ template <typename PEHeaderTy> void Writer::writeHeader() {
17581758
assert(coffHeaderOffset == buf - buffer->getBufferStart());
17591759
auto *coff = reinterpret_cast<coff_file_header *>(buf);
17601760
buf += sizeof(*coff);
1761-
switch (config->machine) {
1762-
case ARM64EC:
1763-
coff->Machine = AMD64;
1764-
break;
1765-
case ARM64X:
1766-
coff->Machine = ARM64;
1767-
break;
1768-
default:
1769-
coff->Machine = config->machine;
1770-
}
1761+
coff->Machine = ctx.symtab.isEC() ? AMD64 : ctx.symtab.machine;
17711762
coff->NumberOfSections = ctx.outputSections.size();
17721763
coff->Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE;
17731764
if (config->largeAddressAware)

0 commit comments

Comments
 (0)