Index: lib/Object/WindowsResource.cpp =================================================================== --- lib/Object/WindowsResource.cpp +++ lib/Object/WindowsResource.cpp @@ -443,16 +443,13 @@ auto *Header = reinterpret_cast(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; + case COFF::IMAGE_FILE_MACHINE_ARM64: + Header->Machine = MachineType; break; default: - Header->Machine = COFF::IMAGE_FILE_MACHINE_UNKNOWN; + llvm_unreachable("unknown machine type"); } Header->NumberOfSections = 2; Header->TimeDateStamp = getTime(); @@ -714,8 +711,11 @@ 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); } Index: test/tools/llvm-cvtres/machine.test =================================================================== --- test/tools/llvm-cvtres/machine.test +++ test/tools/llvm-cvtres/machine.test @@ -22,6 +22,9 @@ RUN: llvm-cvtres /machine:ARM /out:%t %p/Inputs/test_resource.res RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=ARM +RUN: llvm-cvtres /machine:ARM64 /out:%t %p/Inputs/test_resource.res +RUN: llvm-readobj -h -relocations %t | FileCheck %s -check-prefix=ARM64 + X86: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) X86-DAG: Relocations [ X86-DAG: .rsrc$01 { @@ -57,3 +60,15 @@ ARM-NEXT: 0x1F8 IMAGE_REL_ARM_ADDR32NB $R000708 ARM-NEXT: 0x1B8 IMAGE_REL_ARM_ADDR32NB $R000720 ARM-NEXT: 0x188 IMAGE_REL_ARM_ADDR32NB $R000750 + +ARM64: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64) +ARM64-DAG: Relocations [ +ARM64-DAG: .rsrc$01 { +ARM64-NEXT: 0x1E8 IMAGE_REL_ARM64_ADDR32NB $R000000 +ARM64-NEXT: 0x198 IMAGE_REL_ARM64_ADDR32NB $R000018 +ARM64-NEXT: 0x1A8 IMAGE_REL_ARM64_ADDR32NB $R000340 +ARM64-NEXT: 0x1C8 IMAGE_REL_ARM64_ADDR32NB $R000668 +ARM64-NEXT: 0x1D8 IMAGE_REL_ARM64_ADDR32NB $R000698 +ARM64-NEXT: 0x1F8 IMAGE_REL_ARM64_ADDR32NB $R000708 +ARM64-NEXT: 0x1B8 IMAGE_REL_ARM64_ADDR32NB $R000720 +ARM64-NEXT: 0x188 IMAGE_REL_ARM64_ADDR32NB $R000750 Index: tools/llvm-cvtres/llvm-cvtres.cpp =================================================================== --- tools/llvm-cvtres/llvm-cvtres.cpp +++ tools/llvm-cvtres/llvm-cvtres.cpp @@ -126,6 +126,7 @@ std::string MachineString = InputArgs.getLastArgValue(OPT_MACHINE).upper(); MachineType = StringSwitch(MachineString) .Case("ARM", COFF::IMAGE_FILE_MACHINE_ARMNT) + .Case("ARM64", COFF::IMAGE_FILE_MACHINE_ARM64) .Case("X64", COFF::IMAGE_FILE_MACHINE_AMD64) .Case("X86", COFF::IMAGE_FILE_MACHINE_I386) .Default(COFF::IMAGE_FILE_MACHINE_UNKNOWN); @@ -155,6 +156,9 @@ if (Verbose) { outs() << "Machine: "; switch (MachineType) { + case COFF::IMAGE_FILE_MACHINE_ARM64: + outs() << "ARM64\n"; + break; case COFF::IMAGE_FILE_MACHINE_ARMNT: outs() << "ARM\n"; break;