123 lines · yaml
1# REQUIRES: x862# RUN: yaml2obj %s -o %t.obj3# RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc -filetype=obj -o %t2.obj4# RUN: lld-link %t.obj %t2.obj -debug -entry:main \5# RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb -verbose6# RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s7 8# This tests the case where an __imp_ chunk is discarded by linker GC. The debug9# info may refer to the __imp_ symbol still.10 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; }15 16# CHECK: Global Symbols17# CHECK-NEXT: ============================================================18# CHECK-NEXT: Records19# CHECK-NEXT: 20 | S_GDATA32 [size = 28] `__wc_mb_cur`20# CHECK-NEXT: type = 0x0070 (char), addr = 0000:000021 22# CHECK: Symbols23# 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 present27# CHECK-NEXT: Mod 0002 | `* Linker *`:28 29--- !COFF30header:31 Machine: IMAGE_FILE_MACHINE_AMD6432 Characteristics: [ ]33sections:34 - Name: '.debug$S'35 Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]36 Alignment: 137 Subsections:38 - !Symbols39 Records:40 - Kind: S_GDATA3241 DataSym:42 Type: 11243 DisplayName: __wc_mb_cur44 - !StringTable45 Strings:46 Relocations:47 - VirtualAddress: 2048 SymbolName: __wc_mb_cur49 Type: IMAGE_REL_AMD64_SECREL50 - VirtualAddress: 2451 SymbolName: __wc_mb_cur52 Type: IMAGE_REL_AMD64_SECTION53 - Name: '.text$mn'54 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]55 Alignment: 1656 SectionData: 0FBE0500000000C357 Relocations:58 - VirtualAddress: 359 SymbolName: __wc_mb_cur60 Type: IMAGE_REL_AMD64_REL3261 - Name: '.text$mn'62 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]63 Alignment: 1664 SectionData: B82A000000C365symbols:66 - Name: '.debug$S'67 Value: 068 SectionNumber: 169 SimpleType: IMAGE_SYM_TYPE_NULL70 ComplexType: IMAGE_SYM_DTYPE_NULL71 StorageClass: IMAGE_SYM_CLASS_STATIC72 SectionDefinition:73 Length: 24074 NumberOfRelocations: 275 NumberOfLinenumbers: 076 CheckSum: 077 Number: 078 - Name: '.text$mn'79 Value: 080 SectionNumber: 281 SimpleType: IMAGE_SYM_TYPE_NULL82 ComplexType: IMAGE_SYM_DTYPE_NULL83 StorageClass: IMAGE_SYM_CLASS_STATIC84 SectionDefinition:85 Length: 1186 NumberOfRelocations: 187 NumberOfLinenumbers: 088 CheckSum: 290607086989 Number: 090 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES91 - Name: '.text$mn'92 Value: 093 SectionNumber: 394 SimpleType: IMAGE_SYM_TYPE_NULL95 ComplexType: IMAGE_SYM_DTYPE_NULL96 StorageClass: IMAGE_SYM_CLASS_STATIC97 SectionDefinition:98 Length: 699 NumberOfRelocations: 0100 NumberOfLinenumbers: 0101 CheckSum: 2139436471102 Number: 0103 Selection: IMAGE_COMDAT_SELECT_NODUPLICATES104 - Name: discarded105 Value: 0106 SectionNumber: 2107 SimpleType: IMAGE_SYM_TYPE_NULL108 ComplexType: IMAGE_SYM_DTYPE_FUNCTION109 StorageClass: IMAGE_SYM_CLASS_EXTERNAL110 - Name: main111 Value: 0112 SectionNumber: 3113 SimpleType: IMAGE_SYM_TYPE_NULL114 ComplexType: IMAGE_SYM_DTYPE_FUNCTION115 StorageClass: IMAGE_SYM_CLASS_EXTERNAL116 - Name: __wc_mb_cur117 Value: 0118 SectionNumber: 0119 SimpleType: IMAGE_SYM_TYPE_NULL120 ComplexType: IMAGE_SYM_DTYPE_NULL121 StorageClass: IMAGE_SYM_CLASS_EXTERNAL122...123