[llvm] r203761 - Support: add support to identify WinCOFF/ARM objects
Saleem Abdulrasool
compnerd at compnerd.org
Thu Mar 13 00:02:35 PDT 2014
Author: compnerd
Date: Thu Mar 13 02:02:35 2014
New Revision: 203761
URL: http://llvm.org/viewvc/llvm-project?rev=203761&view=rev
Log:
Support: add support to identify WinCOFF/ARM objects
Add the Windows COFF ARM object file magic. This enables the LLVM tools to
interact with COFF object files for Windows on ARM.
Added:
llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm (with props)
Modified:
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/lib/Support/Path.cpp
llvm/trunk/test/tools/llvm-readobj/file-headers.test
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=203761&r1=203760&r2=203761&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Thu Mar 13 02:02:35 2014
@@ -663,6 +663,8 @@ StringRef COFFObjectFile::getFileFormatN
return "COFF-i386";
case COFF::IMAGE_FILE_MACHINE_AMD64:
return "COFF-x86-64";
+ case COFF::IMAGE_FILE_MACHINE_ARMNT:
+ return "COFF-ARM";
default:
return "COFF-<unknown arch>";
}
@@ -674,6 +676,8 @@ unsigned COFFObjectFile::getArch() const
return Triple::x86;
case COFF::IMAGE_FILE_MACHINE_AMD64:
return Triple::x86_64;
+ case COFF::IMAGE_FILE_MACHINE_ARMNT:
+ return Triple::thumb;
default:
return Triple::UnknownArch;
}
Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=203761&r1=203760&r2=203761&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Thu Mar 13 02:02:35 2014
@@ -1016,6 +1016,7 @@ error_code has_magic(const Twine &path,
case 0x66: // MPS R4000 Windows
case 0x50: // mc68K
case 0x4c: // 80386 Windows
+ case 0xc4: // ARMNT Windows
if (Magic[1] == 0x01)
return file_magic::coff_object;
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm?rev=203761&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm (added) and llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm Thu Mar 13 02:02:35 2014 differ
Propchange: llvm/trunk/test/tools/llvm-readobj/Inputs/trivial.obj.coff-arm
------------------------------------------------------------------------------
svn:executable = *
Modified: llvm/trunk/test/tools/llvm-readobj/file-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/file-headers.test?rev=203761&r1=203760&r2=203761&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/file-headers.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/file-headers.test Thu Mar 13 02:02:35 2014
@@ -1,3 +1,5 @@
+RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-arm \
+RUN: | FileCheck %s -check-prefix COFF-ARM
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF32
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-x86-64 \
@@ -13,6 +15,21 @@ RUN: | FileCheck %s -check-prefix COFF
RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
RUN: | FileCheck %s -check-prefix COFF-IMPORTLIB
+COFF-ARM: File: {{(.*[/\\])?}}trivial.obj.coff-arm
+COFF-ARM-NEXT: Format: COFF-ARM
+COFF-ARM-NEXT: Arch: thumb
+COFF-ARM-NEXT: AddressSize: 32bit
+COFF-ARM-NEXT: ImageFileHeader {
+COFF-ARM-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
+COFF-ARM-NEXT: SectionCount: 2
+COFF-ARM-NEXT: TimeDateStamp: 2014-03-13 02:48:34 (0x53211C82)
+COFF-ARM-NEXT: PointerToSymbolTable: 0xFF
+COFF-ARM-NEXT: SymbolCount: 6
+COFF-ARM-NEXT: OptionalHeaderSize: 0
+COFF-ARM-NEXT: Characteristics [ (0x0)
+COFF-ARM-NEXT: ]
+COFF-ARM-NEXT: }
+
COFF32: File: {{(.*[/\\])?}}trivial.obj.coff-i386
COFF32-NEXT: Format: COFF-i386
COFF32-NEXT: Arch: i386
More information about the llvm-commits
mailing list