# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj --coff-load-config %t | 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:   ]

--- !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:         []
...
