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