150
|
1 # RUN: yaml2obj %s -o %t.obj
|
|
2 # RUN: lld-link %t.obj %S/Inputs/pdb-import-gc.lib -debug -entry:main \
|
|
3 # RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb
|
|
4 # RUN: llvm-pdbutil dump -globals -symbols %t.pdb | FileCheck %s
|
|
5
|
|
6 # This tests the case where an __imp_ chunk is discarded by linker GC. The debug
|
|
7 # info may refer to the __imp_ symbol still.
|
|
8
|
|
9 # Compile this code with MSVC to regenerate the test case:
|
|
10 # extern char __declspec(dllimport) __wc_mb_cur;
|
|
11 # int discarded() { return __wc_mb_cur; }
|
|
12 # int main() { return g2; }
|
|
13
|
|
14 # CHECK: Global Symbols
|
|
15 # CHECK-NEXT: ============================================================
|
|
16 # CHECK-NEXT: Records
|
|
17 # CHECK-NEXT: 20 | S_GDATA32 [size = 32] `__imp___wc_mb_cur`
|
|
18 # CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
|
|
19
|
|
20 # CHECK: Symbols
|
|
21 # CHECK-NEXT: ============================================================
|
|
22 # CHECK-NEXT: Mod 0000 | `{{.*}}pdb-import-gc.yaml.tmp.obj`:
|
|
23 # CHECK-NEXT: Mod 0001 | `* Linker *`:
|
|
24
|
|
25 --- !COFF
|
|
26 header:
|
|
27 Machine: IMAGE_FILE_MACHINE_AMD64
|
|
28 Characteristics: [ ]
|
|
29 sections:
|
|
30 - Name: '.debug$S'
|
|
31 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
|
|
32 Alignment: 1
|
|
33 Subsections:
|
|
34 - !Symbols
|
|
35 Records:
|
|
36 - Kind: S_GDATA32
|
|
37 DataSym:
|
|
38 Type: 112
|
|
39 DisplayName: __imp___wc_mb_cur
|
|
40 - !StringTable
|
|
41 Strings:
|
|
42 Relocations:
|
|
43 - VirtualAddress: 20
|
|
44 SymbolName: __imp___wc_mb_cur
|
|
45 Type: IMAGE_REL_AMD64_SECREL
|
|
46 - VirtualAddress: 24
|
|
47 SymbolName: __imp___wc_mb_cur
|
|
48 Type: IMAGE_REL_AMD64_SECTION
|
|
49 - Name: '.text$mn'
|
|
50 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
51 Alignment: 16
|
|
52 SectionData: 488B05000000000FBE00C3
|
|
53 Relocations:
|
|
54 - VirtualAddress: 3
|
|
55 SymbolName: __imp___wc_mb_cur
|
|
56 Type: IMAGE_REL_AMD64_REL32
|
|
57 - Name: '.text$mn'
|
|
58 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
59 Alignment: 16
|
|
60 SectionData: B82A000000C3
|
|
61 symbols:
|
|
62 - Name: '.debug$S'
|
|
63 Value: 0
|
|
64 SectionNumber: 1
|
|
65 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
66 ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
67 StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
68 SectionDefinition:
|
|
69 Length: 240
|
|
70 NumberOfRelocations: 2
|
|
71 NumberOfLinenumbers: 0
|
|
72 CheckSum: 0
|
|
73 Number: 0
|
|
74 - Name: '.text$mn'
|
|
75 Value: 0
|
|
76 SectionNumber: 2
|
|
77 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
78 ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
79 StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
80 SectionDefinition:
|
|
81 Length: 11
|
|
82 NumberOfRelocations: 1
|
|
83 NumberOfLinenumbers: 0
|
|
84 CheckSum: 2906070869
|
|
85 Number: 0
|
|
86 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
|
|
87 - Name: '.text$mn'
|
|
88 Value: 0
|
|
89 SectionNumber: 3
|
|
90 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
91 ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
92 StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
93 SectionDefinition:
|
|
94 Length: 6
|
|
95 NumberOfRelocations: 0
|
|
96 NumberOfLinenumbers: 0
|
|
97 CheckSum: 2139436471
|
|
98 Number: 0
|
|
99 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
|
|
100 - Name: discarded
|
|
101 Value: 0
|
|
102 SectionNumber: 2
|
|
103 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
104 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
|
105 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
106 - Name: main
|
|
107 Value: 0
|
|
108 SectionNumber: 3
|
|
109 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
110 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
|
|
111 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
112 - Name: __imp___wc_mb_cur
|
|
113 Value: 0
|
|
114 SectionNumber: 0
|
|
115 SimpleType: IMAGE_SYM_TYPE_NULL
|
|
116 ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
117 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
118 ...
|