1# RUN: yaml2obj %s -o %t.obj
2# RUN: lld-link -safeseh:no -debug -entry:main -out:%t.exe -pdb:%t.pdb %t.obj
3# RUN: llvm-pdbutil dump -globals %t.pdb | FileCheck %s
4
5# There is an S_GDATA32 symbol record with .secrel32 and .secidx relocations in
6# it in this debug info. This is similar to the relocations in the loadcfg.obj
7# file in the MSVC CRT. We need to make sure that our relocation logic matches
8# MSVC's for these absolute, linker-provided symbols.
9
10# CHECK:                             Global Symbols
11# CHECK-NEXT: ============================================================
12# CHECK-NEXT:   Records
13# CHECK-NEXT:       20 | S_GDATA32 [size = 40] `___safe_se_handler_table`
14# CHECK-NEXT:            type = 0x0022 (unsigned long), addr = 0003:0000
15
16--- !COFF
17header:
18  Machine:         IMAGE_FILE_MACHINE_I386
19  Characteristics: [  ]
20sections:
21  - Name:            '.debug$S'
22    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
23    Alignment:       1
24    Subsections:
25      - !Symbols
26        Records:
27          - Kind:            S_GDATA32
28            DataSym:
29              Type:            34
30              DisplayName:     ___safe_se_handler_table
31      - !StringTable
32        Strings:
33    Relocations:
34      - VirtualAddress:  20
35        SymbolName:      ___safe_se_handler_table
36        Type:            IMAGE_REL_I386_SECREL
37      - VirtualAddress:  24
38        SymbolName:      ___safe_se_handler_table
39        Type:            IMAGE_REL_I386_SECTION
40  - Name:            '.text$mn'
41    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
42    Alignment:       16
43    SectionData:     488D0500000000C3
44    Relocations:
45      - VirtualAddress:  3
46        SymbolName:      ___safe_se_handler_table
47        Type:            IMAGE_REL_I386_REL32
48symbols:
49  - Name:            '.debug$S'
50    Value:           0
51    SectionNumber:   1
52    SimpleType:      IMAGE_SYM_TYPE_NULL
53    ComplexType:     IMAGE_SYM_DTYPE_NULL
54    StorageClass:    IMAGE_SYM_CLASS_STATIC
55    SectionDefinition:
56      Length:          372
57      NumberOfRelocations: 6
58      NumberOfLinenumbers: 0
59      CheckSum:        0
60      Number:          0
61  - Name:            '.text$mn'
62    Value:           0
63    SectionNumber:   2
64    SimpleType:      IMAGE_SYM_TYPE_NULL
65    ComplexType:     IMAGE_SYM_DTYPE_NULL
66    StorageClass:    IMAGE_SYM_CLASS_STATIC
67    SectionDefinition:
68      Length:          8
69      NumberOfRelocations: 1
70      NumberOfLinenumbers: 0
71      CheckSum:        1092178131
72      Number:          0
73  - Name:            _main
74    Value:           0
75    SectionNumber:   2
76    SimpleType:      IMAGE_SYM_TYPE_NULL
77    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
78    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
79  - Name:            ___safe_se_handler_table
80    Value:           0
81    SectionNumber:   0
82    SimpleType:      IMAGE_SYM_TYPE_NULL
83    ComplexType:     IMAGE_SYM_DTYPE_NULL
84    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
85...
86
87