Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / COFF / sort-debug.test
blobbbe2ecd0efd8df1bd496dfcb85a4787cda2c782f
1 # RUN: yaml2obj %s -o %t.obj
2 # RUN: lld-link /debug /out:%t.exe /entry:main %t.obj
3 # RUN: llvm-readobj --sections %t.exe | FileCheck %s
4 # RUN: lld-link /debug:dwarf /out:%t.exe /entry:main %t.obj
5 # RUN: llvm-readobj --sections %t.exe | FileCheck %s
6 # RUN: lld-link /out:%t.exe /entry:main %t.obj
7 # RUN: llvm-readobj --sections %t.exe | FileCheck -check-prefix=NODEBUG %s
8 # RUN: lld-link /debug:symtab /out:%t.exe /entry:main %t.obj
9 # RUN: llvm-readobj --sections %t.exe | FileCheck -check-prefix=NODEBUG %s
11 # CHECK: Name: .text
12 # CHECK: Name: .reloc
13 # CHECK: Name: .rmeta
14 # CHECK: Name: .debug_abbrev
15 # CHECK: Name: .debug_info
16 # CHECK: Name: .debug_line
17 # CHECK: Name: .debug_pubnames
18 # CHECK: Name: .debug_pubtypes
20 # NODEBUG: Name: .text
21 # NODEBUG: Name: .reloc
22 # NODEBUG: Name: .rmeta
23 # NODEBUG-NOT: Name: .debug_abbrev
24 # NODEBUG-NOT: Name: .debug_info
25 # NODEBUG-NOT: Name: .debug_line
26 # NODEBUG-NOT: Name: .debug_pubnames
27 # NODEBUG-NOT: Name: .debug_pubtypes
29 --- !COFF
30 header:
31   Machine:         IMAGE_FILE_MACHINE_I386
32   Characteristics: [  ]
33 sections:
34   - Name:            .text
35     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
36     Alignment:       16
37     SectionData:     508D0500000000C70424000000005AC3
38     Relocations:
39       - VirtualAddress:  3
40         SymbolName:      '?x@@3HA'
41         Type:            IMAGE_REL_I386_DIR32
42   - Name:            .data
43     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
44     Alignment:       4
45     SectionData:     ''
46   - Name:            .bss
47     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
48     Alignment:       4
49     SectionData:     ''
50     SizeOfRawData:   4
51   - Name:            '.debug$S'
52     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
53     Alignment:       1
54     Subsections:
55       - !Symbols
56         Records:
57           - Kind:            S_GPROC32_ID
58             ProcSym:
59               PtrParent:       0
60               PtrEnd:          0
61               PtrNext:         0
62               CodeSize:        16
63               DbgStart:        0
64               DbgEnd:          0
65               FunctionType:    0
66               Segment:         0
67               Flags:           [  ]
68               DisplayName:     main
69           - Kind:            S_PROC_ID_END
70             ScopeEndSym:
71       - !Lines
72         CodeSize:        16
73         Flags:           [ HasColumnInfo ]
74         RelocOffset:     0
75         RelocSegment:    0
76         Blocks:
77           - FileName:        '\usr\local\google\home\majnemer\llvm\src\tools\lld\<stdin>'
78             Lines:
79               - Offset:          0
80                 LineStart:       1
81                 IsStatement:     false
82                 EndDelta:        0
83             Columns:
84               - StartColumn:     0
85                 EndColumn:       0
86       - !FileChecksums
87         Checksums:
88           - FileName:        '\usr\local\google\home\majnemer\llvm\src\tools\lld\<stdin>'
89             Kind:            None
90             Checksum:        ''
91       - !StringTable
92         Strings:
93           - '\usr\local\google\home\majnemer\llvm\src\tools\lld\<stdin>'
94     Relocations:
95       - VirtualAddress:  44
96         SymbolName:      _main
97         Type:            IMAGE_REL_I386_SECREL
98       - VirtualAddress:  48
99         SymbolName:      _main
100         Type:            IMAGE_REL_I386_SECTION
101       - VirtualAddress:  68
102         SymbolName:      _main
103         Type:            IMAGE_REL_I386_SECREL
104       - VirtualAddress:  72
105         SymbolName:      _main
106         Type:            IMAGE_REL_I386_SECTION
107   - Name:            .debug_str
108     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
109     Alignment:       1
110     SectionData:     ''
111   - Name:            .debug_loc
112     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
113     Alignment:       1
114     SectionData:     ''
115   - Name:            .debug_abbrev
116     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
117     Alignment:       1
118     SectionData:     011101250E1305030E10171B0E110112060000023400030E49133F193A0B3B0B02186E0E0000032400030E3E0B0B0B0000042E0011011206E77F194018030E3A0B3B0B49133F19000000
119   - Name:            .debug_info
120     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
121     Alignment:       1
122     SectionData:     54000000040000000000040100000000040037000000000000003F000000000000001000000002720000003B0000000101050300000000780000000374000000050404000000001000000001548000000001013B00000000
123     Relocations:
124       - VirtualAddress:  6
125         SymbolName:      .debug_abbrev
126         Type:            IMAGE_REL_I386_SECREL
127       - VirtualAddress:  12
128         SymbolName:      .debug_str
129         Type:            IMAGE_REL_I386_SECREL
130       - VirtualAddress:  18
131         SymbolName:      .debug_str
132         Type:            IMAGE_REL_I386_SECREL
133       - VirtualAddress:  22
134         SymbolName:      .debug_line
135         Type:            IMAGE_REL_I386_SECREL
136       - VirtualAddress:  26
137         SymbolName:      .debug_str
138         Type:            IMAGE_REL_I386_SECREL
139       - VirtualAddress:  30
140         SymbolName:      .text
141         Type:            IMAGE_REL_I386_DIR32
142       - VirtualAddress:  39
143         SymbolName:      .debug_str
144         Type:            IMAGE_REL_I386_SECREL
145       - VirtualAddress:  51
146         SymbolName:      '?x@@3HA'
147         Type:            IMAGE_REL_I386_DIR32
148       - VirtualAddress:  55
149         SymbolName:      .debug_str
150         Type:            IMAGE_REL_I386_SECREL
151       - VirtualAddress:  60
152         SymbolName:      .debug_str
153         Type:            IMAGE_REL_I386_SECREL
154       - VirtualAddress:  67
155         SymbolName:      .text
156         Type:            IMAGE_REL_I386_DIR32
157       - VirtualAddress:  77
158         SymbolName:      .debug_str
159         Type:            IMAGE_REL_I386_SECREL
160   - Name:            .debug_ranges
161     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
162     Alignment:       1
163     SectionData:     ''
164   - Name:            .debug_pubnames
165     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
166     Alignment:       1
167     SectionData:     1D00000002000000000058000000420000006D61696E0026000000780000000000
168     Relocations:
169       - VirtualAddress:  6
170         SymbolName:      .debug_info
171         Type:            IMAGE_REL_I386_SECREL
172   - Name:            .debug_pubtypes
173     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
174     Alignment:       1
175     SectionData:     16000000020000000000580000003B000000696E740000000000
176     Relocations:
177       - VirtualAddress:  6
178         SymbolName:      .debug_info
179         Type:            IMAGE_REL_I386_SECREL
180   - Name:            .debug_line
181     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
182     Alignment:       1
183     SectionData:     3300000002001E0000000101FB0E0D000101010100000001000001003C737464696E3E000000000000050200000000010AD60202000101
184     Relocations:
185       - VirtualAddress:  43
186         SymbolName:      .text
187         Type:            IMAGE_REL_I386_DIR32
188   - Name:            .rmeta
189     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
190     Alignment:       1
191     SectionData:     00112233
192 symbols:
193   - Name:            .text
194     Value:           0
195     SectionNumber:   1
196     SimpleType:      IMAGE_SYM_TYPE_NULL
197     ComplexType:     IMAGE_SYM_DTYPE_NULL
198     StorageClass:    IMAGE_SYM_CLASS_STATIC
199     SectionDefinition:
200       Length:          16
201       NumberOfRelocations: 1
202       NumberOfLinenumbers: 0
203       CheckSum:        0
204       Number:          1
205   - Name:            .data
206     Value:           0
207     SectionNumber:   2
208     SimpleType:      IMAGE_SYM_TYPE_NULL
209     ComplexType:     IMAGE_SYM_DTYPE_NULL
210     StorageClass:    IMAGE_SYM_CLASS_STATIC
211     SectionDefinition:
212       Length:          0
213       NumberOfRelocations: 0
214       NumberOfLinenumbers: 0
215       CheckSum:        0
216       Number:          2
217   - Name:            .bss
218     Value:           0
219     SectionNumber:   3
220     SimpleType:      IMAGE_SYM_TYPE_NULL
221     ComplexType:     IMAGE_SYM_DTYPE_NULL
222     StorageClass:    IMAGE_SYM_CLASS_STATIC
223     SectionDefinition:
224       Length:          4
225       NumberOfRelocations: 0
226       NumberOfLinenumbers: 0
227       CheckSum:        0
228       Number:          3
229   - Name:            '.debug$S'
230     Value:           0
231     SectionNumber:   4
232     SimpleType:      IMAGE_SYM_TYPE_NULL
233     ComplexType:     IMAGE_SYM_DTYPE_NULL
234     StorageClass:    IMAGE_SYM_CLASS_STATIC
235     SectionDefinition:
236       Length:          188
237       NumberOfRelocations: 4
238       NumberOfLinenumbers: 0
239       CheckSum:        0
240       Number:          4
241   - Name:            .debug_str
242     Value:           0
243     SectionNumber:   5
244     SimpleType:      IMAGE_SYM_TYPE_NULL
245     ComplexType:     IMAGE_SYM_DTYPE_NULL
246     StorageClass:    IMAGE_SYM_CLASS_STATIC
247     SectionDefinition:
248       Length:          133
249       NumberOfRelocations: 0
250       NumberOfLinenumbers: 0
251       CheckSum:        0
252       Number:          5
253   - Name:            .debug_loc
254     Value:           0
255     SectionNumber:   6
256     SimpleType:      IMAGE_SYM_TYPE_NULL
257     ComplexType:     IMAGE_SYM_DTYPE_NULL
258     StorageClass:    IMAGE_SYM_CLASS_STATIC
259     SectionDefinition:
260       Length:          0
261       NumberOfRelocations: 0
262       NumberOfLinenumbers: 0
263       CheckSum:        0
264       Number:          6
265   - Name:            .debug_abbrev
266     Value:           0
267     SectionNumber:   7
268     SimpleType:      IMAGE_SYM_TYPE_NULL
269     ComplexType:     IMAGE_SYM_DTYPE_NULL
270     StorageClass:    IMAGE_SYM_CLASS_STATIC
271     SectionDefinition:
272       Length:          74
273       NumberOfRelocations: 0
274       NumberOfLinenumbers: 0
275       CheckSum:        0
276       Number:          7
277   - Name:            .debug_info
278     Value:           0
279     SectionNumber:   8
280     SimpleType:      IMAGE_SYM_TYPE_NULL
281     ComplexType:     IMAGE_SYM_DTYPE_NULL
282     StorageClass:    IMAGE_SYM_CLASS_STATIC
283     SectionDefinition:
284       Length:          88
285       NumberOfRelocations: 12
286       NumberOfLinenumbers: 0
287       CheckSum:        0
288       Number:          8
289   - Name:            .debug_ranges
290     Value:           0
291     SectionNumber:   9
292     SimpleType:      IMAGE_SYM_TYPE_NULL
293     ComplexType:     IMAGE_SYM_DTYPE_NULL
294     StorageClass:    IMAGE_SYM_CLASS_STATIC
295     SectionDefinition:
296       Length:          0
297       NumberOfRelocations: 0
298       NumberOfLinenumbers: 0
299       CheckSum:        0
300       Number:          9
301   - Name:            .debug_pubnames
302     Value:           0
303     SectionNumber:   10
304     SimpleType:      IMAGE_SYM_TYPE_NULL
305     ComplexType:     IMAGE_SYM_DTYPE_NULL
306     StorageClass:    IMAGE_SYM_CLASS_STATIC
307     SectionDefinition:
308       Length:          33
309       NumberOfRelocations: 1
310       NumberOfLinenumbers: 0
311       CheckSum:        0
312       Number:          10
313   - Name:            .debug_pubtypes
314     Value:           0
315     SectionNumber:   11
316     SimpleType:      IMAGE_SYM_TYPE_NULL
317     ComplexType:     IMAGE_SYM_DTYPE_NULL
318     StorageClass:    IMAGE_SYM_CLASS_STATIC
319     SectionDefinition:
320       Length:          26
321       NumberOfRelocations: 1
322       NumberOfLinenumbers: 0
323       CheckSum:        0
324       Number:          11
325   - Name:            .debug_line
326     Value:           0
327     SectionNumber:   12
328     SimpleType:      IMAGE_SYM_TYPE_NULL
329     ComplexType:     IMAGE_SYM_DTYPE_NULL
330     StorageClass:    IMAGE_SYM_CLASS_STATIC
331     SectionDefinition:
332       Length:          55
333       NumberOfRelocations: 1
334       NumberOfLinenumbers: 0
335       CheckSum:        0
336       Number:          12
337   - Name:            '@feat.00'
338     Value:           1
339     SectionNumber:   -1
340     SimpleType:      IMAGE_SYM_TYPE_NULL
341     ComplexType:     IMAGE_SYM_DTYPE_NULL
342     StorageClass:    IMAGE_SYM_CLASS_STATIC
343   - Name:            _main
344     Value:           0
345     SectionNumber:   1
346     SimpleType:      IMAGE_SYM_TYPE_NULL
347     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
348     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
349   - Name:            '?x@@3HA'
350     Value:           0
351     SectionNumber:   3
352     SimpleType:      IMAGE_SYM_TYPE_NULL
353     ComplexType:     IMAGE_SYM_DTYPE_NULL
354     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL