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