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)
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
55 ImageBase: 0x180000000
56 SectionAlignment: 4096
58 DLLCharacteristics: [ ]
60 RelativeVirtualAddress: 0x1000
63 Machine: IMAGE_FILE_MACHINE_AMD64
64 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
67 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
68 VirtualAddress: 0x1000
78 CriticalSectionDefaultTimeout: 6
79 DeCommitFreeBlockThreshold: 7
80 DeCommitTotalFreeThreshold: 8
82 MaximumAllocationSize: 0x100000
83 VirtualMemoryThreshold: 0x2000000
84 ProcessAffinityMask: 1
92 GuardCFCheckFunction: 9
93 GuardCFCheckDispatch: 1
94 GuardCFFunctionTable: 0
95 GuardCFFunctionCount: 0
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
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
135 ImageBase: 0x180000000
136 SectionAlignment: 4096
138 DLLCharacteristics: [ ]
140 RelativeVirtualAddress: 0x1000
143 Machine: IMAGE_FILE_MACHINE_I386
144 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
147 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
148 VirtualAddress: 0x1000
152 MaximumAllocationSize: 0x100000
153 VirtualMemoryThreshold: 0x2000000
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
163 # DEF: AddressSize: 64bit
166 # DEF: MajorVersion: 0x0
167 # DEF: MinorVersion: 0x0
168 # DEF: GuardEHContinuationCount: 0
173 ImageBase: 0x180000000
174 SectionAlignment: 4096
176 DLLCharacteristics: [ ]
178 RelativeVirtualAddress: 0x1000
181 Machine: IMAGE_FILE_MACHINE_AMD64
182 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
185 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
186 VirtualAddress: 0x1000
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 ....
215 SectionAlignment: 4096
217 DLLCharacteristics: [ ]
219 RelativeVirtualAddress: 0x1000
222 Machine: IMAGE_FILE_MACHINE_I386
223 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
226 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
227 VirtualAddress: 0x1000
232 CastGuardOsDeterminedFailureMode: 0xff
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
244 ImageBase: 0x180000000
245 SectionAlignment: 4096
247 DLLCharacteristics: [ ]
249 RelativeVirtualAddress: 0x1000
252 Machine: IMAGE_FILE_MACHINE_AMD64
253 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
256 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
257 VirtualAddress: 0x1000
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'
273 ImageBase: 0x180000000
274 SectionAlignment: 4096
276 DLLCharacteristics: [ ]
278 RelativeVirtualAddress: 0x1000
281 Machine: IMAGE_FILE_MACHINE_AMD64
282 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
285 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
286 VirtualAddress: 0x1000
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
301 ImageBase: 0x180000000
302 SectionAlignment: 4096
304 DLLCharacteristics: [ ]
306 RelativeVirtualAddress: 0x1000
309 Machine: IMAGE_FILE_MACHINE_AMD64
310 Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
313 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
314 VirtualAddress: 0x1000