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 \
RUN:   | FileCheck %s -check-prefix COFF64
RUN: llvm-readobj -h %p/Inputs/trivial.exe.coff-i386 \
RUN:   | FileCheck %s -check-prefix PE32
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-i386 \
RUN:   | FileCheck %s -check-prefix ELF32
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-x86-64 \
RUN:   | FileCheck %s -check-prefix ELF64
RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-i386 \
RUN:   | FileCheck %s -check-prefix MACHO32
RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-x86-64 \
RUN:   | FileCheck %s -check-prefix MACHO64
RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-ppc \
RUN:   | FileCheck %s -check-prefix MACHO-PPC
RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-ppc64 \
RUN:   | FileCheck %s -check-prefix MACHO-PPC64
RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-arm \
RUN:   | FileCheck %s -check-prefix MACHO-ARM
RUN: llvm-readobj -h %p/Inputs/magic.coff-unknown \
RUN:   | FileCheck %s -check-prefix COFF-UNKNOWN
RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
RUN:   | FileCheck %s -check-prefix COFF-IMPORTLIB
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-lanai \
RUN:   | FileCheck %s -check-prefix ELF-LANAI

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
COFF32-NEXT: AddressSize: 32bit
COFF32-NEXT: ImageFileHeader {
COFF32-NEXT:   Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
COFF32-NEXT:   SectionCount: 2
COFF32-NEXT:   TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E)
COFF32-NEXT:   PointerToSymbolTable: 0xA5
COFF32-NEXT:   SymbolCount: 9
COFF32-NEXT:   OptionalHeaderSize: 0
COFF32-NEXT:   Characteristics [ (0x0)
COFF32-NEXT:   ]
COFF32-NEXT: }

COFF64:      File: {{(.*[/\\])?}}trivial.obj.coff-x86-64
COFF64-NEXT: Format: COFF-x86-64
COFF64-NEXT: Arch: x86_64
COFF64-NEXT: AddressSize: 64bit
COFF64-NEXT: ImageFileHeader {
COFF64-NEXT:   Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
COFF64-NEXT:   SectionCount: 2
COFF64-NEXT:   TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E)
COFF64-NEXT:   PointerToSymbolTable: 0xAB
COFF64-NEXT:   SymbolCount: 7
COFF64-NEXT:   OptionalHeaderSize: 0
COFF64-NEXT:   Characteristics [ (0x0)
COFF64-NEXT:   ]
COFF64-NEXT: }

ELF32:      File: {{(.*[/\\])?}}trivial.obj.elf-i386
ELF32-NEXT: Format: ELF32-i386
ELF32-NEXT: Arch: i386
ELF32-NEXT: AddressSize: 32bit
ELF32-NEXT: LoadName:
ELF32-NEXT: ElfHeader {
ELF32-NEXT:   Ident {
ELF32-NEXT:     Magic: (7F 45 4C 46)
ELF32-NEXT:     Class: 32-bit (0x1)
ELF32-NEXT:     DataEncoding: LittleEndian (0x1)
ELF32-NEXT:     FileVersion: 1
ELF32-NEXT:     OS/ABI: GNU/Linux (0x3)
ELF32-NEXT:     ABIVersion: 0
ELF32-NEXT:     Unused: (00 00 00 00 00 00 00)
ELF32-NEXT:   }
ELF32-NEXT:   Type: Relocatable (0x1)
ELF32-NEXT:   Machine: EM_386 (0x3)
ELF32-NEXT:   Version: 1
ELF32-NEXT:   Entry: 0x0
ELF32-NEXT:   ProgramHeaderOffset: 0x0
ELF32-NEXT:   SectionHeaderOffset: 0xC8
ELF32-NEXT:   Flags [ (0x0)
ELF32-NEXT:   ]
ELF32-NEXT:   HeaderSize: 52
ELF32-NEXT:   ProgramHeaderEntrySize: 0
ELF32-NEXT:   ProgramHeaderCount: 0
ELF32-NEXT:   SectionHeaderEntrySize: 40
ELF32-NEXT:   SectionHeaderCount: 10
ELF32-NEXT:   StringTableSectionIndex: 7
ELF32-NEXT: }

ELF64:      File: {{(.*[/\\])?}}trivial.obj.elf-x86-64
ELF64-NEXT: Format: ELF64-x86-64
ELF64-NEXT: Arch: x86_64
ELF64-NEXT: AddressSize: 64bit
ELF64-NEXT: LoadName:
ELF64-NEXT: ElfHeader {
ELF64-NEXT:   Ident {
ELF64-NEXT:     Magic: (7F 45 4C 46)
ELF64-NEXT:     Class: 64-bit (0x2)
ELF64-NEXT:     DataEncoding: LittleEndian (0x1)
ELF64-NEXT:     FileVersion: 1
ELF64-NEXT:     OS/ABI: GNU/Linux (0x3)
ELF64-NEXT:     ABIVersion: 0
ELF64-NEXT:     Unused: (00 00 00 00 00 00 00)
ELF64-NEXT:   }
ELF64-NEXT:   Type: Relocatable (0x1)
ELF64-NEXT:   Machine: EM_X86_64 (0x3E)
ELF64-NEXT:   Version: 1
ELF64-NEXT:   Entry: 0x0
ELF64-NEXT:   ProgramHeaderOffset: 0x0
ELF64-NEXT:   SectionHeaderOffset: 0xB8
ELF64-NEXT:   Flags [ (0x0)
ELF64-NEXT:   ]
ELF64-NEXT:   HeaderSize: 64
ELF64-NEXT:   ProgramHeaderEntrySize: 0
ELF64-NEXT:   ProgramHeaderCount: 0
ELF64-NEXT:   SectionHeaderEntrySize: 64
ELF64-NEXT:   SectionHeaderCount: 10
ELF64-NEXT:   StringTableSectionIndex: 7
ELF64-NEXT: }

MACHO32:      File: {{(.*[/\\])?}}trivial.obj.macho-i386
MACHO32-NEXT: Format: Mach-O 32-bit i386
MACHO32-NEXT: Arch: i386
MACHO32-NEXT: AddressSize: 32bit
MACHO32-NEXT: MachHeader {
MACHO32-NEXT:   Magic: Magic (0xFEEDFACE)
MACHO32-NEXT:   CpuType: X86 (0x7)
MACHO32-NEXT:   CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
MACHO32-NEXT:   FileType: Relocatable (0x1)
MACHO32-NEXT:   NumOfLoadCommands: 3
MACHO32-NEXT:   SizeOfLoadCommands: 296
MACHO32-NEXT:   Flags [ (0x2000)
MACHO32-NEXT:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
MACHO32-NEXT:   ]
MACHO32-NEXT: }

MACHO64:      File: {{(.*[/\\])?}}trivial.obj.macho-x86-64
MACHO64-NEXT: Format: Mach-O 64-bit x86-64
MACHO64-NEXT: Arch: x86_64
MACHO64-NEXT: AddressSize: 64bit
MACHO64-NEXT: MachHeader {
MACHO64-NEXT:   Magic: Magic64 (0xFEEDFACF)
MACHO64-NEXT:   CpuType: X86-64 (0x1000007)
MACHO64-NEXT:   CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
MACHO64-NEXT:   FileType: Relocatable (0x1)
MACHO64-NEXT:   NumOfLoadCommands: 3
MACHO64-NEXT:   SizeOfLoadCommands: 336
MACHO64-NEXT:   Flags [ (0x2000)
MACHO64-NEXT:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
MACHO64-NEXT:   ]
MACHO64-NEXT:   Reserved: 0x0
MACHO64-NEXT: }

MACHO-PPC:      File: {{(.*[/\\])?}}trivial.obj.macho-ppc
MACHO-PPC-NEXT: Format: Mach-O 32-bit ppc
MACHO-PPC-NEXT: Arch: powerpc
MACHO-PPC-NEXT: AddressSize: 32bit
MACHO-PPC-NEXT: MachHeader {
MACHO-PPC-NEXT:   Magic: Magic (0xFEEDFACE)
MACHO-PPC-NEXT:   CpuType: PowerPC (0x12)
MACHO-PPC-NEXT:   CpuSubType: CPU_SUBTYPE_POWERPC_ALL (0x0)
MACHO-PPC-NEXT:   FileType: Relocatable (0x1)
MACHO-PPC-NEXT:   NumOfLoadCommands: 3
MACHO-PPC-NEXT:   SizeOfLoadCommands: 500
MACHO-PPC-NEXT:   Flags [ (0x2000)
MACHO-PPC-NEXT:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
MACHO-PPC-NEXT:   ]
MACHO-PPC-NEXT: }

MACHO-PPC64:      File: {{(.*[/\\])?}}trivial.obj.macho-ppc64
MACHO-PPC64-NEXT: Format: Mach-O 64-bit ppc64
MACHO-PPC64-NEXT: Arch: powerpc64
MACHO-PPC64-NEXT: AddressSize: 64bit
MACHO-PPC64-NEXT: MachHeader {
MACHO-PPC64-NEXT:   Magic: Magic64 (0xFEEDFACF)
MACHO-PPC64-NEXT:   CpuType: PowerPC64 (0x1000012)
MACHO-PPC64-NEXT:   CpuSubtype: 0x0
MACHO-PPC64-NEXT:   FileType: Relocatable (0x1)
MACHO-PPC64-NEXT:   NumOfLoadCommands: 3
MACHO-PPC64-NEXT:   SizeOfLoadCommands: 576
MACHO-PPC64-NEXT:   Flags [ (0x2000)
MACHO-PPC64-NEXT:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
MACHO-PPC64-NEXT:   ]
MACHO-PPC64-NEXT:   Reserved: 0x0
MACHO-PPC64-NEXT: }

MACHO-ARM:      File: {{(.*[/\\])?}}trivial.obj.macho-arm
MACHO-ARM-NEXT: Format: Mach-O arm
MACHO-ARM-NEXT: Arch: arm
MACHO-ARM-NEXT: AddressSize: 32bit
MACHO-ARM-NEXT: MachHeader {
MACHO-ARM-NEXT:   Magic: Magic (0xFEEDFACE)
MACHO-ARM-NEXT:   CpuType: Arm (0xC)
MACHO-ARM-NEXT:   CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
MACHO-ARM-NEXT:   FileType: Relocatable (0x1)
MACHO-ARM-NEXT:   NumOfLoadCommands: 3
MACHO-ARM-NEXT:   SizeOfLoadCommands: 636
MACHO-ARM-NEXT:   Flags [ (0x2000)
MACHO-ARM-NEXT:     MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
MACHO-ARM-NEXT:   ]
MACHO-ARM-NEXT: }

PE32:      File: {{(.*[/\\])?}}trivial.exe.coff-i386
PE32-NEXT: Format: COFF-i386
PE32-NEXT: Arch: i386
PE32-NEXT: AddressSize: 32bit
PE32-NEXT: ImageFileHeader {
PE32-NEXT:   Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
PE32-NEXT:   SectionCount: 3
PE32-NEXT:   TimeDateStamp: 2013-07-16 00:39:15 (0x51E49633)
PE32-NEXT:   PointerToSymbolTable: 0x0
PE32-NEXT:   SymbolCount: 0
PE32-NEXT:   OptionalHeaderSize: 224
PE32-NEXT:   Characteristics [ (0x102)
PE32-NEXT:     IMAGE_FILE_32BIT_MACHINE (0x100)
PE32-NEXT:     IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
PE32-NEXT:   ]
PE32-NEXT: }
PE32-NEXT: ImageOptionalHeader {
PE32-NEXT:   MajorLinkerVersion: 11
PE32-NEXT:   MinorLinkerVersion: 0
PE32-NEXT:   SizeOfCode: 512
PE32-NEXT:   SizeOfInitializedData: 1024
PE32-NEXT:   SizeOfUninitializedData: 0
PE32-NEXT:   AddressOfEntryPoint: 0x1000
PE32-NEXT:   BaseOfCode: 0x1000
PE32-NEXT:   BaseOfData: 0x2000
PE32-NEXT:   ImageBase: 0x400000
PE32-NEXT:   SectionAlignment: 4096
PE32-NEXT:   FileAlignment: 512
PE32-NEXT:   MajorOperatingSystemVersion: 6
PE32-NEXT:   MinorOperatingSystemVersion: 0
PE32-NEXT:   MajorImageVersion: 0
PE32-NEXT:   MinorImageVersion: 0
PE32-NEXT:   MajorSubsystemVersion: 6
PE32-NEXT:   MinorSubsystemVersion: 0
PE32-NEXT:   SizeOfImage: 16384
PE32-NEXT:   SizeOfHeaders: 1024
PE32-NEXT:   Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
PE32-NEXT:   Characteristics [ (0x8140)
PE32-NEXT:     IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
PE32-NEXT:     IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
PE32-NEXT:     IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
PE32-NEXT:   ]
PE32-NEXT:   SizeOfStackReserve: 1048576
PE32-NEXT:   SizeOfStackCommit: 4096
PE32-NEXT:   SizeOfHeapReserve: 1048576
PE32-NEXT:   SizeOfHeapCommit: 4096
PE32-NEXT:   NumberOfRvaAndSize: 16
PE32-NEXT:   DataDirectory {
PE32-NEXT:     ExportTableRVA: 0x0
PE32-NEXT:     ExportTableSize: 0x0
PE32-NEXT:     ImportTableRVA: 0x0
PE32-NEXT:     ImportTableSize: 0x0
PE32-NEXT:     ResourceTableRVA: 0x0
PE32-NEXT:     ResourceTableSize: 0x0
PE32-NEXT:     ExceptionTableRVA: 0x0
PE32-NEXT:     ExceptionTableSize: 0x0
PE32-NEXT:     CertificateTableRVA: 0x0
PE32-NEXT:     CertificateTableSize: 0x0
PE32-NEXT:     BaseRelocationTableRVA: 0x3000
PE32-NEXT:     BaseRelocationTableSize: 0xC
PE32-NEXT:     DebugRVA: 0x0
PE32-NEXT:     DebugSize: 0x0
PE32-NEXT:     ArchitectureRVA: 0x0
PE32-NEXT:     ArchitectureSize: 0x0
PE32-NEXT:     GlobalPtrRVA: 0x0
PE32-NEXT:     GlobalPtrSize: 0x0
PE32-NEXT:     TLSTableRVA: 0x0
PE32-NEXT:     TLSTableSize: 0x0
PE32-NEXT:     LoadConfigTableRVA: 0x0
PE32-NEXT:     LoadConfigTableSize: 0x0
PE32-NEXT:     BoundImportRVA: 0x0
PE32-NEXT:     BoundImportSize: 0x0
PE32-NEXT:     IATRVA: 0x0
PE32-NEXT:     IATSize: 0x0
PE32-NEXT:     DelayImportDescriptorRVA: 0x0
PE32-NEXT:     DelayImportDescriptorSize: 0x0
PE32-NEXT:     CLRRuntimeHeaderRVA: 0x0
PE32-NEXT:     CLRRuntimeHeaderSize: 0x0
PE32-NEXT:     ReservedRVA: 0x0
PE32-NEXT:     ReservedSize: 0x0
PE32-NEXT:   }
PE32-NEXT: }
PE32-NEXT: DOSHeader {
PE32-NEXT:   Magic: MZ
PE32-NEXT:   UsedBytesInTheLastPage: 144
PE32-NEXT:   FileSizeInPages: 3
PE32-NEXT:   NumberOfRelocationItems: 0
PE32-NEXT:   HeaderSizeInParagraphs: 4
PE32-NEXT:   MinimumExtraParagraphs: 0
PE32-NEXT:   MaximumExtraParagraphs: 65535
PE32-NEXT:   InitialRelativeSS: 0
PE32-NEXT:   InitialSP: 184
PE32-NEXT:   Checksum: 0
PE32-NEXT:   InitialIP: 0
PE32-NEXT:   InitialRelativeCS: 0
PE32-NEXT:   AddressOfRelocationTable: 64
PE32-NEXT:   OverlayNumber: 0
PE32-NEXT:   OEMid: 0
PE32-NEXT:   OEMinfo: 0
PE32-NEXT:   AddressOfNewExeHeader: 176
PE32-NEXT: }

COFF-UNKNOWN:      Format: COFF-<unknown arch>
COFF-UNKNOWN-NEXT: Arch: unknown
COFF-UNKNOWN-NEXT: AddressSize: 32bit
COFF-UNKNOWN-NEXT: ImageFileHeader {
COFF-UNKNOWN-NEXT:   Machine: IMAGE_FILE_MACHINE_UNKNOWN (0x0)
COFF-UNKNOWN-NEXT:   SectionCount: 3
COFF-UNKNOWN-NEXT:   TimeDateStamp: 2013-11-14 21:19:28 (0x52853E60)
COFF-UNKNOWN-NEXT:   PointerToSymbolTable: 0xF8
COFF-UNKNOWN-NEXT:   SymbolCount: 11
COFF-UNKNOWN-NEXT:   OptionalHeaderSize: 0
COFF-UNKNOWN-NEXT:   Characteristics [ (0x0)
COFF-UNKNOWN-NEXT:   ]
COFF-UNKNOWN-NEXT: }

COFF-IMPORTLIB:      Format: COFF-import-file
COFF-IMPORTLIB-NEXT: Type: code
COFF-IMPORTLIB-NEXT: Name type: noprefix
COFF-IMPORTLIB-NEXT: Symbol: __imp__func
COFF-IMPORTLIB-NEXT: Symbol: _func

ELF-LANAI:      Format: ELF32-lanai
ELF-LANAI-NEXT: Arch: lanai
ELF-LANAI-NEXT: AddressSize: 32bit
ELF-LANAI-NEXT: LoadName:
ELF-LANAI-NEXT: ElfHeader {
ELF-LANAI-NEXT:   Ident {
ELF-LANAI-NEXT:     Magic: (7F 45 4C 46)
ELF-LANAI-NEXT:     Class: 32-bit (0x1)
ELF-LANAI-NEXT:     DataEncoding: BigEndian (0x2)
ELF-LANAI-NEXT:     FileVersion: 1
ELF-LANAI-NEXT:     OS/ABI: SystemV (0x0)
ELF-LANAI-NEXT:     ABIVersion: 0
ELF-LANAI-NEXT:     Unused: (00 00 00 00 00 00 00)
ELF-LANAI-NEXT:   }
ELF-LANAI-NEXT:   Type: Relocatable (0x1)
ELF-LANAI-NEXT:   Machine: EM_LANAI (0xF4)
ELF-LANAI-NEXT:   Version: 1
ELF-LANAI-NEXT:   Entry: 0x0
ELF-LANAI-NEXT:   ProgramHeaderOffset: 0x0
ELF-LANAI-NEXT:   SectionHeaderOffset: 0x1A0
ELF-LANAI-NEXT:   Flags [ (0x0)
ELF-LANAI-NEXT:   ]
ELF-LANAI-NEXT:   HeaderSize: 52
ELF-LANAI-NEXT:   ProgramHeaderEntrySize: 0
ELF-LANAI-NEXT:   ProgramHeaderCount: 0
ELF-LANAI-NEXT:   SectionHeaderEntrySize: 40
ELF-LANAI-NEXT:   SectionHeaderCount: 8
ELF-LANAI-NEXT:   StringTableSectionIndex: 1
ELF-LANAI-NEXT: }