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