diff options
Diffstat (limited to 'llvm/lib/Object/WindowsResource.cpp')
-rw-r--r-- | llvm/lib/Object/WindowsResource.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp index 693494a5084..b844955caa8 100644 --- a/llvm/lib/Object/WindowsResource.cpp +++ b/llvm/lib/Object/WindowsResource.cpp @@ -441,19 +441,7 @@ std::unique_ptr<MemoryBuffer> WindowsResourceCOFFWriter::write() { void WindowsResourceCOFFWriter::writeCOFFHeader() { // Write the COFF header. auto *Header = reinterpret_cast<coff_file_header *>(BufferStart); - switch (MachineType) { - case COFF::IMAGE_FILE_MACHINE_ARMNT: - Header->Machine = COFF::IMAGE_FILE_MACHINE_ARMNT; - break; - case COFF::IMAGE_FILE_MACHINE_AMD64: - Header->Machine = COFF::IMAGE_FILE_MACHINE_AMD64; - break; - case COFF::IMAGE_FILE_MACHINE_I386: - Header->Machine = COFF::IMAGE_FILE_MACHINE_I386; - break; - default: - Header->Machine = COFF::IMAGE_FILE_MACHINE_UNKNOWN; - } + Header->Machine = MachineType; Header->NumberOfSections = 2; Header->TimeDateStamp = getTime(); Header->PointerToSymbolTable = SymbolTableOffset; @@ -714,8 +702,11 @@ void WindowsResourceCOFFWriter::writeFirstSectionRelocations() { case COFF::IMAGE_FILE_MACHINE_I386: Reloc->Type = COFF::IMAGE_REL_I386_DIR32NB; break; + case COFF::IMAGE_FILE_MACHINE_ARM64: + Reloc->Type = COFF::IMAGE_REL_ARM64_ADDR32NB; + break; default: - Reloc->Type = 0; + llvm_unreachable("unknown machine type"); } CurrentOffset += sizeof(coff_relocation); } |