1# This test has an S_GPROC32_ID symbol with an invalid type index. Make sure we
2# keep the record, or we'll have unbalanced scopes, which is bad. This situation
3# can arise when we can't find the type server PDB.
4
5# RUN: yaml2obj %s -o %t.obj
6# RUN: lld-link %t.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main
7# RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
8
9# CHECK: Mod 0000 | `{{.*}}pdb-invalid-func-type.yaml.tmp.obj`:
10# CHECK:      4 | S_GPROC32 [size = 44] `main`
11# CHECK:          parent = 0, end = 80, addr = 0001:0000, code size = 3
12# CHECK:     48 | S_FRAMEPROC [size = 32]
13# CHECK:     80 | S_END [size = 4]
14
15--- !COFF
16header:
17  Machine:         IMAGE_FILE_MACHINE_AMD64
18  Characteristics: [  ]
19sections:
20  - Name:            '.debug$S'
21    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
22    Alignment:       1
23    Subsections:
24      - !Symbols
25        Records:
26          - Kind:            S_GPROC32_ID
27            ProcSym:
28              CodeSize:        3
29              DbgStart:        0
30              DbgEnd:          2
31              # Corrupt function type!
32              FunctionType:    4101
33              Flags:           [  ]
34              DisplayName:     main
35          - Kind:            S_FRAMEPROC
36            FrameProcSym:
37              TotalFrameBytes: 0
38              PaddingFrameBytes: 0
39              OffsetToPadding: 0
40              BytesOfCalleeSavedRegisters: 0
41              OffsetOfExceptionHandler: 0
42              SectionIdOfExceptionHandler: 0
43              Flags:           [ AsynchronousExceptionHandling, OptimizedForSpeed ]
44          - Kind:            S_PROC_ID_END
45            ScopeEndSym:
46      - !Lines
47        CodeSize:        3
48        Flags:           [  ]
49        RelocOffset:     0
50        RelocSegment:    0
51        Blocks:
52          - FileName:        'c:\src\llvm-project\build\t.c'
53            Lines:
54              - Offset:          0
55                LineStart:       1
56                IsStatement:     true
57                EndDelta:        0
58            Columns:
59      - !FileChecksums
60        Checksums:
61          - FileName:        'c:\src\llvm-project\build\t.c'
62            Kind:            MD5
63            Checksum:        270A878DCC1B845655B162F56C4F5020
64      - !StringTable
65        Strings:
66          - 'c:\src\llvm-project\build\t.c'
67    Relocations:
68      - VirtualAddress:  44
69        SymbolName:      main
70        Type:            IMAGE_REL_AMD64_SECREL
71      - VirtualAddress:  48
72        SymbolName:      main
73        Type:            IMAGE_REL_AMD64_SECTION
74      - VirtualAddress:  100
75        SymbolName:      main
76        Type:            IMAGE_REL_AMD64_SECREL
77      - VirtualAddress:  104
78        SymbolName:      main
79        Type:            IMAGE_REL_AMD64_SECTION
80  - Name:            '.debug$T'
81    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
82    Alignment:       1
83    Types:
84      - Kind:            LF_ARGLIST
85        ArgList:
86          ArgIndices:      [ 0 ]
87      - Kind:            LF_PROCEDURE
88        Procedure:
89          ReturnType:      116
90          CallConv:        NearC
91          Options:         [ None ]
92          ParameterCount:  0
93          ArgumentList:    4096
94      - Kind:            LF_FUNC_ID
95        FuncId:
96          ParentScope:     0
97          FunctionType:    4097
98          Name:            main
99  - Name:            '.text$mn'
100    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
101    Alignment:       16
102    SectionData:     33C0C3
103symbols:
104  - Name:            '.debug$S'
105    Value:           0
106    SectionNumber:   1
107    SimpleType:      IMAGE_SYM_TYPE_NULL
108    ComplexType:     IMAGE_SYM_DTYPE_NULL
109    StorageClass:    IMAGE_SYM_CLASS_STATIC
110    SectionDefinition:
111      Length:          328
112      NumberOfRelocations: 4
113      NumberOfLinenumbers: 0
114      CheckSum:        0
115      Number:          0
116  - Name:            '.debug$T'
117    Value:           0
118    SectionNumber:   2
119    SimpleType:      IMAGE_SYM_TYPE_NULL
120    ComplexType:     IMAGE_SYM_DTYPE_NULL
121    StorageClass:    IMAGE_SYM_CLASS_STATIC
122    SectionDefinition:
123      Length:          564
124      NumberOfRelocations: 0
125      NumberOfLinenumbers: 0
126      CheckSum:        0
127      Number:          0
128  - Name:            '.text$mn'
129    Value:           0
130    SectionNumber:   3
131    SimpleType:      IMAGE_SYM_TYPE_NULL
132    ComplexType:     IMAGE_SYM_DTYPE_NULL
133    StorageClass:    IMAGE_SYM_CLASS_STATIC
134    SectionDefinition:
135      Length:          3
136      NumberOfRelocations: 0
137      NumberOfLinenumbers: 0
138      CheckSum:        4021952397
139      Number:          0
140  - Name:            main
141    Value:           0
142    SectionNumber:   3
143    SimpleType:      IMAGE_SYM_TYPE_NULL
144    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
145    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
146...
147