Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / pdb-symbol-types.yaml
blobd8741afd8cded4e300bb76db07b17ea73c573cf0
1 # RUN: yaml2obj %s -o %t.obj
2 # RUN: lld-link %t.obj -nodefaultlib -entry:main -debug -out:%t.exe -pdb:%t.pdb
3 # RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s
5 # To regenerate the object file:
6 # $ cat symbol-types.c
7 # struct Foo { int x; };
8 # typedef struct Foo UDT_Foo;
9 # UDT_Foo global_foo = {42};
10 # int main() { return global_foo.x; }
11 # $ cl -c -Z7 symbol-types.c
13 # Note that the type of 'global' goes from 0x1005 in the object file to 0x1004
14 # in the PDB because the LF_FUNC_ID is moved to the id stream.
16 # CHECK-LABEL:                  Global Symbols
17 # CHECK-NEXT:  ============================================================
18 # CHECK-NEXT:   Records
19 # CHECK-NEXT:       48 | S_PROCREF [size = 20] `main`
20 # CHECK-NEXT:            module = 1, sum name = 0, offset = 116
21 # CHECK-NEXT:       96 | S_UDT [size = 16] `UDT_Foo`
22 # CHECK-NEXT:            original type = 0x1004
23 # CHECK-NEXT:      112 | S_UDT [size = 12] `Foo`
24 # CHECK-NEXT:            original type = 0x1004
25 # CHECK-NEXT:       68 | S_GDATA32 [size = 28] `global_foo`
26 # CHECK-NEXT:            type = 0x1004 (Foo), addr = 0003:0000
28 # CHECK:                           Symbols
29 # CHECK: ============================================================
30 # CHECK-LABEL:   Mod 0000 | `{{.*}}pdb-symbol-types.yaml.tmp.obj`:
31 # CHECK:     4 | S_OBJNAME [size = 52] sig=0, `C:\src\llvm-project\build\symbol-types.obj`
32 # CHECK:    56 | S_COMPILE3 [size = 60]
33 # CHECK:         machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, language = c
34 # CHECK:         frontend = 19.0.24215.1, backend = 19.0.24215.1
35 # CHECK:         flags = security checks | hot patchable
36 # CHECK:   116 | S_GPROC32 [size = 44] `main`
37 # CHECK:         parent = 0, end = 192, addr = 0001:0000, code size = 7
38 # CHECK:         debug start = 0, debug end = 6, flags = none
39 # CHECK:   160 | S_FRAMEPROC [size = 32]
40 # CHECK:         size = 0, padding size = 0, offset to padding = 0
41 # CHECK:         bytes of callee saved registers = 0, exception handler addr = 0000:0000
42 # CHECK:         flags = has async eh | opt speed
43 # CHECK:   192 | S_END [size = 4]
44 # CHECK:   196 | S_BUILDINFO [size = 8] BuildId = `0x100A`
45 # CHECK-LABEL:   Mod 0001 | `* Linker *`:
47 --- !COFF
48 header:
49   Machine:         IMAGE_FILE_MACHINE_AMD64
50   Characteristics: [  ]
51 sections:
52   - Name:            .drectve
53     Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
54     Alignment:       1
55     SectionData:     2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
56   - Name:            '.debug$S'
57     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
58     Alignment:       1
59     Subsections:
60       - !Symbols
61         Records:
62           - Kind:            S_OBJNAME
63             ObjNameSym:
64               Signature:       0
65               ObjectName:      'C:\src\llvm-project\build\symbol-types.obj'
66           - Kind:            S_COMPILE3
67             Compile3Sym:
68               Flags:           [ SecurityChecks, HotPatch ]
69               Machine:         X64
70               FrontendMajor:   19
71               FrontendMinor:   0
72               FrontendBuild:   24215
73               FrontendQFE:     1
74               BackendMajor:    19
75               BackendMinor:    0
76               BackendBuild:    24215
77               BackendQFE:      1
78               Version:         'Microsoft (R) Optimizing Compiler'
79       - !Symbols
80         Records:
81           - Kind:            S_GPROC32_ID
82             ProcSym:
83               CodeSize:        7
84               DbgStart:        0
85               DbgEnd:          6
86               FunctionType:    4098
87               Flags:           [  ]
88               DisplayName:     main
89           - Kind:            S_FRAMEPROC
90             FrameProcSym:
91               TotalFrameBytes: 0
92               PaddingFrameBytes: 0
93               OffsetToPadding: 0
94               BytesOfCalleeSavedRegisters: 0
95               OffsetOfExceptionHandler: 0
96               SectionIdOfExceptionHandler: 0
97               Flags:           [ AsynchronousExceptionHandling, OptimizedForSpeed ]
98           - Kind:            S_PROC_ID_END
99             ScopeEndSym:
100       - !Lines
101         CodeSize:        7
102         Flags:           [  ]
103         RelocOffset:     0
104         RelocSegment:    0
105         Blocks:
106           - FileName:        'c:\src\llvm-project\build\symbol-types.c'
107             Lines:
108               - Offset:          0
109                 LineStart:       4
110                 IsStatement:     true
111                 EndDelta:        0
112               - Offset:          0
113                 LineStart:       5
114                 IsStatement:     true
115                 EndDelta:        0
116               - Offset:          6
117                 LineStart:       6
118                 IsStatement:     true
119                 EndDelta:        0
120             Columns:
121       - !Symbols
122         Records:
123           - Kind:            S_GDATA32
124             DataSym:
125               Type:            4101
126               DisplayName:     global_foo
127           - Kind:            S_UDT
128             UDTSym:
129               Type:            4101
130               UDTName:         UDT_Foo
131           - Kind:            S_UDT
132             UDTSym:
133               Type:            4101
134               UDTName:         Foo
135       - !FileChecksums
136         Checksums:
137           - FileName:        'c:\src\llvm-project\build\symbol-types.c'
138             Kind:            MD5
139             Checksum:        F833E1A4909FF6FEC5689A664F3BE725
140       - !StringTable
141         Strings:
142           - 'c:\src\llvm-project\build\symbol-types.c'
143       - !Symbols
144         Records:
145           - Kind:            S_BUILDINFO
146             BuildInfoSym:
147               BuildId:         4111
148     Relocations:
149       - VirtualAddress:  164
150         SymbolName:      main
151         Type:            IMAGE_REL_AMD64_SECREL
152       - VirtualAddress:  168
153         SymbolName:      main
154         Type:            IMAGE_REL_AMD64_SECTION
155       - VirtualAddress:  220
156         SymbolName:      main
157         Type:            IMAGE_REL_AMD64_SECREL
158       - VirtualAddress:  224
159         SymbolName:      main
160         Type:            IMAGE_REL_AMD64_SECTION
161       - VirtualAddress:  284
162         SymbolName:      global_foo
163         Type:            IMAGE_REL_AMD64_SECREL
164       - VirtualAddress:  288
165         SymbolName:      global_foo
166         Type:            IMAGE_REL_AMD64_SECTION
167   - Name:            '.debug$T'
168     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
169     Alignment:       1
170     Types:
171       - Kind:            LF_ARGLIST
172         ArgList:
173           ArgIndices:      [ 0 ]
174       - Kind:            LF_PROCEDURE
175         Procedure:
176           ReturnType:      116
177           CallConv:        NearC
178           Options:         [ None ]
179           ParameterCount:  0
180           ArgumentList:    4096
181       - Kind:            LF_FUNC_ID
182         FuncId:
183           ParentScope:     0
184           FunctionType:    4097
185           Name:            main
186       - Kind:            LF_STRUCTURE
187         Class:
188           MemberCount:     0
189           Options:         [ None, ForwardReference, HasUniqueName ]
190           FieldList:       0
191           Name:            Foo
192           UniqueName:      '.?AUFoo@@'
193           DerivationList:  0
194           VTableShape:     0
195           Size:            0
196       - Kind:            LF_FIELDLIST
197         FieldList:
198           - Kind:            LF_MEMBER
199             DataMember:
200               Attrs:           3
201               Type:            116
202               FieldOffset:     0
203               Name:            x
204       - Kind:            LF_STRUCTURE
205         Class:
206           MemberCount:     1
207           Options:         [ None, HasUniqueName ]
208           FieldList:       4100
209           Name:            Foo
210           UniqueName:      '.?AUFoo@@'
211           DerivationList:  0
212           VTableShape:     0
213           Size:            4
214       - Kind:            LF_STRING_ID
215         StringId:
216           Id:              0
217           String:          'c:\src\llvm-project\build\symbol-types.c'
218       - Kind:            LF_UDT_SRC_LINE
219         UdtSourceLine:
220           UDT:             4101
221           SourceFile:      4102
222           LineNumber:      1
223       - Kind:            LF_STRING_ID
224         StringId:
225           Id:              0
226           String:          'C:\src\llvm-project\build'
227       - Kind:            LF_STRING_ID
228         StringId:
229           Id:              0
230           String:          'C:\PROGRA~2\MICROS~1.0\VC\Bin\amd64\cl.exe'
231       - Kind:            LF_STRING_ID
232         StringId:
233           Id:              0
234           String:          '-c -Z7 -MT -IC:\PROGRA~2\MICROS~1.0\VC\include -IC:\PROGRA~2\MICROS~1.0\VC\atlmfc\include -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\ucrt -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\shared -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\um'
235       - Kind:            LF_SUBSTR_LIST
236         StringList:
237           StringIndices:   [ 4106 ]
238       - Kind:            LF_STRING_ID
239         StringId:
240           Id:              4107
241           String:          ' -IC:\PROGRA~2\WI3CF2~1\10\include\10.0.14393.0\winrt -TC -X'
242       - Kind:            LF_STRING_ID
243         StringId:
244           Id:              0
245           String:          symbol-types.c
246       - Kind:            LF_STRING_ID
247         StringId:
248           Id:              0
249           String:          'C:\src\llvm-project\build\vc140.pdb'
250       - Kind:            LF_BUILDINFO
251         BuildInfo:
252           ArgIndices:      [ 4104, 4105, 4109, 4110, 4108 ]
253   - Name:            .data
254     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
255     Alignment:       4
256     SectionData:     2A000000
257   - Name:            '.text$mn'
258     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
259     Alignment:       16
260     SectionData:     8B0500000000C3
261     Relocations:
262       - VirtualAddress:  2
263         SymbolName:      global_foo
264         Type:            IMAGE_REL_AMD64_REL32
265 symbols:
266   - Name:            '@comp.id'
267     Value:           17063575
268     SectionNumber:   -1
269     SimpleType:      IMAGE_SYM_TYPE_NULL
270     ComplexType:     IMAGE_SYM_DTYPE_NULL
271     StorageClass:    IMAGE_SYM_CLASS_STATIC
272   - Name:            '@feat.00'
273     Value:           2147484048
274     SectionNumber:   -1
275     SimpleType:      IMAGE_SYM_TYPE_NULL
276     ComplexType:     IMAGE_SYM_DTYPE_NULL
277     StorageClass:    IMAGE_SYM_CLASS_STATIC
278   - Name:            .drectve
279     Value:           0
280     SectionNumber:   1
281     SimpleType:      IMAGE_SYM_TYPE_NULL
282     ComplexType:     IMAGE_SYM_DTYPE_NULL
283     StorageClass:    IMAGE_SYM_CLASS_STATIC
284     SectionDefinition:
285       Length:          47
286       NumberOfRelocations: 0
287       NumberOfLinenumbers: 0
288       CheckSum:        0
289       Number:          0
290   - Name:            '.debug$S'
291     Value:           0
292     SectionNumber:   2
293     SimpleType:      IMAGE_SYM_TYPE_NULL
294     ComplexType:     IMAGE_SYM_DTYPE_NULL
295     StorageClass:    IMAGE_SYM_CLASS_STATIC
296     SectionDefinition:
297       Length:          432
298       NumberOfRelocations: 6
299       NumberOfLinenumbers: 0
300       CheckSum:        0
301       Number:          0
302   - Name:            '.debug$T'
303     Value:           0
304     SectionNumber:   3
305     SimpleType:      IMAGE_SYM_TYPE_NULL
306     ComplexType:     IMAGE_SYM_DTYPE_NULL
307     StorageClass:    IMAGE_SYM_CLASS_STATIC
308     SectionDefinition:
309       Length:          732
310       NumberOfRelocations: 0
311       NumberOfLinenumbers: 0
312       CheckSum:        0
313       Number:          0
314   - Name:            .data
315     Value:           0
316     SectionNumber:   4
317     SimpleType:      IMAGE_SYM_TYPE_NULL
318     ComplexType:     IMAGE_SYM_DTYPE_NULL
319     StorageClass:    IMAGE_SYM_CLASS_STATIC
320     SectionDefinition:
321       Length:          4
322       NumberOfRelocations: 0
323       NumberOfLinenumbers: 0
324       CheckSum:        3482275674
325       Number:          0
326   - Name:            global_foo
327     Value:           0
328     SectionNumber:   4
329     SimpleType:      IMAGE_SYM_TYPE_NULL
330     ComplexType:     IMAGE_SYM_DTYPE_NULL
331     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
332   - Name:            '.text$mn'
333     Value:           0
334     SectionNumber:   5
335     SimpleType:      IMAGE_SYM_TYPE_NULL
336     ComplexType:     IMAGE_SYM_DTYPE_NULL
337     StorageClass:    IMAGE_SYM_CLASS_STATIC
338     SectionDefinition:
339       Length:          7
340       NumberOfRelocations: 1
341       NumberOfLinenumbers: 0
342       CheckSum:        3635526833
343       Number:          0
344   - Name:            main
345     Value:           0
346     SectionNumber:   5
347     SimpleType:      IMAGE_SYM_TYPE_NULL
348     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
349     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL