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
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.
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; }
14 # CHECK: Global Symbols
15 # CHECK-NEXT: ============================================================
17 # CHECK-NEXT: 20 | S_GDATA32 [size = 32] `__imp___wc_mb_cur`
18 # CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
21 # CHECK-NEXT: ============================================================
22 # CHECK-NEXT: Mod 0000 | `{{.*}}pdb-import-gc.yaml.tmp.obj`:
23 # CHECK-NEXT: Mod 0001 | `* Linker *`:
27 Machine: IMAGE_FILE_MACHINE_AMD64
31 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
39 DisplayName: __imp___wc_mb_cur
44 SymbolName: __imp___wc_mb_cur
45 Type: IMAGE_REL_AMD64_SECREL
47 SymbolName: __imp___wc_mb_cur
48 Type: IMAGE_REL_AMD64_SECTION
50 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
52 SectionData: 488B05000000000FBE00C3
55 SymbolName: __imp___wc_mb_cur
56 Type: IMAGE_REL_AMD64_REL32
58 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
60 SectionData: B82A000000C3
65 SimpleType: IMAGE_SYM_TYPE_NULL
66 ComplexType: IMAGE_SYM_DTYPE_NULL
67 StorageClass: IMAGE_SYM_CLASS_STATIC
70 NumberOfRelocations: 2
71 NumberOfLinenumbers: 0
77 SimpleType: IMAGE_SYM_TYPE_NULL
78 ComplexType: IMAGE_SYM_DTYPE_NULL
79 StorageClass: IMAGE_SYM_CLASS_STATIC
82 NumberOfRelocations: 1
83 NumberOfLinenumbers: 0
86 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
90 SimpleType: IMAGE_SYM_TYPE_NULL
91 ComplexType: IMAGE_SYM_DTYPE_NULL
92 StorageClass: IMAGE_SYM_CLASS_STATIC
95 NumberOfRelocations: 0
96 NumberOfLinenumbers: 0
99 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
103 SimpleType: IMAGE_SYM_TYPE_NULL
104 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
105 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
109 SimpleType: IMAGE_SYM_TYPE_NULL
110 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
111 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
112 - Name: __imp___wc_mb_cur
115 SimpleType: IMAGE_SYM_TYPE_NULL
116 ComplexType: IMAGE_SYM_DTYPE_NULL
117 StorageClass: IMAGE_SYM_CLASS_EXTERNAL