[LLD][COFF] Fix TypeServerSource matcher with more than one collision
[llvm-project.git] / lld / test / COFF / order.test
blobe068fefba496903020c8fc05c98cf750cc3f9e46
1 # RUN: yaml2obj %s -o %t1.obj
2 # RUN: yaml2obj %p/Inputs/order.yaml -o %t2.obj
4 # RUN: echo fn1 > %t.order
5 # RUN: echo fn2 >> %t.order
6 # RUN: echo fn3 >> %t.order
7 # RUN: echo fn4 >> %t.order
9 # RUN: lld-link -entry:fn1 -subsystem:console -opt:noref -debug %t1.obj %t2.obj \
10 # RUN:   -lldmap:- -out:%t.exe -order:@%t.order | FileCheck %s
11 # CHECK: fn1
12 # CHECK: fn2
13 # CHECK: fn3
14 # CHECK: fn4
15 # CHECK: unrelated1
16 # CHECK: unrelated2
18 # RUN: lld-link -entry:fn1 -subsystem:console -opt:noref -debug %t1.obj %t2.obj \
19 # RUN:   -lldmap:- -ignore:4037 -out:%t.exe | FileCheck -check-prefix=DEFAULT %s
20 # DEFAULT: fn2
21 # DEFAULT: fn3
22 # DEFAULT: unrelated1
23 # DEFAULT: unrelated2
24 # DEFAULT: fn4
25 # DEFAULT: fn1
27 # RUN: echo fn1 > %t2.order
28 # RUN: echo fn2 >> %t2.order
29 # RUN: echo fn3 >> %t2.order
30 # RUN: echo fn4 >> %t2.order
31 # RUN: echo foo >> %t2.order
32 # RUN: lld-link -entry:fn1 -subsystem:console -debug %t1.obj %t2.obj \
33 # RUN:   -out:%t.exe -order:@%t2.order 2>&1 | FileCheck -check-prefix=WARN %s
34 # WARN: warning: /order:{{.*}} missing symbol: foo
35 # WARN-NOT: f2
36 # WARN-NOT: f3
37 # WARN-NOT: f4
38 # RUN: lld-link -entry:fn1 -subsystem:console -debug %t1.obj %t2.obj \
39 # RUN:   -out:%t.exe -order:@%t2.order -ignore:4037 2>&1 | \
40 # RUN:   FileCheck -allow-empty -check-prefix=NOWARN %s
41 # NOWARN-NOT: warning: /order:{{.*}} missing symbol: foo
42 # NOWARN-NOT: f2
43 # NOWARN-NOT: f3
44 # NOWARN-NOT: f4
46 --- !COFF
47 header:
48   Machine:         IMAGE_FILE_MACHINE_AMD64
49   Characteristics: [  ]
50 sections:
51   - Name:            .text
52     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
53     Alignment:       16
54     SectionData:     C3
55   - Name:            .text
56     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
57     Alignment:       16
58     SectionData:     C3
59   - Name:            .text
60     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
61     Alignment:       16
62     SectionData:     C3
63 symbols:
64   - Name:            .text
65     Value:           0
66     SectionNumber:   1
67     SimpleType:      IMAGE_SYM_TYPE_NULL
68     ComplexType:     IMAGE_SYM_DTYPE_NULL
69     StorageClass:    IMAGE_SYM_CLASS_STATIC
70     SectionDefinition:
71       Length:          1
72       NumberOfRelocations: 0
73       NumberOfLinenumbers: 0
74       CheckSum:        0
75       Number:          1
76       Selection:       IMAGE_COMDAT_SELECT_NODUPLICATES
77   - Name:            fn2
78     Value:           0
79     SectionNumber:   1
80     SimpleType:      IMAGE_SYM_TYPE_NULL
81     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
82     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
83   - Name:            .text
84     Value:           0
85     SectionNumber:   2
86     SimpleType:      IMAGE_SYM_TYPE_NULL
87     ComplexType:     IMAGE_SYM_DTYPE_NULL
88     StorageClass:    IMAGE_SYM_CLASS_STATIC
89     SectionDefinition:
90       Length:          1
91       NumberOfRelocations: 0
92       NumberOfLinenumbers: 0
93       CheckSum:        0
94       Number:          2
95       Selection:       IMAGE_COMDAT_SELECT_NODUPLICATES
96   - Name:            fn3
97     Value:           0
98     SectionNumber:   2
99     SimpleType:      IMAGE_SYM_TYPE_NULL
100     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
101     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
102   - Name:            .text
103     Value:           0
104     SectionNumber:   3
105     SimpleType:      IMAGE_SYM_TYPE_NULL
106     ComplexType:     IMAGE_SYM_DTYPE_NULL
107     StorageClass:    IMAGE_SYM_CLASS_STATIC
108     SectionDefinition:
109       Length:          1
110       NumberOfRelocations: 0
111       NumberOfLinenumbers: 0
112       CheckSum:        0
113       Number:          3
114       Selection:       IMAGE_COMDAT_SELECT_NODUPLICATES
115   - Name:            unrelated1
116     Value:           0
117     SectionNumber:   3
118     SimpleType:      IMAGE_SYM_TYPE_NULL
119     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
120     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL