1# RUN: yaml2obj < %s > %t.obj
2# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \
3# RUN:   /merge:.foo=.abc /merge:.bar=.def %t.obj /debug
4# RUN: llvm-readobj --sections %t.exe | FileCheck %s
5
6# RUN: lld-link /out:%t.exe /entry:main /subsystem:console /force \
7# RUN:   /merge:.foo=.bar /merge:.bar=.abc %t.obj /debug
8# RUN: llvm-readobj --sections %t.exe | FileCheck --check-prefix=CHECK2 %s
9
10# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
11# RUN:   /merge:.rsrc=.foo %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-RSRC %s
12# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
13# RUN:   /merge:.foo=.rsrc %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-RSRC %s
14# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
15# RUN:   /merge:.reloc=.foo %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-RELOC %s
16# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
17# RUN:   /merge:.foo=.reloc %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-RELOC %s
18# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
19# RUN:   /merge:.foo=.foo1 /merge:.foo1=.foo %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-CYCLE %s
20# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console /force \
21# RUN:   /merge:.foo=.foo1 /merge:.foo1=.foo2 /merge:.foo2=.foo1 %t.obj /debug 2>&1 | FileCheck --check-prefix=NO-CYCLE %s
22
23# CHECK: Name: .def
24# CHECK: Name: .abc
25
26# CHECK2-NOT: Name: .bar
27# CHECK2: Name: .abc
28# CHECK2-NOT: Name: .bar
29
30# NO-RSRC: /merge: cannot merge '.rsrc' with any section
31# NO-RELOC: /merge: cannot merge '.reloc' with any section
32
33# NO-CYCLE: /merge: cycle found for section '.foo'
34
35--- !COFF
36header:
37  Machine:         IMAGE_FILE_MACHINE_AMD64
38  Characteristics: []
39sections:
40  - Name:            .foo
41    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
42    Alignment:       4
43    SectionData:     000000000000
44  - Name:            .bar
45    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
46    Alignment:       4
47    SectionData:     000000000000
48symbols:
49  - Name:            .foo
50    Value:           0
51    SectionNumber:   1
52    SimpleType:      IMAGE_SYM_TYPE_NULL
53    ComplexType:     IMAGE_SYM_DTYPE_NULL
54    StorageClass:    IMAGE_SYM_CLASS_STATIC
55    SectionDefinition:
56      Length:          6
57      NumberOfRelocations: 0
58      NumberOfLinenumbers: 0
59      CheckSum:        0
60      Number:          0
61  - Name:            .bar
62    Value:           0
63    SectionNumber:   2
64    SimpleType:      IMAGE_SYM_TYPE_NULL
65    ComplexType:     IMAGE_SYM_DTYPE_NULL
66    StorageClass:    IMAGE_SYM_CLASS_STATIC
67    SectionDefinition:
68      Length:          6
69      NumberOfRelocations: 0
70      NumberOfLinenumbers: 0
71      CheckSum:        0
72      Number:          0
73  - Name:            main
74    Value:           0
75    SectionNumber:   1
76    SimpleType:      IMAGE_SYM_TYPE_NULL
77    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
78    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
79...
80