2 # RUN: yaml2obj %s -o %t.obj
3 # RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc -filetype=obj -o %t2.obj
4 # RUN: lld-link %t.obj %t2.obj -debug -entry:main \
5 # RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb -verbose
6 # RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s
8 # This tests the case where an __imp_ chunk is discarded by linker GC. The debug
9 # info may refer to the __imp_ symbol still.
11 # Compile this code with MSVC to regenerate the test case:
12 # extern char __declspec(dllimport) __wc_mb_cur;
13 # int discarded() { return __wc_mb_cur; }
14 # int main() { return g2; }
16 # CHECK: Global Symbols
17 # CHECK-NEXT: ============================================================
19 # CHECK-NEXT: 20 | S_GDATA32 [size = 28] `__wc_mb_cur`
20 # CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
23 # CHECK: ============================================================
24 # CHECK-NEXT: Mod 0000 | `{{.*}}pdb-global-gc.yaml.tmp.obj`:
25 # CHECK-NEXT: Mod 0001 | `{{.*}}pdb-global-gc.yaml.tmp2.obj`:
26 # CHECK-NEXT: Error loading module stream 1. The specified stream could not be loaded. Module stream not present
27 # CHECK-NEXT: Mod 0002 | `* Linker *`:
31 Machine: IMAGE_FILE_MACHINE_AMD64
35 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
43 DisplayName: __wc_mb_cur
48 SymbolName: __wc_mb_cur
49 Type: IMAGE_REL_AMD64_SECREL
51 SymbolName: __wc_mb_cur
52 Type: IMAGE_REL_AMD64_SECTION
54 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
56 SectionData: 0FBE0500000000C3
59 SymbolName: __wc_mb_cur
60 Type: IMAGE_REL_AMD64_REL32
62 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
64 SectionData: B82A000000C3
69 SimpleType: IMAGE_SYM_TYPE_NULL
70 ComplexType: IMAGE_SYM_DTYPE_NULL
71 StorageClass: IMAGE_SYM_CLASS_STATIC
74 NumberOfRelocations: 2
75 NumberOfLinenumbers: 0
81 SimpleType: IMAGE_SYM_TYPE_NULL
82 ComplexType: IMAGE_SYM_DTYPE_NULL
83 StorageClass: IMAGE_SYM_CLASS_STATIC
86 NumberOfRelocations: 1
87 NumberOfLinenumbers: 0
90 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
94 SimpleType: IMAGE_SYM_TYPE_NULL
95 ComplexType: IMAGE_SYM_DTYPE_NULL
96 StorageClass: IMAGE_SYM_CLASS_STATIC
99 NumberOfRelocations: 0
100 NumberOfLinenumbers: 0
103 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
107 SimpleType: IMAGE_SYM_TYPE_NULL
108 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
109 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
113 SimpleType: IMAGE_SYM_TYPE_NULL
114 ComplexType: IMAGE_SYM_DTYPE_FUNCTION
115 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
119 SimpleType: IMAGE_SYM_TYPE_NULL
120 ComplexType: IMAGE_SYM_DTYPE_NULL
121 StorageClass: IMAGE_SYM_CLASS_EXTERNAL