Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / yaml2obj / COFF / load-config.yaml
blob36c66e6d692711c357cfa73cd0c1748bca7d080e
1 ## Test all members of 64-bit load config.
2 # RUN: yaml2obj --docnum=1 %s -o %t
3 # RUN: llvm-readobj --coff-load-config %t | FileCheck %s --check-prefix=ALL
5 # ALL:      Format: COFF-x86-64
6 # ALL-NEXT: Arch: x86_64
7 # ALL-NEXT: AddressSize: 64bit
8 # ALL-NEXT: LoadConfig [
9 # ALL-NEXT:   Size: 0x150
10 # ALL-NEXT:   TimeDateStamp: 1970-01-01 00:00:01 (0x1)
11 # ALL-NEXT:   MajorVersion: 0x2
12 # ALL-NEXT:   MinorVersion: 0x3
13 # ALL-NEXT:   GlobalFlagsClear: 0x4
14 # ALL-NEXT:   GlobalFlagsSet: 0x5
15 # ALL-NEXT:   CriticalSectionDefaultTimeout: 0x6
16 # ALL-NEXT:   DeCommitFreeBlockThreshold: 0x7
17 # ALL-NEXT:   DeCommitTotalFreeThreshold: 0x8
18 # ALL-NEXT:   LockPrefixTable: 0x9
19 # ALL-NEXT:   MaximumAllocationSize: 0x100000
20 # ALL-NEXT:   VirtualMemoryThreshold: 0x2000000
21 # ALL-NEXT:   ProcessHeapFlags: 0x2
22 # ALL-NEXT:   ProcessAffinityMask: 0x1
23 # ALL-NEXT:   CSDVersion: 0x3
24 # ALL-NEXT:   DependentLoadFlags: 0x4
25 # ALL-NEXT:   EditList: 0x5
26 # ALL-NEXT:   SecurityCookie: 0x6
27 # ALL-NEXT:   SEHandlerTable: 0x0
28 # ALL-NEXT:   SEHandlerCount: 0
29 # ALL-NEXT:   GuardCFCheckFunction: 0x9
30 # ALL-NEXT:   GuardCFCheckDispatch: 0x1
31 # ALL-NEXT:   GuardCFFunctionTable: 0x0
32 # ALL-NEXT:   GuardCFFunctionCount: 0
33 # ALL-NEXT:   GuardFlags [ (0x4)
34 # ALL-NEXT:   ]
35 # ALL-NEXT:   GuardAddressTakenIatEntryTable: 0x0
36 # ALL-NEXT:   GuardAddressTakenIatEntryCount: 0
37 # ALL-NEXT:   GuardLongJumpTargetTable: 0x0
38 # ALL-NEXT:   GuardLongJumpTargetCount: 0
39 # ALL-NEXT:   DynamicValueRelocTable: 0x2
40 # ALL-NEXT:   CHPEMetadataPointer: 0x0
41 # ALL-NEXT:   GuardRFFailureRoutine: 0x4
42 # ALL-NEXT:   GuardRFFailureRoutineFunctionPointer: 0x5
43 # ALL-NEXT:   DynamicValueRelocTableOffset: 0x6
44 # ALL-NEXT:   DynamicValueRelocTableSection: 7
45 # ALL-NEXT:   GuardRFVerifyStackPointerFunctionPointer: 0x8
46 # ALL-NEXT:   HotPatchTableOffset: 0x9
47 # ALL-NEXT:   EnclaveConfigurationPointer: 0x1
48 # ALL-NEXT:   VolatileMetadataPointer: 0x2
49 # ALL-NEXT:   GuardEHContinuationTable: 0x0
50 # ALL-NEXT:   GuardEHContinuationCount: 0
51 # ALL-NEXT: ]
53 --- !COFF
54 OptionalHeader:
55   ImageBase:        0x180000000
56   SectionAlignment: 4096
57   FileAlignment:    512
58   DLLCharacteristics: [ ]
59   LoadConfigTable:
60     RelativeVirtualAddress: 0x1000
61     Size:            320
62 header:
63   Machine:         IMAGE_FILE_MACHINE_AMD64
64   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
65 sections:
66   - Name:            .rdata
67     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
68     VirtualAddress:  0x1000
69     VirtualSize:     320
70     StructuredData:
71       - LoadConfig:
72           Size: 0x150
73           TimeDateStamp: 1
74           MajorVersion: 2
75           MinorVersion: 3
76           GlobalFlagsClear: 4
77           GlobalFlagsSet: 5
78           CriticalSectionDefaultTimeout: 6
79           DeCommitFreeBlockThreshold: 7
80           DeCommitTotalFreeThreshold: 8
81           LockPrefixTable: 9
82           MaximumAllocationSize: 0x100000
83           VirtualMemoryThreshold: 0x2000000
84           ProcessAffinityMask: 1
85           ProcessHeapFlags: 2
86           CSDVersion: 3
87           DependentLoadFlags: 4
88           EditList: 5
89           SecurityCookie: 6
90           SEHandlerTable: 0
91           SEHandlerCount: 0
92           GuardCFCheckFunction: 9
93           GuardCFCheckDispatch: 1
94           GuardCFFunctionTable: 0
95           GuardCFFunctionCount: 0
96           GuardFlags: 4
97           CodeIntegrity:
98             Flags: 0x100
99             Catalog: 5
100             CatalogOffset: 6
101           GuardAddressTakenIatEntryTable: 0
102           GuardAddressTakenIatEntryCount: 0
103           GuardLongJumpTargetTable: 0
104           GuardLongJumpTargetCount: 0
105           DynamicValueRelocTable: 2
106           CHPEMetadataPointer: 0
107           GuardRFFailureRoutine: 4
108           GuardRFFailureRoutineFunctionPointer: 5
109           DynamicValueRelocTableOffset: 6
110           DynamicValueRelocTableSection: 7
111           GuardRFVerifyStackPointerFunctionPointer: 8
112           HotPatchTableOffset: 9
113           EnclaveConfigurationPointer: 1
114           VolatileMetadataPointer: 2
115           GuardEHContinuationTable: 0
116           GuardEHContinuationCount: 0
117           GuardXFGCheckFunctionPointer: 5
118           GuardXFGDispatchFunctionPointer: 6
119           GuardXFGTableDispatchFunctionPointer: 7
120           CastGuardOsDeterminedFailureMode: 8
121 symbols: []
124 ## Simple 32-bit load config.
125 # RUN: yaml2obj --docnum=2 %s -o %t
126 # RUN: llvm-readobj --coff-load-config %t | FileCheck %s --check-prefix=LOADCFG32
128 # LOADCFG32: LoadConfig [
129 # LOADCFG32:   MaximumAllocationSize: 0x100000
130 # LOADCFG32:   VirtualMemoryThreshold: 0x2000000
131 # LOADCFG32:   CHPEMetadataPointer: 0
133 --- !COFF
134 OptionalHeader:
135   ImageBase:        0x180000000
136   SectionAlignment: 4096
137   FileAlignment:    512
138   DLLCharacteristics: [ ]
139   LoadConfigTable:
140     RelativeVirtualAddress: 0x1000
141     Size:            320
142 header:
143   Machine:         IMAGE_FILE_MACHINE_I386
144   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
145 sections:
146   - Name:            .rdata
147     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
148     VirtualAddress:  0x1000
149     VirtualSize:     320
150     StructuredData:
151       - LoadConfig:
152           MaximumAllocationSize: 0x100000
153           VirtualMemoryThreshold: 0x2000000
154 symbols: []
157 ## Create load config with all fields using default values.
158 # RUN: yaml2obj --docnum=3 %s -o %t
159 # RUN: llvm-readobj --coff-load-config %t | FileCheck %s --check-prefix=DEF
161 # DEF: Format: COFF-x86-64
162 # DEF: Arch: x86_64
163 # DEF: AddressSize: 64bit
164 # DEF: LoadConfig [
165 # DEF:   Size: 0x138
166 # DEF:   MajorVersion: 0x0
167 # DEF:   MinorVersion: 0x0
168 # DEF:   GuardEHContinuationCount: 0
169 # DEF: ]
171 --- !COFF
172 OptionalHeader:
173   ImageBase:        0x180000000
174   SectionAlignment: 4096
175   FileAlignment:    512
176   DLLCharacteristics: [ ]
177   LoadConfigTable:
178     RelativeVirtualAddress: 0x1000
179     Size:            320
180 header:
181   Machine:         IMAGE_FILE_MACHINE_AMD64
182   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
183 sections:
184   - Name:            .rdata
185     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
186     VirtualAddress:  0x1000
187     VirtualSize:     320
188     StructuredData:
189       - LoadConfig:
190 symbols: []
193 ## Create laod config larger than coff_load_configuration32 struct.
194 # RUN: yaml2obj --docnum=4 %s -o %t
195 # RUN: llvm-readobj --hex-dump=.rdata %t | FileCheck %s --check-prefix=LARGE
197 # LARGE:      0x00401000 d0000000 00000000 00000000 00000000 ................
198 # LARGE-NEXT: 0x00401010 00000000 00000000 00000000 00000000 ................
199 # LARGE-NEXT: 0x00401020 00000000 00000000 00000000 00000000 ................
200 # LARGE-NEXT: 0x00401030 00000000 00000000 00000000 00000000 ................
201 # LARGE-NEXT: 0x00401040 00000000 00000000 00000000 00000000 ................
202 # LARGE-NEXT: 0x00401050 00000000 00000000 00000000 00000000 ................
203 # LARGE-NEXT: 0x00401060 00000000 00000000 00000000 00000000 ................
204 # LARGE-NEXT: 0x00401070 00000000 00000000 00000000 00000000 ................
205 # LARGE-NEXT: 0x00401080 00000000 00000000 00000000 00000000 ................
206 # LARGE-NEXT: 0x00401090 00000000 00000000 00000000 00000000 ................
207 # LARGE-NEXT: 0x004010a0 00000000 00000000 00000000 00000000 ................
208 # LARGE-NEXT: 0x004010b0 00000000 00000000 ff000000 00000000 ................
209 # LARGE-NEXT: 0x004010c0 00000000 00000000 00000000 00000000 ................
210 # LARGE-NEXT: 0x004010d0 aabbccdd                            ....
212 --- !COFF
213 OptionalHeader:
214   ImageBase:        0x400000
215   SectionAlignment: 4096
216   FileAlignment:    512
217   DLLCharacteristics: [ ]
218   LoadConfigTable:
219     RelativeVirtualAddress: 0x1000
220     Size:            320
221 header:
222   Machine:         IMAGE_FILE_MACHINE_I386
223   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
224 sections:
225   - Name:            .rdata
226     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
227     VirtualAddress:  0x1000
228     VirtualSize:     0xd4
229     StructuredData:
230       - LoadConfig:
231           Size: 0xd0
232           CastGuardOsDeterminedFailureMode: 0xff
233       - UInt32: 0xddccbbaa
234 symbols: []
237 ## Try to specify load config field that barely fits the specified size.
238 # RUN: yaml2obj --docnum=5 %s -o %t
239 # RUN: llvm-readobj --hex-dump=.rdata %t | FileCheck %s --check-prefix=SMALL
240 # SMALL: 0x180001000 09000000 00000000 aaffffff ff
242 --- !COFF
243 OptionalHeader:
244   ImageBase:        0x180000000
245   SectionAlignment: 4096
246   FileAlignment:    512
247   DLLCharacteristics: [ ]
248   LoadConfigTable:
249     RelativeVirtualAddress: 0x1000
250     Size:            320
251 header:
252   Machine:         IMAGE_FILE_MACHINE_AMD64
253   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
254 sections:
255   - Name:            .rdata
256     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
257     VirtualAddress:  0x1000
258     VirtualSize:     13
259     StructuredData:
260       - LoadConfig:
261           Size: 9
262           MajorVersion: 0xbbaa
263       - UInt32: 0xffffffff
264 symbols: []
267 ## Try to specify load config field that does not fit specified size.
268 # RUN: not yaml2obj --docnum=6 %s -o %t 2>&1 | FileCheck %s --check-prefix=TOOSMALL
269 # TOOSMALL: error: unknown key 'MajorVersion'
271 --- !COFF
272 OptionalHeader:
273   ImageBase:        0x180000000
274   SectionAlignment: 4096
275   FileAlignment:    512
276   DLLCharacteristics: [ ]
277   LoadConfigTable:
278     RelativeVirtualAddress: 0x1000
279     Size:            320
280 header:
281   Machine:         IMAGE_FILE_MACHINE_AMD64
282   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
283 sections:
284   - Name:            .rdata
285     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
286     VirtualAddress:  0x1000
287     VirtualSize:     320
288     StructuredData:
289       - LoadConfig:
290           Size: 8
291           MajorVersion: 10
292 symbols: []
295 ## Set load config size to 0.
296 # RUN: not yaml2obj --docnum=7 %s -o %t 2>&1 | FileCheck %s --check-prefix=ZERO
297 # ZERO: error: Size must be at least 4
299 --- !COFF
300 OptionalHeader:
301   ImageBase:        0x180000000
302   SectionAlignment: 4096
303   FileAlignment:    512
304   DLLCharacteristics: [ ]
305   LoadConfigTable:
306     RelativeVirtualAddress: 0x1000
307     Size:            320
308 header:
309   Machine:         IMAGE_FILE_MACHINE_AMD64
310   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
311 sections:
312   - Name:            .rdata
313     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
314     VirtualAddress:  0x1000
315     VirtualSize:     320
316     StructuredData:
317       - LoadConfig:
318           Size: 0
319 symbols: []