--- /dev/null
+# RUN: yaml2obj %s --docnum=1 -o %t.arm
+# RUN: llvm-readobj -h %t.arm \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm --check-prefix ARM
+
+# ARM:File: [[FILE]]
+# ARM-NEXT:Format: COFF-ARM
+# ARM-NEXT:Arch: thumb
+# ARM-NEXT:AddressSize: 32bit
+# ARM-NEXT:ImageFileHeader {
+# ARM-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
+# ARM-NEXT: SectionCount: 0
+# ARM-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# ARM-NEXT: PointerToSymbolTable: 0x0
+# ARM-NEXT: SymbolCount: 0
+# ARM-NEXT: OptionalHeaderSize: 0
+# ARM-NEXT: Characteristics [ (0x0)
+# ARM-NEXT: ]
+# ARM-NEXT:}
+# ARM-NOT:{{.}}
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_ARMNT
+ Characteristics: [ ]
+sections:
+symbols:
+
+# RUN: yaml2obj %s --docnum=2 -o %t.arm64
+# RUN: llvm-readobj -h %t.arm64 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64 --check-prefix ARM64
+
+# ARM64:File: [[FILE]]
+# ARM64-NEXT:Format: COFF-ARM64
+# ARM64-NEXT:Arch: aarch64
+# ARM64-NEXT:AddressSize: 64bit
+# ARM64-NEXT:ImageFileHeader {
+# ARM64-NEXT: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
+# ARM64-NEXT: SectionCount: 0
+# ARM64-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# ARM64-NEXT: PointerToSymbolTable: 0x0
+# ARM64-NEXT: SymbolCount: 0
+# ARM64-NEXT: OptionalHeaderSize: 0
+# ARM64-NEXT: Characteristics [ (0x0)
+# ARM64-NEXT: ]
+# ARM64-NEXT:}
+# ARM64-NOT:{{.}}
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_ARM64
+ Characteristics: [ ]
+sections:
+symbols:
+
+# RUN: yaml2obj %s --docnum=3 -o %t.i386
+# RUN: llvm-readobj -h %t.i386 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386
+
+# I386:File: [[FILE]]
+# I386-NEXT:Format: COFF-i386
+# I386-NEXT:Arch: i386
+# I386-NEXT:AddressSize: 32bit
+# I386-NEXT:ImageFileHeader {
+# I386-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
+# I386-NEXT: SectionCount: 0
+# I386-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# I386-NEXT: PointerToSymbolTable: 0x0
+# I386-NEXT: SymbolCount: 0
+# I386-NEXT: OptionalHeaderSize: 0
+# I386-NEXT: Characteristics [ (0x0)
+# I386-NEXT: ]
+# I386-NEXT:}
+# I386-NOT:{{.}}
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ ]
+sections:
+symbols:
+
+# RUN: yaml2obj %s --docnum=4 -o %t.x86-64
+# RUN: llvm-readobj -h %t.x86-64 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.x86-64 --check-prefix X86-64
+
+# X86-64:File: [[FILE]]
+# X86-64-NEXT:Format: COFF-x86-64
+# X86-64-NEXT:Arch: x86_64
+# X86-64-NEXT:AddressSize: 64bit
+# X86-64-NEXT:ImageFileHeader {
+# X86-64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
+# X86-64-NEXT: SectionCount: 0
+# X86-64-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# X86-64-NEXT: PointerToSymbolTable: 0x0
+# X86-64-NEXT: SymbolCount: 0
+# X86-64-NEXT: OptionalHeaderSize: 0
+# X86-64-NEXT: Characteristics [ (0x0)
+# X86-64-NEXT: ]
+# X86-64-NEXT:}
+# X86-64-NOT:{{.}}
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ ]
+sections:
+symbols:
+
+# RUN: yaml2obj %s --docnum=5 -o %t.i386
+# RUN: llvm-readobj -h %t.i386 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386-CUSTOM-HEADER
+
+# I386-CUSTOM-HEADER:File: [[FILE]]
+# I386-CUSTOM-HEADER-NEXT:Format: COFF-i386
+# I386-CUSTOM-HEADER-NEXT:Arch: i386
+# I386-CUSTOM-HEADER-NEXT:AddressSize: 32bit
+# I386-CUSTOM-HEADER-NEXT:ImageFileHeader {
+# I386-CUSTOM-HEADER-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
+# I386-CUSTOM-HEADER-NEXT: SectionCount: 0
+# I386-CUSTOM-HEADER-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# I386-CUSTOM-HEADER-NEXT: PointerToSymbolTable: 0x0
+# I386-CUSTOM-HEADER-NEXT: SymbolCount: 0
+# I386-CUSTOM-HEADER-NEXT: OptionalHeaderSize: 224
+# I386-CUSTOM-HEADER-NEXT: Characteristics [ (0x102)
+# I386-CUSTOM-HEADER-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100)
+# I386-CUSTOM-HEADER-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
+# I386-CUSTOM-HEADER-NEXT: ]
+# I386-CUSTOM-HEADER-NEXT:}
+# I386-CUSTOM-HEADER-NEXT:ImageOptionalHeader {
+# I386-CUSTOM-HEADER-NEXT: Magic: 0x10B
+# I386-CUSTOM-HEADER-NEXT: MajorLinkerVersion: 0
+# I386-CUSTOM-HEADER-NEXT: MinorLinkerVersion: 0
+# I386-CUSTOM-HEADER-NEXT: SizeOfCode: 0
+# I386-CUSTOM-HEADER-NEXT: SizeOfInitializedData: 0
+# I386-CUSTOM-HEADER-NEXT: SizeOfUninitializedData: 0
+# I386-CUSTOM-HEADER-NEXT: AddressOfEntryPoint: 0x1000
+# I386-CUSTOM-HEADER-NEXT: BaseOfCode: 0x0
+# I386-CUSTOM-HEADER-NEXT: BaseOfData: 0x0
+# I386-CUSTOM-HEADER-NEXT: ImageBase: 0x400000
+# I386-CUSTOM-HEADER-NEXT: SectionAlignment: 4096
+# I386-CUSTOM-HEADER-NEXT: FileAlignment: 512
+# I386-CUSTOM-HEADER-NEXT: MajorOperatingSystemVersion: 6
+# I386-CUSTOM-HEADER-NEXT: MinorOperatingSystemVersion: 0
+# I386-CUSTOM-HEADER-NEXT: MajorImageVersion: 0
+# I386-CUSTOM-HEADER-NEXT: MinorImageVersion: 0
+# I386-CUSTOM-HEADER-NEXT: MajorSubsystemVersion: 6
+# I386-CUSTOM-HEADER-NEXT: MinorSubsystemVersion: 0
+# I386-CUSTOM-HEADER-NEXT: SizeOfImage: 4096
+# I386-CUSTOM-HEADER-NEXT: SizeOfHeaders: 512
+# I386-CUSTOM-HEADER-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
+# I386-CUSTOM-HEADER-NEXT: Characteristics [ (0x8140)
+# I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
+# I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
+# I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
+# I386-CUSTOM-HEADER-NEXT: ]
+# I386-CUSTOM-HEADER-NEXT: SizeOfStackReserve: 1048576
+# I386-CUSTOM-HEADER-NEXT: SizeOfStackCommit: 4096
+# I386-CUSTOM-HEADER-NEXT: SizeOfHeapReserve: 1048576
+# I386-CUSTOM-HEADER-NEXT: SizeOfHeapCommit: 4096
+# I386-CUSTOM-HEADER-NEXT: NumberOfRvaAndSize: 16
+# I386-CUSTOM-HEADER-NEXT: DataDirectory {
+# I386-CUSTOM-HEADER-NEXT: ExportTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ExportTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: ImportTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ImportTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: ResourceTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ResourceTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: ExceptionTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ExceptionTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: CertificateTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: CertificateTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: BaseRelocationTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: BaseRelocationTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: DebugRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: DebugSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: ArchitectureRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ArchitectureSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: GlobalPtrRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: GlobalPtrSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: TLSTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: TLSTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: LoadConfigTableRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: LoadConfigTableSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: BoundImportRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: BoundImportSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: IATRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: IATSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: DelayImportDescriptorRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: DelayImportDescriptorSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: CLRRuntimeHeaderRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: CLRRuntimeHeaderSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: ReservedRVA: 0x0
+# I386-CUSTOM-HEADER-NEXT: ReservedSize: 0x0
+# I386-CUSTOM-HEADER-NEXT: }
+# I386-CUSTOM-HEADER-NEXT:}
+# I386-CUSTOM-HEADER-NEXT:DOSHeader {
+# I386-CUSTOM-HEADER-NEXT: Magic: MZ
+# I386-CUSTOM-HEADER-NEXT: UsedBytesInTheLastPage: 0
+# I386-CUSTOM-HEADER-NEXT: FileSizeInPages: 0
+# I386-CUSTOM-HEADER-NEXT: NumberOfRelocationItems: 0
+# I386-CUSTOM-HEADER-NEXT: HeaderSizeInParagraphs: 0
+# I386-CUSTOM-HEADER-NEXT: MinimumExtraParagraphs: 0
+# I386-CUSTOM-HEADER-NEXT: MaximumExtraParagraphs: 0
+# I386-CUSTOM-HEADER-NEXT: InitialRelativeSS: 0
+# I386-CUSTOM-HEADER-NEXT: InitialSP: 0
+# I386-CUSTOM-HEADER-NEXT: Checksum: 0
+# I386-CUSTOM-HEADER-NEXT: InitialIP: 0
+# I386-CUSTOM-HEADER-NEXT: InitialRelativeCS: 0
+# I386-CUSTOM-HEADER-NEXT: AddressOfRelocationTable: 64
+# I386-CUSTOM-HEADER-NEXT: OverlayNumber: 0
+# I386-CUSTOM-HEADER-NEXT: OEMid: 0
+# I386-CUSTOM-HEADER-NEXT: OEMinfo: 0
+# I386-CUSTOM-HEADER-NEXT: AddressOfNewExeHeader: 128
+# I386-CUSTOM-HEADER-NEXT:}
+# I386-CUSTOM-HEADER-NOT:{{.}}
+
+--- !COFF
+OptionalHeader:
+ AddressOfEntryPoint: 4096
+ ImageBase: 4194304
+ SectionAlignment: 4096
+ FileAlignment: 512
+ MajorOperatingSystemVersion: 6
+ MinorOperatingSystemVersion: 0
+ MajorImageVersion: 0
+ MinorImageVersion: 0
+ MajorSubsystemVersion: 6
+ MinorSubsystemVersion: 0
+ Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
+ DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+ SizeOfStackReserve: 1048576
+ SizeOfStackCommit: 4096
+ SizeOfHeapReserve: 1048576
+ SizeOfHeapCommit: 4096
+ ExportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ImportTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ResourceTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ExceptionTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ CertificateTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BaseRelocationTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ Debug:
+ RelativeVirtualAddress: 0
+ Size: 0
+ Architecture:
+ RelativeVirtualAddress: 0
+ Size: 0
+ GlobalPtr:
+ RelativeVirtualAddress: 0
+ Size: 0
+ TlsTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ LoadConfigTable:
+ RelativeVirtualAddress: 0
+ Size: 0
+ BoundImport:
+ RelativeVirtualAddress: 0
+ Size: 0
+ IAT:
+ RelativeVirtualAddress: 0
+ Size: 0
+ DelayImportDescriptor:
+ RelativeVirtualAddress: 0
+ Size: 0
+ ClrRuntimeHeader:
+ RelativeVirtualAddress: 0
+ Size: 0
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
+sections:
+symbols: []
+...
+
+# RUN: yaml2obj %s --docnum=6 -o %t.unknown
+# RUN: llvm-readobj -h %t.unknown \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix UNKNOWN
+
+# UNKNOWN:Format: COFF-<unknown arch>
+# UNKNOWN-NEXT:Arch: unknown
+# UNKNOWN-NEXT:AddressSize: 32bit
+# UNKNOWN-NEXT:ImageFileHeader {
+# UNKNOWN-NEXT: Machine: IMAGE_FILE_MACHINE_UNKNOWN (0x0)
+# UNKNOWN-NEXT: SectionCount: 0
+# UNKNOWN-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
+# UNKNOWN-NEXT: PointerToSymbolTable: 0x0
+# UNKNOWN-NEXT: SymbolCount: 0
+# UNKNOWN-NEXT: OptionalHeaderSize: 0
+# UNKNOWN-NEXT: Characteristics [ (0x0)
+# UNKNOWN-NEXT: ]
+# UNKNOWN-NEXT:}
+# UNKNOWN-NOT:{{.}}
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_UNKNOWN
+ Characteristics: [ ]
+sections:
+symbols:
+
+# RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix IMPORTLIB
+
+# IMPORTLIB:Format: COFF-import-file
+# IMPORTLIB-NEXT:Type: code
+# IMPORTLIB-NEXT:Name type: noprefix
+# IMPORTLIB-NEXT:Symbol: __imp__func
+# IMPORTLIB-NEXT:Symbol: _func
+# IMPORTLIB-NOT:{{.}}
--- /dev/null
+# RUN: yaml2obj %s --docnum=1 -o %t.i386
+# RUN: llvm-readobj -h %t.i386 | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386
+
+# I386:File: [[FILE]]
+# I386-NEXT:Format: ELF32-i386
+# I386-NEXT:Arch: i386
+# I386-NEXT:AddressSize: 32bit
+# I386-NEXT:LoadName: <Not found>
+# I386-NEXT:ElfHeader {
+# I386-NEXT: Ident {
+# I386-NEXT: Magic: (7F 45 4C 46)
+# I386-NEXT: Class: 32-bit (0x1)
+# I386-NEXT: DataEncoding: LittleEndian (0x1)
+# I386-NEXT: FileVersion: 1
+# I386-NEXT: OS/ABI: GNU/Linux (0x3)
+# I386-NEXT: ABIVersion: 0
+# I386-NEXT: Unused: (00 00 00 00 00 00 00)
+# I386-NEXT: }
+# I386-NEXT: Type: Relocatable (0x1)
+# I386-NEXT: Machine: EM_386 (0x3)
+# I386-NEXT: Version: 1
+# I386-NEXT: Entry: 0x0
+# I386-NEXT: ProgramHeaderOffset: 0x34
+# I386-NEXT: SectionHeaderOffset: 0x34
+# I386-NEXT: Flags [ (0x0)
+# I386-NEXT: ]
+# I386-NEXT: HeaderSize: 52
+# I386-NEXT: ProgramHeaderEntrySize: 32
+# I386-NEXT: ProgramHeaderCount: 0
+# I386-NEXT: SectionHeaderEntrySize: 40
+# I386-NEXT: SectionHeaderCount: 4
+# I386-NEXT: StringTableSectionIndex: 3
+# I386-NEXT:}
+# I386-NOT:{{.}}
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_386
+
+# RUN: yaml2obj %s --docnum=2 -o %t.x86-64
+# RUN: llvm-readobj -h %t.x86-64 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.x86-64 --check-prefix X86-64
+
+# X86-64:File: [[FILE]]
+# X86-64-NEXT:Format: ELF64-x86-64
+# X86-64-NEXT:Arch: x86_64
+# X86-64-NEXT:AddressSize: 64bit
+# X86-64-NEXT:LoadName: <Not found>
+# X86-64-NEXT:ElfHeader {
+# X86-64-NEXT: Ident {
+# X86-64-NEXT: Magic: (7F 45 4C 46)
+# X86-64-NEXT: Class: 64-bit (0x2)
+# X86-64-NEXT: DataEncoding: LittleEndian (0x1)
+# X86-64-NEXT: FileVersion: 1
+# X86-64-NEXT: OS/ABI: GNU/Linux (0x3)
+# X86-64-NEXT: ABIVersion: 0
+# X86-64-NEXT: Unused: (00 00 00 00 00 00 00)
+# X86-64-NEXT: }
+# X86-64-NEXT: Type: Relocatable (0x1)
+# X86-64-NEXT: Machine: EM_X86_64 (0x3E)
+# X86-64-NEXT: Version: 1
+# X86-64-NEXT: Entry: 0x0
+# X86-64-NEXT: ProgramHeaderOffset: 0x40
+# X86-64-NEXT: SectionHeaderOffset: 0x40
+# X86-64-NEXT: Flags [ (0x0)
+# X86-64-NEXT: ]
+# X86-64-NEXT: HeaderSize: 64
+# X86-64-NEXT: ProgramHeaderEntrySize: 56
+# X86-64-NEXT: ProgramHeaderCount: 0
+# X86-64-NEXT: SectionHeaderEntrySize: 64
+# X86-64-NEXT: SectionHeaderCount: 4
+# X86-64-NEXT: StringTableSectionIndex: 3
+# X86-64-NEXT:}
+# X86-64-NOT:{{.}}
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_X86_64
+
+# RUN: yaml2obj %s --docnum=3 -o %t.lanai
+# RUN: llvm-readobj -h %t.lanai \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.lanai --check-prefix LANAI
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: EM_LANAI
+
+# LANAI:File: [[FILE]]
+# LANAI-NEXT:Format: ELF32-lanai
+# LANAI-NEXT:Arch: lanai
+# LANAI-NEXT:AddressSize: 32bit
+# LANAI-NEXT:LoadName: <Not found>
+# LANAI-NEXT:ElfHeader {
+# LANAI-NEXT: Ident {
+# LANAI-NEXT: Magic: (7F 45 4C 46)
+# LANAI-NEXT: Class: 32-bit (0x1)
+# LANAI-NEXT: DataEncoding: BigEndian (0x2)
+# LANAI-NEXT: FileVersion: 1
+# LANAI-NEXT: OS/ABI: SystemV (0x0)
+# LANAI-NEXT: ABIVersion: 0
+# LANAI-NEXT: Unused: (00 00 00 00 00 00 00)
+# LANAI-NEXT: }
+# LANAI-NEXT: Type: Relocatable (0x1)
+# LANAI-NEXT: Machine: EM_LANAI (0xF4)
+# LANAI-NEXT: Version: 1
+# LANAI-NEXT: Entry: 0x0
+# LANAI-NEXT: ProgramHeaderOffset: 0x34
+# LANAI-NEXT: SectionHeaderOffset: 0x34
+# LANAI-NEXT: Flags [ (0x0)
+# LANAI-NEXT: ]
+# LANAI-NEXT: HeaderSize: 52
+# LANAI-NEXT: ProgramHeaderEntrySize: 32
+# LANAI-NEXT: ProgramHeaderCount: 0
+# LANAI-NEXT: SectionHeaderEntrySize: 40
+# LANAI-NEXT: SectionHeaderCount: 4
+# LANAI-NEXT: StringTableSectionIndex: 3
+# LANAI-NEXT:}
+# LANAI-NOT:{{.}}
+++ /dev/null
-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-arm64 \
-RUN: | FileCheck %s -check-prefix COFF-ARM64
-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
-RUN: llvm-readobj -h %p/Inputs/trivial.obj.wasm \
-RUN: | FileCheck %s -check-prefix WASM
-
-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: }
-
-COFF-ARM64: File: {{(.*[/\\])?}}trivial.obj.coff-arm64
-COFF-ARM64-NEXT: Format: COFF-ARM64
-COFF-ARM64-NEXT: Arch: aarch64
-COFF-ARM64-NEXT: AddressSize: 64bit
-COFF-ARM64-NEXT: ImageFileHeader {
-COFF-ARM64-NEXT: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
-COFF-ARM64-NEXT: SectionCount: 1
-COFF-ARM64-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
-COFF-ARM64-NEXT: PointerToSymbolTable: 0x44
-COFF-ARM64-NEXT: SymbolCount: 3
-COFF-ARM64-NEXT: OptionalHeaderSize: 0
-COFF-ARM64-NEXT: Characteristics [ (0x0)
-COFF-ARM64-NEXT: ]
-COFF-ARM64-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: Magic: 0x10B
-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: }
-
-WASM: Format: WASM
-WASM-NEXT: Arch: wasm32
-WASM-NEXT: AddressSize: 32bit
-WASM-NEXT: Version: 0x1
--- /dev/null
+# RUN: yaml2obj %s --docnum=1 -o %t.i386
+# RUN: llvm-readobj -h %t.i386 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386
+
+# I386:File: [[FILE]]
+# I386-NEXT:Format: Mach-O 32-bit i386
+# I386-NEXT:Arch: i386
+# I386-NEXT:AddressSize: 32bit
+# I386-NEXT:MachHeader {
+# I386-NEXT: Magic: Magic (0xFEEDFACE)
+# I386-NEXT: CpuType: X86 (0x7)
+# I386-NEXT: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3)
+# I386-NEXT: FileType: Relocatable (0x1)
+# I386-NEXT: NumOfLoadCommands: 0
+# I386-NEXT: SizeOfLoadCommands: 0
+# I386-NEXT: Flags [ (0x2000)
+# I386-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
+# I386-NEXT: ]
+# I386-NEXT:}
+# I386-NOT:{{.}}
+
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACE
+ cputype: 0x00000007
+ cpusubtype: 0x00000003
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00002000
+
+# RUN: yaml2obj %s --docnum=2 -o %t.x86-64
+# RUN: llvm-readobj -h %t.x86-64 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.x86-64 --check-prefix X86-64
+
+# X86-64:File: [[FILE]]
+# X86-64-NEXT:Format: Mach-O 64-bit x86-64
+# X86-64-NEXT:Arch: x86_64
+# X86-64-NEXT:AddressSize: 64bit
+# X86-64-NEXT:MachHeader {
+# X86-64-NEXT: Magic: Magic64 (0xFEEDFACF)
+# X86-64-NEXT: CpuType: X86-64 (0x1000007)
+# X86-64-NEXT: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3)
+# X86-64-NEXT: FileType: Relocatable (0x1)
+# X86-64-NEXT: NumOfLoadCommands: 0
+# X86-64-NEXT: SizeOfLoadCommands: 0
+# X86-64-NEXT: Flags [ (0x2000)
+# X86-64-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
+# X86-64-NEXT: ]
+# X86-64-NEXT: Reserved: 0x0
+# X86-64-NEXT:}
+# X86-64-NOT:{{.}}
+
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x01000007
+ cpusubtype: 0x00000003
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00002000
+ reserved: 0x00000000
+
+# RUN: yaml2obj %s --docnum=3 -o %t.ppc
+# RUN: llvm-readobj -h %t.ppc \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.ppc --check-prefix PPC
+
+# PPC:File: [[FILE]]
+# PPC-NEXT:Format: Mach-O 32-bit ppc
+# PPC-NEXT:Arch: powerpc
+# PPC-NEXT:AddressSize: 32bit
+# PPC-NEXT:MachHeader {
+# PPC-NEXT: Magic: Magic (0xFEEDFACE)
+# PPC-NEXT: CpuType: PowerPC (0x12)
+# PPC-NEXT: CpuSubType: CPU_SUBTYPE_POWERPC_ALL (0x0)
+# PPC-NEXT: FileType: Relocatable (0x1)
+# PPC-NEXT: NumOfLoadCommands: 0
+# PPC-NEXT: SizeOfLoadCommands: 0
+# PPC-NEXT: Flags [ (0x2000)
+# PPC-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
+# PPC-NEXT: ]
+# PPC-NEXT:}
+# PPC-NOT:{{.}}
+
+--- !mach-o
+IsLittleEndian: false
+FileHeader:
+ magic: 0xFEEDFACE
+ cputype: 0x00000012
+ cpusubtype: 0x00000000
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00002000
+
+# RUN: yaml2obj %s --docnum=4 -o %t.ppc64
+# RUN: llvm-readobj -h %t.ppc64 \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.ppc64 --check-prefix PPC64
+
+# PPC64:File: [[FILE]]
+# PPC64-NEXT:Format: Mach-O 64-bit ppc64
+# PPC64-NEXT:Arch: powerpc64
+# PPC64-NEXT:AddressSize: 64bit
+# PPC64-NEXT:MachHeader {
+# PPC64-NEXT: Magic: Magic64 (0xFEEDFACF)
+# PPC64-NEXT: CpuType: PowerPC64 (0x1000012)
+# PPC64-NEXT: CpuSubtype: 0x0
+# PPC64-NEXT: FileType: Relocatable (0x1)
+# PPC64-NEXT: NumOfLoadCommands: 0
+# PPC64-NEXT: SizeOfLoadCommands: 0
+# PPC64-NEXT: Flags [ (0x2000)
+# PPC64-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
+# PPC64-NEXT: ]
+# PPC64-NEXT: Reserved: 0x0
+# PPC64-NEXT:}
+# PPC64-NOT:{{.}}
+
+--- !mach-o
+IsLittleEndian: false
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x01000012
+ cpusubtype: 0x00000000
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00002000
+ reserved: 0x00000000
+
+# RUN: yaml2obj %s --docnum=5 -o %t.arm
+# RUN: llvm-readobj -h %t.arm \
+# RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm --check-prefix ARM
+
+# ARM:File: [[FILE]]
+# ARM-NEXT:Format: Mach-O arm
+# ARM-NEXT:Arch: arm
+# ARM-NEXT:AddressSize: 32bit
+# ARM-NEXT:MachHeader {
+# ARM-NEXT: Magic: Magic (0xFEEDFACE)
+# ARM-NEXT: CpuType: Arm (0xC)
+# ARM-NEXT: CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
+# ARM-NEXT: FileType: Relocatable (0x1)
+# ARM-NEXT: NumOfLoadCommands: 0
+# ARM-NEXT: SizeOfLoadCommands: 0
+# ARM-NEXT: Flags [ (0x2000)
+# ARM-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
+# ARM-NEXT: ]
+# ARM-NEXT:}
+# ARM-NOT:{{.}}
+
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACE
+ cputype: 0x0000000C
+ cpusubtype: 0x00000009
+ filetype: 0x00000001
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x00002000
--- /dev/null
+# RUN: yaml2obj %s -o %t.wasm
+# RUN: llvm-readobj -h %t.wasm \
+# RUN: | FileCheck %s -DFILE=%t.wasm --strict-whitespace --match-full-lines
+
+# CHECK:File: [[FILE]]
+# CHECK-NEXT:Format: WASM
+# CHECK-NEXT:Arch: wasm32
+# CHECK-NEXT:AddressSize: 32bit
+# CHECK-NEXT:Version: 0x1
+# CHECK-NOT:{{.}}
+
+--- !WASM
+FileHeader:
+ Version: 0x00000001