[COFF] Dump string table size for COFF file headers
[lldb.git] / llvm / test / tools / llvm-readobj / COFF / file-headers.test
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
4
5 #      ARM:File: [[FILE]]
6 # ARM-NEXT:Format: COFF-ARM
7 # ARM-NEXT:Arch: thumb
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)
18 # ARM-NEXT:  ]
19 # ARM-NEXT:}
20 # ARM-NOT:{{.}}
21
22 --- !COFF
23 header:
24   Machine:         IMAGE_FILE_MACHINE_ARMNT
25   Characteristics: [  ]
26 sections:
27 symbols:
28
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
32
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)
46 # ARM64-NEXT:  ]
47 # ARM64-NEXT:}
48 # ARM64-NOT:{{.}}
49
50 --- !COFF
51 header:
52   Machine:         IMAGE_FILE_MACHINE_ARM64
53   Characteristics: [  ]
54 sections:
55 symbols:
56
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
60
61 #      I386:File: [[FILE]]
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)
74 # I386-NEXT:  ]
75 # I386-NEXT:}
76 # I386-NOT:{{.}}
77
78 --- !COFF
79 header:
80   Machine:         IMAGE_FILE_MACHINE_I386
81   Characteristics: [  ]
82 sections:
83 symbols:
84
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
88
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)
102 # X86-64-NEXT:  ]
103 # X86-64-NEXT:}
104 # X86-64-NOT:{{.}}
105
106 --- !COFF
107 header:
108   Machine:         IMAGE_FILE_MACHINE_AMD64
109   Characteristics: [  ]
110 sections:
111 symbols:
112
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
116
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:  Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
156 # I386-CUSTOM-HEADER-NEXT:  Characteristics [ (0x8140)
157 # I386-CUSTOM-HEADER-NEXT:    IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
158 # I386-CUSTOM-HEADER-NEXT:    IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
159 # I386-CUSTOM-HEADER-NEXT:    IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
160 # I386-CUSTOM-HEADER-NEXT:  ]
161 # I386-CUSTOM-HEADER-NEXT:  SizeOfStackReserve: 1048576
162 # I386-CUSTOM-HEADER-NEXT:  SizeOfStackCommit: 4096
163 # I386-CUSTOM-HEADER-NEXT:  SizeOfHeapReserve: 1048576
164 # I386-CUSTOM-HEADER-NEXT:  SizeOfHeapCommit: 4096
165 # I386-CUSTOM-HEADER-NEXT:  NumberOfRvaAndSize: 16
166 # I386-CUSTOM-HEADER-NEXT:  DataDirectory {
167 # I386-CUSTOM-HEADER-NEXT:    ExportTableRVA: 0x0
168 # I386-CUSTOM-HEADER-NEXT:    ExportTableSize: 0x0
169 # I386-CUSTOM-HEADER-NEXT:    ImportTableRVA: 0x0
170 # I386-CUSTOM-HEADER-NEXT:    ImportTableSize: 0x0
171 # I386-CUSTOM-HEADER-NEXT:    ResourceTableRVA: 0x0
172 # I386-CUSTOM-HEADER-NEXT:    ResourceTableSize: 0x0
173 # I386-CUSTOM-HEADER-NEXT:    ExceptionTableRVA: 0x0
174 # I386-CUSTOM-HEADER-NEXT:    ExceptionTableSize: 0x0
175 # I386-CUSTOM-HEADER-NEXT:    CertificateTableRVA: 0x0
176 # I386-CUSTOM-HEADER-NEXT:    CertificateTableSize: 0x0
177 # I386-CUSTOM-HEADER-NEXT:    BaseRelocationTableRVA: 0x0
178 # I386-CUSTOM-HEADER-NEXT:    BaseRelocationTableSize: 0x0
179 # I386-CUSTOM-HEADER-NEXT:    DebugRVA: 0x0
180 # I386-CUSTOM-HEADER-NEXT:    DebugSize: 0x0
181 # I386-CUSTOM-HEADER-NEXT:    ArchitectureRVA: 0x0
182 # I386-CUSTOM-HEADER-NEXT:    ArchitectureSize: 0x0
183 # I386-CUSTOM-HEADER-NEXT:    GlobalPtrRVA: 0x0
184 # I386-CUSTOM-HEADER-NEXT:    GlobalPtrSize: 0x0
185 # I386-CUSTOM-HEADER-NEXT:    TLSTableRVA: 0x0
186 # I386-CUSTOM-HEADER-NEXT:    TLSTableSize: 0x0
187 # I386-CUSTOM-HEADER-NEXT:    LoadConfigTableRVA: 0x0
188 # I386-CUSTOM-HEADER-NEXT:    LoadConfigTableSize: 0x0
189 # I386-CUSTOM-HEADER-NEXT:    BoundImportRVA: 0x0
190 # I386-CUSTOM-HEADER-NEXT:    BoundImportSize: 0x0
191 # I386-CUSTOM-HEADER-NEXT:    IATRVA: 0x0
192 # I386-CUSTOM-HEADER-NEXT:    IATSize: 0x0
193 # I386-CUSTOM-HEADER-NEXT:    DelayImportDescriptorRVA: 0x0
194 # I386-CUSTOM-HEADER-NEXT:    DelayImportDescriptorSize: 0x0
195 # I386-CUSTOM-HEADER-NEXT:    CLRRuntimeHeaderRVA: 0x0
196 # I386-CUSTOM-HEADER-NEXT:    CLRRuntimeHeaderSize: 0x0
197 # I386-CUSTOM-HEADER-NEXT:    ReservedRVA: 0x0
198 # I386-CUSTOM-HEADER-NEXT:    ReservedSize: 0x0
199 # I386-CUSTOM-HEADER-NEXT:  }
200 # I386-CUSTOM-HEADER-NEXT:}
201 # I386-CUSTOM-HEADER-NEXT:DOSHeader {
202 # I386-CUSTOM-HEADER-NEXT:  Magic: MZ
203 # I386-CUSTOM-HEADER-NEXT:  UsedBytesInTheLastPage: 0
204 # I386-CUSTOM-HEADER-NEXT:  FileSizeInPages: 0
205 # I386-CUSTOM-HEADER-NEXT:  NumberOfRelocationItems: 0
206 # I386-CUSTOM-HEADER-NEXT:  HeaderSizeInParagraphs: 0
207 # I386-CUSTOM-HEADER-NEXT:  MinimumExtraParagraphs: 0
208 # I386-CUSTOM-HEADER-NEXT:  MaximumExtraParagraphs: 0
209 # I386-CUSTOM-HEADER-NEXT:  InitialRelativeSS: 0
210 # I386-CUSTOM-HEADER-NEXT:  InitialSP: 0
211 # I386-CUSTOM-HEADER-NEXT:  Checksum: 0
212 # I386-CUSTOM-HEADER-NEXT:  InitialIP: 0
213 # I386-CUSTOM-HEADER-NEXT:  InitialRelativeCS: 0
214 # I386-CUSTOM-HEADER-NEXT:  AddressOfRelocationTable: 64
215 # I386-CUSTOM-HEADER-NEXT:  OverlayNumber: 0
216 # I386-CUSTOM-HEADER-NEXT:  OEMid: 0
217 # I386-CUSTOM-HEADER-NEXT:  OEMinfo: 0
218 # I386-CUSTOM-HEADER-NEXT:  AddressOfNewExeHeader: 128
219 # I386-CUSTOM-HEADER-NEXT:}
220 # I386-CUSTOM-HEADER-NOT:{{.}}
221
222 --- !COFF
223 OptionalHeader:
224   AddressOfEntryPoint: 4096
225   ImageBase:       4194304
226   SectionAlignment: 4096
227   FileAlignment:   512
228   MajorOperatingSystemVersion: 6
229   MinorOperatingSystemVersion: 0
230   MajorImageVersion: 0
231   MinorImageVersion: 0
232   MajorSubsystemVersion: 6
233   MinorSubsystemVersion: 0
234   Subsystem:       IMAGE_SUBSYSTEM_WINDOWS_CUI
235   DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
236   SizeOfStackReserve: 1048576
237   SizeOfStackCommit: 4096
238   SizeOfHeapReserve: 1048576
239   SizeOfHeapCommit: 4096
240   ExportTable:
241     RelativeVirtualAddress: 0
242     Size:            0
243   ImportTable:
244     RelativeVirtualAddress: 0
245     Size:            0
246   ResourceTable:
247     RelativeVirtualAddress: 0
248     Size:            0
249   ExceptionTable:
250     RelativeVirtualAddress: 0
251     Size:            0
252   CertificateTable:
253     RelativeVirtualAddress: 0
254     Size:            0
255   BaseRelocationTable:
256     RelativeVirtualAddress: 0
257     Size:            0
258   Debug:
259     RelativeVirtualAddress: 0
260     Size:            0
261   Architecture:
262     RelativeVirtualAddress: 0
263     Size:            0
264   GlobalPtr:
265     RelativeVirtualAddress: 0
266     Size:            0
267   TlsTable:
268     RelativeVirtualAddress: 0
269     Size:            0
270   LoadConfigTable:
271     RelativeVirtualAddress: 0
272     Size:            0
273   BoundImport:
274     RelativeVirtualAddress: 0
275     Size:            0
276   IAT:
277     RelativeVirtualAddress: 0
278     Size:            0
279   DelayImportDescriptor:
280     RelativeVirtualAddress: 0
281     Size:            0
282   ClrRuntimeHeader:
283     RelativeVirtualAddress: 0
284     Size:            0
285 header:
286   Machine:         IMAGE_FILE_MACHINE_I386
287   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_32BIT_MACHINE ]
288 sections:
289 symbols:         []
290 ...
291
292 # RUN: yaml2obj %s --docnum=6 -o %t.unknown
293 # RUN: llvm-readobj -h %t.unknown \
294 # RUN:  | FileCheck %s --strict-whitespace --match-full-lines --check-prefix UNKNOWN
295
296 #      UNKNOWN:Format: COFF-<unknown arch>
297 # UNKNOWN-NEXT:Arch: unknown
298 # UNKNOWN-NEXT:AddressSize: 32bit
299 # UNKNOWN-NEXT:ImageFileHeader {
300 # UNKNOWN-NEXT:  Machine: IMAGE_FILE_MACHINE_UNKNOWN (0x0)
301 # UNKNOWN-NEXT:  SectionCount: 0
302 # UNKNOWN-NEXT:  TimeDateStamp: 1970-01-01 00:00:00 (0x0)
303 # UNKNOWN-NEXT:  PointerToSymbolTable: 0x0
304 # UNKNOWN-NEXT:  SymbolCount: 0
305 # UNKNOWN-NEXT:  StringTableSize: 0
306 # UNKNOWN-NEXT:  OptionalHeaderSize: 0
307 # UNKNOWN-NEXT:  Characteristics [ (0x0)
308 # UNKNOWN-NEXT:  ]
309 # UNKNOWN-NEXT:}
310 # UNKNOWN-NOT:{{.}}
311
312 --- !COFF
313 header:
314   Machine:         IMAGE_FILE_MACHINE_UNKNOWN
315   Characteristics: [  ]
316 sections:
317 symbols:
318
319 # RUN: llvm-readobj -h %p/Inputs/magic.coff-importlib \
320 # RUN:   | FileCheck %s --strict-whitespace --match-full-lines --check-prefix IMPORTLIB
321
322 #      IMPORTLIB:Format: COFF-import-file
323 # IMPORTLIB-NEXT:Type: code
324 # IMPORTLIB-NEXT:Name type: noprefix
325 # IMPORTLIB-NEXT:Symbol: __imp__func
326 # IMPORTLIB-NEXT:Symbol: _func
327 # IMPORTLIB-NOT:{{.}}