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