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