1# This is an object compiled with /Zi (see the LF_TYPESERVER2 record) without an
2# adjacent type server PDB. Test that LLD fails gracefully on it.
3# Also try linking another OBJ with a reference to the same PDB
4
5# RUN: yaml2obj %s -o %t1.obj
6# RUN: yaml2obj %p/Inputs/pdb-type-server-missing-2.yaml -o %t2.obj
7# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s -check-prefix=WARN
8# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 2>&1 | FileCheck %s -check-prefix=IGNORE -allow-empty
9# RUN: not lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /WX 2>&1 | FileCheck %s -check-prefix=ERR
10# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 /WX 2>&1 | FileCheck %s -check-prefix=IGNORE-ERR -allow-empty
11
12# WARN: warning: Cannot use debug info for '{{.*}}.obj' [LNK4099]
13# WARN-NEXT: {{N|n}}o such file or directory
14
15# IGNORE-NOT: warning: Cannot use debug info for '{{.*}}.obj' [LNK4099]
16# IGNORE-NOT: {{N|n}}o such file or directory
17
18# ERR: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
19# ERR-NEXT: {{N|n}}o such file or directory
20
21# IGNORE-ERR-NOT: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
22# IGNORE-ERR-NOT: {{N|n}}o such file or directory
23
24--- !COFF
25header:
26  Machine:         IMAGE_FILE_MACHINE_AMD64
27  Characteristics: [  ]
28sections:
29  - Name:            '.debug$S'
30    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
31    Alignment:       1
32    Subsections:
33      - !Symbols
34        Records:
35          - Kind:            S_GPROC32_ID
36            ProcSym:
37              CodeSize:        3
38              DbgStart:        0
39              DbgEnd:          2
40              FunctionType:    4199
41              Flags:           [  ]
42              DisplayName:     main
43          - Kind:            S_FRAMEPROC
44            FrameProcSym:
45              TotalFrameBytes: 0
46              PaddingFrameBytes: 0
47              OffsetToPadding: 0
48              BytesOfCalleeSavedRegisters: 0
49              OffsetOfExceptionHandler: 0
50              SectionIdOfExceptionHandler: 0
51              Flags:           [ AsynchronousExceptionHandling, OptimizedForSpeed ]
52          - Kind:            S_PROC_ID_END
53            ScopeEndSym:
54      - !Lines
55        CodeSize:        3
56        Flags:           [  ]
57        RelocOffset:     0
58        RelocSegment:    0
59        Blocks:
60          - FileName:        'c:\src\llvm-project\build\t.c'
61            Lines:
62              - Offset:          0
63                LineStart:       1
64                IsStatement:     true
65                EndDelta:        0
66            Columns:
67      - !FileChecksums
68        Checksums:
69          - FileName:        'c:\src\llvm-project\build\t.c'
70            Kind:            MD5
71            Checksum:        270A878DCC1B845655B162F56C4F5020
72      - !StringTable
73        Strings:
74          - 'c:\src\llvm-project\build\t.c'
75    Relocations:
76      - VirtualAddress:  44
77        SymbolName:      main
78        Type:            IMAGE_REL_AMD64_SECREL
79      - VirtualAddress:  48
80        SymbolName:      main
81        Type:            IMAGE_REL_AMD64_SECTION
82      - VirtualAddress:  100
83        SymbolName:      main
84        Type:            IMAGE_REL_AMD64_SECREL
85      - VirtualAddress:  104
86        SymbolName:      main
87        Type:            IMAGE_REL_AMD64_SECTION
88  - Name:            '.debug$T'
89    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
90    Alignment:       1
91    Types:
92      - Kind:            LF_TYPESERVER2
93        TypeServer2:
94          Guid:            '{01DF191B-22BF-6B42-96CE-5258B8329FE5}'
95          Age:             18
96          Name:            'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb'
97  - Name:            '.text$mn'
98    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
99    Alignment:       16
100    SectionData:     33C0C3
101symbols:
102  - Name:            '.debug$S'
103    Value:           0
104    SectionNumber:   1
105    SimpleType:      IMAGE_SYM_TYPE_NULL
106    ComplexType:     IMAGE_SYM_DTYPE_NULL
107    StorageClass:    IMAGE_SYM_CLASS_STATIC
108    SectionDefinition:
109      Length:          328
110      NumberOfRelocations: 4
111      NumberOfLinenumbers: 0
112      CheckSum:        0
113      Number:          0
114  - Name:            '.debug$T'
115    Value:           0
116    SectionNumber:   2
117    SimpleType:      IMAGE_SYM_TYPE_NULL
118    ComplexType:     IMAGE_SYM_DTYPE_NULL
119    StorageClass:    IMAGE_SYM_CLASS_STATIC
120    SectionDefinition:
121      Length:          564
122      NumberOfRelocations: 0
123      NumberOfLinenumbers: 0
124      CheckSum:        0
125      Number:          0
126  - Name:            '.text$mn'
127    Value:           0
128    SectionNumber:   3
129    SimpleType:      IMAGE_SYM_TYPE_NULL
130    ComplexType:     IMAGE_SYM_DTYPE_NULL
131    StorageClass:    IMAGE_SYM_CLASS_STATIC
132    SectionDefinition:
133      Length:          3
134      NumberOfRelocations: 0
135      NumberOfLinenumbers: 0
136      CheckSum:        4021952397
137      Number:          0
138  - Name:            main
139    Value:           0
140    SectionNumber:   3
141    SimpleType:      IMAGE_SYM_TYPE_NULL
142    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
143    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
144...
145