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