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