1RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-arm \ 2RUN: | FileCheck %s -check-prefix COFF-ARM 3RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-i386 \ 4RUN: | FileCheck %s -check-prefix COFF32 5RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-x86-64 \ 6RUN: | FileCheck %s -check-prefix COFF64 7RUN: llvm-readobj -h %p/Inputs/trivial.exe.coff-i386 \ 8RUN: | FileCheck %s -check-prefix PE32 9RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-i386 \ 10RUN: | FileCheck %s -check-prefix ELF32 11RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-x86-64 \ 12RUN: | FileCheck %s -check-prefix ELF64 13RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-i386 \ 14RUN: | FileCheck %s -check-prefix MACHO32 15RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-x86-64 \ 16RUN: | FileCheck %s -check-prefix MACHO64 17RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-ppc \ 18RUN: | FileCheck %s -check-prefix MACHO-PPC 19RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-ppc64 \ 20RUN: | FileCheck %s -check-prefix MACHO-PPC64 21RUN: llvm-readobj -h %p/Inputs/trivial.obj.macho-arm \ 22RUN: | FileCheck %s -check-prefix MACHO-ARM 23RUN: llvm-readobj -h %p/Inputs/magic.coff-unknown \ 24RUN: | FileCheck %s -check-prefix COFF-UNKNOWN 25RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \ 26RUN: | FileCheck %s -check-prefix COFF-IMPORTLIB 27 28COFF-ARM: File: {{(.*[/\\])?}}trivial.obj.coff-arm 29COFF-ARM-NEXT: Format: COFF-ARM 30COFF-ARM-NEXT: Arch: thumb 31COFF-ARM-NEXT: AddressSize: 32bit 32COFF-ARM-NEXT: ImageFileHeader { 33COFF-ARM-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4) 34COFF-ARM-NEXT: SectionCount: 2 35COFF-ARM-NEXT: TimeDateStamp: 2014-03-13 02:48:34 (0x53211C82) 36COFF-ARM-NEXT: PointerToSymbolTable: 0xFF 37COFF-ARM-NEXT: SymbolCount: 6 38COFF-ARM-NEXT: OptionalHeaderSize: 0 39COFF-ARM-NEXT: Characteristics [ (0x0) 40COFF-ARM-NEXT: ] 41COFF-ARM-NEXT: } 42 43COFF32: File: {{(.*[/\\])?}}trivial.obj.coff-i386 44COFF32-NEXT: Format: COFF-i386 45COFF32-NEXT: Arch: i386 46COFF32-NEXT: AddressSize: 32bit 47COFF32-NEXT: ImageFileHeader { 48COFF32-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) 49COFF32-NEXT: SectionCount: 2 50COFF32-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E) 51COFF32-NEXT: PointerToSymbolTable: 0xA5 52COFF32-NEXT: SymbolCount: 9 53COFF32-NEXT: OptionalHeaderSize: 0 54COFF32-NEXT: Characteristics [ (0x0) 55COFF32-NEXT: ] 56COFF32-NEXT: } 57 58COFF64: File: {{(.*[/\\])?}}trivial.obj.coff-x86-64 59COFF64-NEXT: Format: COFF-x86-64 60COFF64-NEXT: Arch: x86_64 61COFF64-NEXT: AddressSize: 64bit 62COFF64-NEXT: ImageFileHeader { 63COFF64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664) 64COFF64-NEXT: SectionCount: 2 65COFF64-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E) 66COFF64-NEXT: PointerToSymbolTable: 0xAB 67COFF64-NEXT: SymbolCount: 7 68COFF64-NEXT: OptionalHeaderSize: 0 69COFF64-NEXT: Characteristics [ (0x0) 70COFF64-NEXT: ] 71COFF64-NEXT: } 72 73ELF32: File: {{(.*[/\\])?}}trivial.obj.elf-i386 74ELF32-NEXT: Format: ELF32-i386 75ELF32-NEXT: Arch: i386 76ELF32-NEXT: AddressSize: 32bit 77ELF32-NEXT: LoadName: 78ELF32-NEXT: ElfHeader { 79ELF32-NEXT: Ident { 80ELF32-NEXT: Magic: (7F 45 4C 46) 81ELF32-NEXT: Class: 32-bit (0x1) 82ELF32-NEXT: DataEncoding: LittleEndian (0x1) 83ELF32-NEXT: FileVersion: 1 84ELF32-NEXT: OS/ABI: GNU/Linux (0x3) 85ELF32-NEXT: ABIVersion: 0 86ELF32-NEXT: Unused: (00 00 00 00 00 00 00) 87ELF32-NEXT: } 88ELF32-NEXT: Type: Relocatable (0x1) 89ELF32-NEXT: Machine: EM_386 (0x3) 90ELF32-NEXT: Version: 1 91ELF32-NEXT: Entry: 0x0 92ELF32-NEXT: ProgramHeaderOffset: 0x0 93ELF32-NEXT: SectionHeaderOffset: 0xC8 94ELF32-NEXT: Flags [ (0x0) 95ELF32-NEXT: ] 96ELF32-NEXT: HeaderSize: 52 97ELF32-NEXT: ProgramHeaderEntrySize: 0 98ELF32-NEXT: ProgramHeaderCount: 0 99ELF32-NEXT: SectionHeaderEntrySize: 40 100ELF32-NEXT: SectionHeaderCount: 10 101ELF32-NEXT: StringTableSectionIndex: 7 102ELF32-NEXT: } 103 104ELF64: File: {{(.*[/\\])?}}trivial.obj.elf-x86-64 105ELF64-NEXT: Format: ELF64-x86-64 106ELF64-NEXT: Arch: x86_64 107ELF64-NEXT: AddressSize: 64bit 108ELF64-NEXT: LoadName: 109ELF64-NEXT: ElfHeader { 110ELF64-NEXT: Ident { 111ELF64-NEXT: Magic: (7F 45 4C 46) 112ELF64-NEXT: Class: 64-bit (0x2) 113ELF64-NEXT: DataEncoding: LittleEndian (0x1) 114ELF64-NEXT: FileVersion: 1 115ELF64-NEXT: OS/ABI: GNU/Linux (0x3) 116ELF64-NEXT: ABIVersion: 0 117ELF64-NEXT: Unused: (00 00 00 00 00 00 00) 118ELF64-NEXT: } 119ELF64-NEXT: Type: Relocatable (0x1) 120ELF64-NEXT: Machine: EM_X86_64 (0x3E) 121ELF64-NEXT: Version: 1 122ELF64-NEXT: Entry: 0x0 123ELF64-NEXT: ProgramHeaderOffset: 0x0 124ELF64-NEXT: SectionHeaderOffset: 0xB8 125ELF64-NEXT: Flags [ (0x0) 126ELF64-NEXT: ] 127ELF64-NEXT: HeaderSize: 64 128ELF64-NEXT: ProgramHeaderEntrySize: 0 129ELF64-NEXT: ProgramHeaderCount: 0 130ELF64-NEXT: SectionHeaderEntrySize: 64 131ELF64-NEXT: SectionHeaderCount: 10 132ELF64-NEXT: StringTableSectionIndex: 7 133ELF64-NEXT: } 134 135MACHO32: File: {{(.*[/\\])?}}trivial.obj.macho-i386 136MACHO32-NEXT: Format: Mach-O 32-bit i386 137MACHO32-NEXT: Arch: i386 138MACHO32-NEXT: AddressSize: 32bit 139MACHO32-NEXT: MachHeader { 140MACHO32-NEXT: Magic: Magic (0xFEEDFACE) 141MACHO32-NEXT: CpuType: X86 (0x7) 142MACHO32-NEXT: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3) 143MACHO32-NEXT: FileType: Relocatable (0x1) 144MACHO32-NEXT: NumOfLoadCommands: 3 145MACHO32-NEXT: SizeOfLoadCommands: 296 146MACHO32-NEXT: Flags [ (0x2000) 147MACHO32-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 148MACHO32-NEXT: ] 149MACHO32-NEXT: } 150 151MACHO64: File: {{(.*[/\\])?}}trivial.obj.macho-x86-64 152MACHO64-NEXT: Format: Mach-O 64-bit x86-64 153MACHO64-NEXT: Arch: x86_64 154MACHO64-NEXT: AddressSize: 64bit 155MACHO64-NEXT: MachHeader { 156MACHO64-NEXT: Magic: Magic64 (0xFEEDFACF) 157MACHO64-NEXT: CpuType: X86-64 (0x1000007) 158MACHO64-NEXT: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3) 159MACHO64-NEXT: FileType: Relocatable (0x1) 160MACHO64-NEXT: NumOfLoadCommands: 3 161MACHO64-NEXT: SizeOfLoadCommands: 336 162MACHO64-NEXT: Flags [ (0x2000) 163MACHO64-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 164MACHO64-NEXT: ] 165MACHO64-NEXT: Reserved: 0x0 166MACHO64-NEXT: } 167 168MACHO-PPC: File: {{(.*[/\\])?}}trivial.obj.macho-ppc 169MACHO-PPC-NEXT: Format: Mach-O 32-bit ppc 170MACHO-PPC-NEXT: Arch: powerpc 171MACHO-PPC-NEXT: AddressSize: 32bit 172MACHO-PPC-NEXT: MachHeader { 173MACHO-PPC-NEXT: Magic: Magic (0xFEEDFACE) 174MACHO-PPC-NEXT: CpuType: PowerPC (0x12) 175MACHO-PPC-NEXT: CpuSubType: CPU_SUBTYPE_POWERPC_ALL (0x0) 176MACHO-PPC-NEXT: FileType: Relocatable (0x1) 177MACHO-PPC-NEXT: NumOfLoadCommands: 3 178MACHO-PPC-NEXT: SizeOfLoadCommands: 500 179MACHO-PPC-NEXT: Flags [ (0x2000) 180MACHO-PPC-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 181MACHO-PPC-NEXT: ] 182MACHO-PPC-NEXT: } 183 184MACHO-PPC64: File: {{(.*[/\\])?}}trivial.obj.macho-ppc64 185MACHO-PPC64-NEXT: Format: Mach-O 64-bit ppc64 186MACHO-PPC64-NEXT: Arch: powerpc64 187MACHO-PPC64-NEXT: AddressSize: 64bit 188MACHO-PPC64-NEXT: MachHeader { 189MACHO-PPC64-NEXT: Magic: Magic64 (0xFEEDFACF) 190MACHO-PPC64-NEXT: CpuType: PowerPC64 (0x1000012) 191MACHO-PPC64-NEXT: CpuSubtype: 0x0 192MACHO-PPC64-NEXT: FileType: Relocatable (0x1) 193MACHO-PPC64-NEXT: NumOfLoadCommands: 3 194MACHO-PPC64-NEXT: SizeOfLoadCommands: 576 195MACHO-PPC64-NEXT: Flags [ (0x2000) 196MACHO-PPC64-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 197MACHO-PPC64-NEXT: ] 198MACHO-PPC64-NEXT: Reserved: 0x0 199MACHO-PPC64-NEXT: } 200 201MACHO-ARM: File: {{(.*[/\\])?}}trivial.obj.macho-arm 202MACHO-ARM-NEXT: Format: Mach-O arm 203MACHO-ARM-NEXT: Arch: arm 204MACHO-ARM-NEXT: AddressSize: 32bit 205MACHO-ARM-NEXT: MachHeader { 206MACHO-ARM-NEXT: Magic: Magic (0xFEEDFACE) 207MACHO-ARM-NEXT: CpuType: Arm (0xC) 208MACHO-ARM-NEXT: CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9) 209MACHO-ARM-NEXT: FileType: Relocatable (0x1) 210MACHO-ARM-NEXT: NumOfLoadCommands: 3 211MACHO-ARM-NEXT: SizeOfLoadCommands: 636 212MACHO-ARM-NEXT: Flags [ (0x2000) 213MACHO-ARM-NEXT: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 214MACHO-ARM-NEXT: ] 215MACHO-ARM-NEXT: } 216 217PE32: File: {{(.*[/\\])?}}trivial.exe.coff-i386 218PE32-NEXT: Format: COFF-i386 219PE32-NEXT: Arch: i386 220PE32-NEXT: AddressSize: 32bit 221PE32-NEXT: ImageFileHeader { 222PE32-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) 223PE32-NEXT: SectionCount: 3 224PE32-NEXT: TimeDateStamp: 2013-07-16 00:39:15 (0x51E49633) 225PE32-NEXT: PointerToSymbolTable: 0x0 226PE32-NEXT: SymbolCount: 0 227PE32-NEXT: OptionalHeaderSize: 224 228PE32-NEXT: Characteristics [ (0x102) 229PE32-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100) 230PE32-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2) 231PE32-NEXT: ] 232PE32-NEXT: } 233PE32-NEXT: ImageOptionalHeader { 234PE32-NEXT: MajorLinkerVersion: 11 235PE32-NEXT: MinorLinkerVersion: 0 236PE32-NEXT: SizeOfCode: 512 237PE32-NEXT: SizeOfInitializedData: 1024 238PE32-NEXT: SizeOfUninitializedData: 0 239PE32-NEXT: AddressOfEntryPoint: 0x1000 240PE32-NEXT: BaseOfCode: 0x1000 241PE32-NEXT: BaseOfData: 0x2000 242PE32-NEXT: ImageBase: 0x400000 243PE32-NEXT: SectionAlignment: 4096 244PE32-NEXT: FileAlignment: 512 245PE32-NEXT: MajorOperatingSystemVersion: 6 246PE32-NEXT: MinorOperatingSystemVersion: 0 247PE32-NEXT: MajorImageVersion: 0 248PE32-NEXT: MinorImageVersion: 0 249PE32-NEXT: MajorSubsystemVersion: 6 250PE32-NEXT: MinorSubsystemVersion: 0 251PE32-NEXT: SizeOfImage: 16384 252PE32-NEXT: SizeOfHeaders: 1024 253PE32-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3) 254PE32-NEXT: Characteristics [ (0x8140) 255PE32-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40) 256PE32-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100) 257PE32-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000) 258PE32-NEXT: ] 259PE32-NEXT: SizeOfStackReserve: 1048576 260PE32-NEXT: SizeOfStackCommit: 4096 261PE32-NEXT: SizeOfHeapReserve: 1048576 262PE32-NEXT: SizeOfHeapCommit: 4096 263PE32-NEXT: NumberOfRvaAndSize: 16 264PE32-NEXT: DataDirectory { 265PE32-NEXT: ExportTableRVA: 0x0 266PE32-NEXT: ExportTableSize: 0x0 267PE32-NEXT: ImportTableRVA: 0x0 268PE32-NEXT: ImportTableSize: 0x0 269PE32-NEXT: ResourceTableRVA: 0x0 270PE32-NEXT: ResourceTableSize: 0x0 271PE32-NEXT: ExceptionTableRVA: 0x0 272PE32-NEXT: ExceptionTableSize: 0x0 273PE32-NEXT: CertificateTableRVA: 0x0 274PE32-NEXT: CertificateTableSize: 0x0 275PE32-NEXT: BaseRelocationTableRVA: 0x3000 276PE32-NEXT: BaseRelocationTableSize: 0xC 277PE32-NEXT: DebugRVA: 0x0 278PE32-NEXT: DebugSize: 0x0 279PE32-NEXT: ArchitectureRVA: 0x0 280PE32-NEXT: ArchitectureSize: 0x0 281PE32-NEXT: GlobalPtrRVA: 0x0 282PE32-NEXT: GlobalPtrSize: 0x0 283PE32-NEXT: TLSTableRVA: 0x0 284PE32-NEXT: TLSTableSize: 0x0 285PE32-NEXT: LoadConfigTableRVA: 0x0 286PE32-NEXT: LoadConfigTableSize: 0x0 287PE32-NEXT: BoundImportRVA: 0x0 288PE32-NEXT: BoundImportSize: 0x0 289PE32-NEXT: IATRVA: 0x0 290PE32-NEXT: IATSize: 0x0 291PE32-NEXT: DelayImportDescriptorRVA: 0x0 292PE32-NEXT: DelayImportDescriptorSize: 0x0 293PE32-NEXT: CLRRuntimeHeaderRVA: 0x0 294PE32-NEXT: CLRRuntimeHeaderSize: 0x0 295PE32-NEXT: ReservedRVA: 0x0 296PE32-NEXT: ReservedSize: 0x0 297PE32-NEXT: } 298PE32-NEXT: } 299PE32-NEXT: DOSHeader { 300PE32-NEXT: Magic: MZ 301PE32-NEXT: UsedBytesInTheLastPage: 144 302PE32-NEXT: FileSizeInPages: 3 303PE32-NEXT: NumberOfRelocationItems: 0 304PE32-NEXT: HeaderSizeInParagraphs: 4 305PE32-NEXT: MinimumExtraParagraphs: 0 306PE32-NEXT: MaximumExtraParagraphs: 65535 307PE32-NEXT: InitialRelativeSS: 0 308PE32-NEXT: InitialSP: 184 309PE32-NEXT: Checksum: 0 310PE32-NEXT: InitialIP: 0 311PE32-NEXT: InitialRelativeCS: 0 312PE32-NEXT: AddressOfRelocationTable: 64 313PE32-NEXT: OverlayNumber: 0 314PE32-NEXT: OEMid: 0 315PE32-NEXT: OEMinfo: 0 316PE32-NEXT: AddressOfNewExeHeader: 176 317PE32-NEXT: } 318 319COFF-UNKNOWN: Format: COFF-<unknown arch> 320COFF-UNKNOWN-NEXT: Arch: unknown 321COFF-UNKNOWN-NEXT: AddressSize: 32bit 322COFF-UNKNOWN-NEXT: ImageFileHeader { 323COFF-UNKNOWN-NEXT: Machine: IMAGE_FILE_MACHINE_UNKNOWN (0x0) 324COFF-UNKNOWN-NEXT: SectionCount: 3 325COFF-UNKNOWN-NEXT: TimeDateStamp: 2013-11-14 21:19:28 (0x52853E60) 326COFF-UNKNOWN-NEXT: PointerToSymbolTable: 0xF8 327COFF-UNKNOWN-NEXT: SymbolCount: 11 328COFF-UNKNOWN-NEXT: OptionalHeaderSize: 0 329COFF-UNKNOWN-NEXT: Characteristics [ (0x0) 330COFF-UNKNOWN-NEXT: ] 331COFF-UNKNOWN-NEXT: } 332 333COFF-IMPORTLIB: Format: COFF-import-file 334COFF-IMPORTLIB-NEXT: Type: code 335COFF-IMPORTLIB-NEXT: Name type: noprefix 336COFF-IMPORTLIB-NEXT: Symbol: __imp__func 337COFF-IMPORTLIB-NEXT: Symbol: _func 338