[PATCH] D39892: [llvm-cvtres] Add support for ARM64
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 14:29:38 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL317942: [llvm-cvtres] Add support for ARM64 (authored by mstorsjo).
Changed prior to commit:
https://reviews.llvm.org/D39892?vs=122406&id=122533#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39892
Files:
llvm/trunk/lib/Object/WindowsResource.cpp
llvm/trunk/test/tools/llvm-cvtres/machine.test
llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
Index: llvm/trunk/test/tools/llvm-cvtres/machine.test
===================================================================
--- llvm/trunk/test/tools/llvm-cvtres/machine.test
+++ llvm/trunk/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: llvm/trunk/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp
+++ llvm/trunk/lib/Object/WindowsResource.cpp
@@ -441,19 +441,7 @@
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 @@
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: llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
===================================================================
--- llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
+++ llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
@@ -126,6 +126,7 @@
std::string MachineString = InputArgs.getLastArgValue(OPT_MACHINE).upper();
MachineType = StringSwitch<COFF::MachineTypes>(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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39892.122533.patch
Type: text/x-patch
Size: 3721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/92e2492a/attachment.bin>
More information about the llvm-commits
mailing list