1# RUN: yaml2obj < %s > %t.obj
2
3# RUN: lld-link /out:%t.exe /entry:main %t.obj \
4# RUN:   /verbose 2>&1 | FileCheck -check-prefix=REF %s
5
6# /debug disables the /opt:ref default...
7# RUN: lld-link /out:%t.exe /debug /entry:main %t.obj \
8# RUN:   /verbose 2>&1 | FileCheck -check-prefix=NOREF %s
9
10# ...unless /profile is passed as well.
11# RUN: lld-link /out:%t.exe /profile /debug /entry:main %t.obj \
12# RUN:   /verbose 2>&1 | FileCheck -check-prefix=REF %s
13
14# RUN: lld-link /out:%t.exe /opt:ref /debug /entry:main %t.obj \
15# RUN:   /verbose 2>&1 | FileCheck -check-prefix=REF %s
16
17# RUN: lld-link /out:%t.exe /entry:main %t.obj \
18# RUN:   /verbose /opt:noref /profile 2>&1 | FileCheck -check-prefix=NOREF %s
19
20# REF:       Discarded unused
21# NOREF-NOT: Discarded unused
22
23--- !COFF
24header:
25  Machine:         IMAGE_FILE_MACHINE_AMD64
26  Characteristics: []
27sections:
28  - Name:            '.text$mn'
29    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
30    Alignment:       4
31    SectionData:     B82A000000C3
32  - Name:            '.text$mn'
33    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
34    Alignment:       4
35    SectionData:     B82A000000C3
36symbols:
37  - Name:            '.text$mn'
38    Value:           0
39    SectionNumber:   1
40    SimpleType:      IMAGE_SYM_TYPE_NULL
41    ComplexType:     IMAGE_SYM_DTYPE_NULL
42    StorageClass:    IMAGE_SYM_CLASS_STATIC
43    SectionDefinition:
44      Length:          6
45      NumberOfRelocations: 0
46      NumberOfLinenumbers: 0
47      CheckSum:        0
48      Number:          0
49      Selection:       IMAGE_COMDAT_SELECT_ANY
50  - Name:            '.text$mn'
51    Value:           0
52    SectionNumber:   2
53    SimpleType:      IMAGE_SYM_TYPE_NULL
54    ComplexType:     IMAGE_SYM_DTYPE_NULL
55    StorageClass:    IMAGE_SYM_CLASS_STATIC
56    SectionDefinition:
57      Length:          6
58      NumberOfRelocations: 0
59      NumberOfLinenumbers: 0
60      CheckSum:        0
61      Number:          0
62      Selection:       IMAGE_COMDAT_SELECT_ANY
63  - Name:            main
64    Value:           0
65    SectionNumber:   1
66    SimpleType:      IMAGE_SYM_TYPE_NULL
67    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
68    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
69  - Name:            unused
70    Value:           0
71    SectionNumber:   2
72    SimpleType:      IMAGE_SYM_TYPE_NULL
73    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
74    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
75...
76