1 # RUN: yaml2obj %s --docnum=1 -o %t.arm
2 # RUN: llvm-readobj -h %t.arm \
3 # RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm --check-prefix ARM
6 # ARM-NEXT:Format: COFF-ARM
8 # ARM-NEXT:AddressSize: 32bit
9 # ARM-NEXT:ImageFileHeader {
10 # ARM-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT (0x1C4)
11 # ARM-NEXT: SectionCount: 0
12 # ARM-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
13 # ARM-NEXT: PointerToSymbolTable: 0x0
14 # ARM-NEXT: SymbolCount: 0
15 # ARM-NEXT: StringTableSize: 0
16 # ARM-NEXT: OptionalHeaderSize: 0
17 # ARM-NEXT: Characteristics [ (0x0)
24 Machine: IMAGE_FILE_MACHINE_ARMNT
29 # RUN: yaml2obj %s --docnum=2 -o %t.arm64
30 # RUN: llvm-readobj -h %t.arm64 \
31 # RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.arm64 --check-prefix ARM64
33 # ARM64:File: [[FILE]]
34 # ARM64-NEXT:Format: COFF-ARM64
35 # ARM64-NEXT:Arch: aarch64
36 # ARM64-NEXT:AddressSize: 64bit
37 # ARM64-NEXT:ImageFileHeader {
38 # ARM64-NEXT: Machine: IMAGE_FILE_MACHINE_ARM64 (0xAA64)
39 # ARM64-NEXT: SectionCount: 0
40 # ARM64-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
41 # ARM64-NEXT: PointerToSymbolTable: 0x0
42 # ARM64-NEXT: SymbolCount: 0
43 # ARM64-NEXT: StringTableSize: 0
44 # ARM64-NEXT: OptionalHeaderSize: 0
45 # ARM64-NEXT: Characteristics [ (0x0)
52 Machine: IMAGE_FILE_MACHINE_ARM64
57 # RUN: yaml2obj %s --docnum=3 -o %t.i386
58 # RUN: llvm-readobj -h %t.i386 \
59 # RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386
62 # I386-NEXT:Format: COFF-i386
63 # I386-NEXT:Arch: i386
64 # I386-NEXT:AddressSize: 32bit
65 # I386-NEXT:ImageFileHeader {
66 # I386-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
67 # I386-NEXT: SectionCount: 0
68 # I386-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
69 # I386-NEXT: PointerToSymbolTable: 0x0
70 # I386-NEXT: SymbolCount: 0
71 # I386-NEXT: StringTableSize: 0
72 # I386-NEXT: OptionalHeaderSize: 0
73 # I386-NEXT: Characteristics [ (0x0)
80 Machine: IMAGE_FILE_MACHINE_I386
85 # RUN: yaml2obj %s --docnum=4 -o %t.x86-64
86 # RUN: llvm-readobj -h %t.x86-64 \
87 # RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.x86-64 --check-prefix X86-64
89 # X86-64:File: [[FILE]]
90 # X86-64-NEXT:Format: COFF-x86-64
91 # X86-64-NEXT:Arch: x86_64
92 # X86-64-NEXT:AddressSize: 64bit
93 # X86-64-NEXT:ImageFileHeader {
94 # X86-64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
95 # X86-64-NEXT: SectionCount: 0
96 # X86-64-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
97 # X86-64-NEXT: PointerToSymbolTable: 0x0
98 # X86-64-NEXT: SymbolCount: 0
99 # X86-64-NEXT: StringTableSize: 0
100 # X86-64-NEXT: OptionalHeaderSize: 0
101 # X86-64-NEXT: Characteristics [ (0x0)
108 Machine: IMAGE_FILE_MACHINE_AMD64
113 # RUN: yaml2obj %s --docnum=5 -o %t.i386
114 # RUN: llvm-readobj -h %t.i386 \
115 # RUN: | FileCheck %s --strict-whitespace --match-full-lines -DFILE=%t.i386 --check-prefix I386-CUSTOM-HEADER
117 # I386-CUSTOM-HEADER:File: [[FILE]]
118 # I386-CUSTOM-HEADER-NEXT:Format: COFF-i386
119 # I386-CUSTOM-HEADER-NEXT:Arch: i386
120 # I386-CUSTOM-HEADER-NEXT:AddressSize: 32bit
121 # I386-CUSTOM-HEADER-NEXT:ImageFileHeader {
122 # I386-CUSTOM-HEADER-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
123 # I386-CUSTOM-HEADER-NEXT: SectionCount: 0
124 # I386-CUSTOM-HEADER-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
125 # I386-CUSTOM-HEADER-NEXT: PointerToSymbolTable: 0x0
126 # I386-CUSTOM-HEADER-NEXT: SymbolCount: 0
127 # I386-CUSTOM-HEADER-NEXT: StringTableSize: 0
128 # I386-CUSTOM-HEADER-NEXT: OptionalHeaderSize: 224
129 # I386-CUSTOM-HEADER-NEXT: Characteristics [ (0x102)
130 # I386-CUSTOM-HEADER-NEXT: IMAGE_FILE_32BIT_MACHINE (0x100)
131 # I386-CUSTOM-HEADER-NEXT: IMAGE_FILE_EXECUTABLE_IMAGE (0x2)
132 # I386-CUSTOM-HEADER-NEXT: ]
133 # I386-CUSTOM-HEADER-NEXT:}
134 # I386-CUSTOM-HEADER-NEXT:ImageOptionalHeader {
135 # I386-CUSTOM-HEADER-NEXT: Magic: 0x10B
136 # I386-CUSTOM-HEADER-NEXT: MajorLinkerVersion: 0
137 # I386-CUSTOM-HEADER-NEXT: MinorLinkerVersion: 0
138 # I386-CUSTOM-HEADER-NEXT: SizeOfCode: 0
139 # I386-CUSTOM-HEADER-NEXT: SizeOfInitializedData: 0
140 # I386-CUSTOM-HEADER-NEXT: SizeOfUninitializedData: 0
141 # I386-CUSTOM-HEADER-NEXT: AddressOfEntryPoint: 0x1000
142 # I386-CUSTOM-HEADER-NEXT: BaseOfCode: 0x0
143 # I386-CUSTOM-HEADER-NEXT: BaseOfData: 0x0
144 # I386-CUSTOM-HEADER-NEXT: ImageBase: 0x400000
145 # I386-CUSTOM-HEADER-NEXT: SectionAlignment: 4096
146 # I386-CUSTOM-HEADER-NEXT: FileAlignment: 512
147 # I386-CUSTOM-HEADER-NEXT: MajorOperatingSystemVersion: 6
148 # I386-CUSTOM-HEADER-NEXT: MinorOperatingSystemVersion: 0
149 # I386-CUSTOM-HEADER-NEXT: MajorImageVersion: 0
150 # I386-CUSTOM-HEADER-NEXT: MinorImageVersion: 0
151 # I386-CUSTOM-HEADER-NEXT: MajorSubsystemVersion: 6
152 # I386-CUSTOM-HEADER-NEXT: MinorSubsystemVersion: 0
153 # I386-CUSTOM-HEADER-NEXT: SizeOfImage: 4096
154 # I386-CUSTOM-HEADER-NEXT: SizeOfHeaders: 512
155 # I386-CUSTOM-HEADER-NEXT: CheckSum: 0x0
156 # I386-CUSTOM-HEADER-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
157 # I386-CUSTOM-HEADER-NEXT: Characteristics [ (0x8140)
158 # I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
159 # I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
160 # I386-CUSTOM-HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
161 # I386-CUSTOM-HEADER-NEXT: ]
162 # I386-CUSTOM-HEADER-NEXT: SizeOfStackReserve: 1048576
163 # I386-CUSTOM-HEADER-NEXT: SizeOfStackCommit: 4096
164 # I386-CUSTOM-HEADER-NEXT: SizeOfHeapReserve: 1048576
165 # I386-CUSTOM-HEADER-NEXT: SizeOfHeapCommit: 4096
166 # I386-CUSTOM-HEADER-NEXT: NumberOfRvaAndSize: 16
167 # I386-CUSTOM-HEADER-NEXT: DataDirectory {
168 # I386-CUSTOM-HEADER-NEXT: ExportTableRVA: 0x0
169 # I386-CUSTOM-HEADER-NEXT: ExportTableSize: 0x0
170 # I386-CUSTOM-HEADER-NEXT: ImportTableRVA: 0x0
171 # I386-CUSTOM-HEADER-NEXT: ImportTableSize: 0x0
172 # I386-CUSTOM-HEADER-NEXT: ResourceTableRVA: 0x0
173 # I386-CUSTOM-HEADER-NEXT: ResourceTableSize: 0x0
174 # I386-CUSTOM-HEADER-NEXT: ExceptionTableRVA: 0x0
175 # I386-CUSTOM-HEADER-NEXT: ExceptionTableSize: 0x0
176 # I386-CUSTOM-HEADER-NEXT: CertificateTableRVA: 0x0
177 # I386-CUSTOM-HEADER-NEXT: CertificateTableSize: 0x0
178 # I386-CUSTOM-HEADER-NEXT: BaseRelocationTableRVA: 0x0
179 # I386-CUSTOM-HEADER-NEXT: BaseRelocationTableSize: 0x0
180 # I386-CUSTOM-HEADER-NEXT: DebugRVA: 0x0
181 # I386-CUSTOM-HEADER-NEXT: DebugSize: 0x0
182 # I386-CUSTOM-HEADER-NEXT: ArchitectureRVA: 0x0
183 # I386-CUSTOM-HEADER-NEXT: ArchitectureSize: 0x0
184 # I386-CUSTOM-HEADER-NEXT: GlobalPtrRVA: 0x0
185 # I386-CUSTOM-HEADER-NEXT: GlobalPtrSize: 0x0
186 # I386-CUSTOM-HEADER-NEXT: TLSTableRVA: 0x0
187 # I386-CUSTOM-HEADER-NEXT: TLSTableSize: 0x0
188 # I386-CUSTOM-HEADER-NEXT: LoadConfigTableRVA: 0x0
189 # I386-CUSTOM-HEADER-NEXT: LoadConfigTableSize: 0x0
190 # I386-CUSTOM-HEADER-NEXT: BoundImportRVA: 0x0
191 # I386-CUSTOM-HEADER-NEXT: BoundImportSize: 0x0
192 # I386-CUSTOM-HEADER-NEXT: IATRVA: 0x0
193 # I386-CUSTOM-HEADER-NEXT: IATSize: 0x0
194 # I386-CUSTOM-HEADER-NEXT: DelayImportDescriptorRVA: 0x0
195 # I386-CUSTOM-HEADER-NEXT: DelayImportDescriptorSize: 0x0
196 # I386-CUSTOM-HEADER-NEXT: CLRRuntimeHeaderRVA: 0x0
197 # I386-CUSTOM-HEADER-NEXT: CLRRuntimeHeaderSize: 0x0
198 # I386-CUSTOM-HEADER-NEXT: ReservedRVA: 0x0
199 # I386-CUSTOM-HEADER-NEXT: ReservedSize: 0x0
200 # I386-CUSTOM-HEADER-NEXT: }
201 # I386-CUSTOM-HEADER-NEXT:}
202 # I386-CUSTOM-HEADER-NEXT:DOSHeader {
203 # I386-CUSTOM-HEADER-NEXT: Magic: MZ
204 # I386-CUSTOM-HEADER-NEXT: UsedBytesInTheLastPage: 0
205 # I386-CUSTOM-HEADER-NEXT: FileSizeInPages: 0
206 # I386-CUSTOM-HEADER-NEXT: NumberOfRelocationItems: 0
207 # I386-CUSTOM-HEADER-NEXT: HeaderSizeInParagraphs: 0
208 # I386-CUSTOM-HEADER-NEXT: MinimumExtraParagraphs: 0
209 # I386-CUSTOM-HEADER-NEXT: MaximumExtraParagraphs: 0
210 # I386-CUSTOM-HEADER-NEXT: InitialRelativeSS: 0
211 # I386-CUSTOM-HEADER-NEXT: InitialSP: 0
212 # I386-CUSTOM-HEADER-NEXT: Checksum: 0
213 # I386-CUSTOM-HEADER-NEXT: InitialIP: 0
214 # I386-CUSTOM-HEADER-NEXT: InitialRelativeCS: 0
215 # I386-CUSTOM-HEADER-NEXT: AddressOfRelocationTable: 64
216 # I386-CUSTOM-HEADER-NEXT: OverlayNumber: 0
217 # I386-CUSTOM-HEADER-NEXT: OEMid: 0
218 # I386-CUSTOM-HEADER-NEXT: OEMinfo: 0
219 # I386-CUSTOM-HEADER-NEXT: AddressOfNewExeHeader: 128
220 # I386-CUSTOM-HEADER-NEXT:}
221 # I386-CUSTOM-HEADER-NOT:{{.}}
225 AddressOfEntryPoint: 4096
227 SectionAlignment: 4096
229 MajorOperatingSystemVersion: 6
230 MinorOperatingSystemVersion: 0
233 MajorSubsystemVersion: 6
234 MinorSubsystemVersion: 0
235 Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
236 DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
237 SizeOfStackReserve: 1048576
238 SizeOfStackCommit: 4096
239 SizeOfHeapReserve: 1048576
240 SizeOfHeapCommit: 4096
242 RelativeVirtualAddress: 0
245 RelativeVirtualAddress: 0
248 RelativeVirtualAddress: 0
251 RelativeVirtualAddress: 0
254 RelativeVirtualAddress: 0
257 RelativeVirtualAddress: 0
260 RelativeVirtualAddress: 0
263 RelativeVirtualAddress: 0
266 RelativeVirtualAddress: 0
269 RelativeVirtualAddress: 0
272 RelativeVirtualAddress: 0
275 RelativeVirtualAddress: 0
278 RelativeVirtualAddress: 0
280 DelayImportDescriptor:
281 RelativeVirtualAddress: 0
284 RelativeVirtualAddress: 0
287 Machine: IMAGE_FILE_MACHINE_I386
288 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
293 # RUN: yaml2obj %s --docnum=6 -o %t.unknown
294 # RUN: llvm-readobj -h %t.unknown \
295 # RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix UNKNOWN
297 # UNKNOWN:Format: COFF-<unknown arch>
298 # UNKNOWN-NEXT:Arch: unknown
299 # UNKNOWN-NEXT:AddressSize: 32bit
300 # UNKNOWN-NEXT:ImageFileHeader {
301 # UNKNOWN-NEXT: Machine: IMAGE_FILE_MACHINE_UNKNOWN (0x0)
302 # UNKNOWN-NEXT: SectionCount: 0
303 # UNKNOWN-NEXT: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
304 # UNKNOWN-NEXT: PointerToSymbolTable: 0x0
305 # UNKNOWN-NEXT: SymbolCount: 0
306 # UNKNOWN-NEXT: StringTableSize: 0
307 # UNKNOWN-NEXT: OptionalHeaderSize: 0
308 # UNKNOWN-NEXT: Characteristics [ (0x0)
315 Machine: IMAGE_FILE_MACHINE_UNKNOWN
320 # RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
321 # RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix IMPORTLIB
323 # IMPORTLIB:Format: COFF-import-file-i386
324 # IMPORTLIB-NEXT:Type: code
325 # IMPORTLIB-NEXT:Name type: noprefix
326 # IMPORTLIB-NEXT:Export name: func
327 # IMPORTLIB-NEXT:Symbol: __imp__func
328 # IMPORTLIB-NEXT:Symbol: _func
329 # IMPORTLIB-NOT:{{.}}