# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj --coff-load-config %t1 | FileCheck %s
# CHECK: CHPEMetadataPointer: 0x180005000
# CHECK: CHPEMetadata [
# CHECK-NEXT: Version: 0x1
# CHECK-NEXT: CodeMap [
# CHECK-NEXT: 0x1000 - 0x1030 ARM64EC
# CHECK-NEXT: 0x2000 - 0x2040 ARM64
# CHECK-NEXT: 0x3000 - 0x3050 X64
# CHECK-NEXT: ]
# CHECK-NEXT: CodeRangesToEntryPoints [
# CHECK-NEXT: 0x1000 - 0x1020 -> 0x1000
# CHECK-NEXT: 0x1020 - 0x1040 -> 0x2000
# CHECK-NEXT: ]
# CHECK-NEXT: RedirectionMetadata [
# CHECK-NEXT: 0x1000 -> 0x2000
# CHECK-NEXT: 0x1020 -> 0x2030
# CHECK-NEXT: ]
# CHECK-NOT: AuxiliaryDelayloadIAT:
--- !COFF
OptionalHeader:
ImageBase: 0x180000000
SectionAlignment: 4096
FileAlignment: 512
DLLCharacteristics: [ ]
LoadConfigTable:
RelativeVirtualAddress: 0x4000
Size: 320
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x1000
VirtualSize: 0x2050
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x4000
VirtualSize: 328
StructuredData:
- LoadConfig:
CHPEMetadataPointer: 0x180005000
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 0x5000
VirtualSize: 144
StructuredData:
- UInt32: 1 # Version
- UInt32: 0x5050 # CodeMap
- UInt32: 3 # CodeMapCount
- UInt32: 0x5068 # CodeRangesToEntryPoints
- UInt32: 0x5080 # RedirectionMetadata
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 2 # CodeRangesToEntryPointsCount
- UInt32: 2 # RedirectionMetadataCount
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0x1001 # CodeMap[0]
- UInt32: 0x30
- UInt32: 0x2000 # CodeMap[1]
- UInt32: 0x40
- UInt32: 0x3002 # CodeMap[2]
- UInt32: 0x50
- UInt32: 0x1000 # CodeRangesToEntryPoints[0]
- UInt32: 0x1020
- UInt32: 0x1000
- UInt32: 0x1020 # CodeRangesToEntryPoints[1]
- UInt32: 0x1040
- UInt32: 0x2000
- UInt32: 0x1000 # RedirectionMetadata[0]
- UInt32: 0x2000
- UInt32: 0x1020 # RedirectionMetadata[1]
- UInt32: 0x2030
symbols: []
...
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-readobj --coff-load-config %t2 | FileCheck --check-prefix=CHPE2 %s
# CHPE2: CHPEMetadata [
# CHPE2-NEXT: Version: 0x2
# CHPE2: AuxiliaryDelayloadIAT: 0x1
# CHPE2-NEXT: AuxiliaryDelayloadIATCopy: 0x2
# CHPE2-NEXT: HybridImageInfoBitfield: 0x4
--- !COFF
OptionalHeader:
ImageBase: 0x180000000
SectionAlignment: 4096
FileAlignment: 512
DLLCharacteristics: [ ]
LoadConfigTable:
RelativeVirtualAddress: 0x4000
Size: 320
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x1000
VirtualSize: 0x2050
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x4000
VirtualSize: 328
StructuredData:
- LoadConfig:
CHPEMetadataPointer: 0x180005000
- Name: .data
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
VirtualAddress: 0x5000
VirtualSize: 144
StructuredData:
- UInt32: 2 # Version
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 0
- UInt32: 1 # AuxiliaryDelayloadIAT
- UInt32: 2 # AuxiliaryDelayloadIATCopy
- UInt32: 4 # HybridImageInfoBitfield
symbols: []
...
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: not llvm-readobj --coff-load-config %t3 2>&1 | FileCheck --check-prefix=ERR-EOF %s
# ERR-EOF: The end of the file was unexpectedly encountered
--- !COFF
OptionalHeader:
ImageBase: 0x180000000
SectionAlignment: 4096
FileAlignment: 512
DLLCharacteristics: [ ]
LoadConfigTable:
RelativeVirtualAddress: 0x4000
Size: 320
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x1000
VirtualSize: 0x2050
- Name: .rdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
VirtualAddress: 0x4000
VirtualSize: 512
StructuredData:
- LoadConfig:
CHPEMetadataPointer: 0x1800041AC
symbols: []
...