119 lines · yaml
1# RUN: yaml2obj %s -o %t.obj2# RUN: lld-link %t.obj %S/Inputs/pdb-import-gc.lib -debug -entry:main \3# RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb4# RUN: llvm-pdbutil dump -globals -symbols %t.pdb | FileCheck %s5 6# This tests the case where an __imp_ chunk is discarded by linker GC. The debug7# 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 Symbols15# CHECK-NEXT: ============================================================16# CHECK-NEXT: Records17# CHECK-NEXT: 20 | S_GDATA32 [size = 32] `__imp___wc_mb_cur`18# CHECK-NEXT: type = 0x0070 (char), addr = 0000:000019 20# CHECK: Symbols21# CHECK-NEXT: ============================================================22# CHECK-NEXT: Mod 0000 | `{{.*}}pdb-import-gc.yaml.tmp.obj`:23# CHECK-NEXT: Mod 0001 | `* Linker *`:24 25--- !COFF26header:27 Machine: IMAGE_FILE_MACHINE_AMD6428 Characteristics: [ ]29sections:30 - Name: '.debug$S'31 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]32 Alignment: 133 Subsections:34 - !Symbols35 Records:36 - Kind: S_GDATA3237 DataSym:38 Type: 11239 DisplayName: __imp___wc_mb_cur40 - !StringTable41 Strings:42 Relocations:43 - VirtualAddress: 2044 SymbolName: __imp___wc_mb_cur45 Type: IMAGE_REL_AMD64_SECREL46 - VirtualAddress: 2447 SymbolName: __imp___wc_mb_cur48 Type: IMAGE_REL_AMD64_SECTION49 - Name: '.text$mn'50 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]51 Alignment: 1652 SectionData: 488B05000000000FBE00C353 Relocations:54 - VirtualAddress: 355 SymbolName: __imp___wc_mb_cur56 Type: IMAGE_REL_AMD64_REL3257 - Name: '.text$mn'58 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]59 Alignment: 1660 SectionData: B82A000000C361symbols:62 - Name: '.debug$S'63 Value: 064 SectionNumber: 165 SimpleType: IMAGE_SYM_TYPE_NULL66 ComplexType: IMAGE_SYM_DTYPE_NULL67 StorageClass: IMAGE_SYM_CLASS_STATIC68 SectionDefinition:69 Length: 24070 NumberOfRelocations: 271 NumberOfLinenumbers: 072 CheckSum: 073 Number: 074 - Name: '.text$mn'75 Value: 076 SectionNumber: 277 SimpleType: IMAGE_SYM_TYPE_NULL78 ComplexType: IMAGE_SYM_DTYPE_NULL79 StorageClass: IMAGE_SYM_CLASS_STATIC80 SectionDefinition:81 Length: 1182 NumberOfRelocations: 183 NumberOfLinenumbers: 084 CheckSum: 290607086985 Number: 086 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES87 - Name: '.text$mn'88 Value: 089 SectionNumber: 390 SimpleType: IMAGE_SYM_TYPE_NULL91 ComplexType: IMAGE_SYM_DTYPE_NULL92 StorageClass: IMAGE_SYM_CLASS_STATIC93 SectionDefinition:94 Length: 695 NumberOfRelocations: 096 NumberOfLinenumbers: 097 CheckSum: 213943647198 Number: 099 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES100 - Name: discarded101 Value: 0102 SectionNumber: 2103 SimpleType: IMAGE_SYM_TYPE_NULL104 ComplexType: IMAGE_SYM_DTYPE_FUNCTION105 StorageClass: IMAGE_SYM_CLASS_EXTERNAL106 - Name: main107 Value: 0108 SectionNumber: 3109 SimpleType: IMAGE_SYM_TYPE_NULL110 ComplexType: IMAGE_SYM_DTYPE_FUNCTION111 StorageClass: IMAGE_SYM_CLASS_EXTERNAL112 - Name: __imp___wc_mb_cur113 Value: 0114 SectionNumber: 0115 SimpleType: IMAGE_SYM_TYPE_NULL116 ComplexType: IMAGE_SYM_DTYPE_NULL117 StorageClass: IMAGE_SYM_CLASS_EXTERNAL118...119