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