# REQUIRES: x86

# RUN: yaml2obj %s -o %t.o

# Test that we get both the resource and the code from a single object
# file that contains both, while merging resources from another object
# file.

# RUN: lld-link -lldmingw -out:%t.exe %t.o %p/Inputs/id.res.o -entry:main
# RUN: llvm-readobj --coff-resources %t.exe | FileCheck %s --check-prefix=CHECK-RESOURCES
# RUN: llvm-objdump --no-print-imm-hex -d %t.exe | FileCheck %s --check-prefix=CHECK-DISASM

# CHECK-RESOURCES: Resources [
# CHECK-RESOURCES-NEXT: Total Number of Resources: 2

# CHECK-DISASM: <.text>:
# CHECK-DISASM-NEXT: movl $42, %eax
# CHECK-DISASM-NEXT: retq

--- !COFF
header:
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [ IMAGE_FILE_LINE_NUMS_STRIPPED ]
sections:
  - Name:            .rsrc
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
    Alignment:       4
    SectionData:     0000000000000000000000000000010005000000180000800000000000000000000000000100000048000080300000800000000000000000000000000000010009040000600000000A0054004500530054004400490041004C004F0047000000700000006C00000000000000000000000000C0800000000002000A000A00C8002C01000000005400650073007400000001000250000000000A000A00E6000E000100FFFF820043006F006E00740069006E00750065003A0000000000000001500000000042008600A1000D000200FFFF800026004F004B000000000000000000
    Relocations:
      - VirtualAddress:  96
        SymbolName:      .rsrc
        Type:            IMAGE_REL_AMD64_ADDR32NB
  - Name:            '.text'
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       16
    SectionData:     B82A000000C3
symbols:
  - Name:            .rsrc
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
  - Name:            '.text'
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          6
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          0
  - Name:            main
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
...
