[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / COFF / symtab.test
blob6ef2b4d47503c7f0ecc09417e886fa8acf0e628c
1 # RUN: yaml2obj %s -o %t.obj
2 # RUN: lld-link /debug:dwarf /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
3 # RUN: llvm-readobj --symbols %t.exe | FileCheck %s
4 # RUN: lld-link /debug:dwarf /opt:noref /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
5 # RUN: llvm-readobj --symbols %t.exe | FileCheck %s
6 # RUN: lld-link /debug:symtab /opt:noref /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
7 # RUN: llvm-readobj --symbols %t.exe | FileCheck %s
8 # RUN: lld-link /debug:full,symtab /opt:noref /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
9 # RUN: llvm-readobj --symbols %t.exe | FileCheck %s
11 # RUN: lld-link /debug /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
12 # RUN: llvm-readobj --symbols %t.exe | FileCheck -check-prefix=NO %s
13 # RUN: lld-link /debug:dwarf,nosymtab /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
14 # RUN: llvm-readobj --symbols %t.exe | FileCheck -check-prefix=NO %s
16 # CHECK:      Symbols [
17 # CHECK-NEXT:   Symbol {
18 # CHECK-NEXT:     Name: MessageBoxA
19 # CHECK-NEXT:     Value: 80
20 # CHECK-NEXT:     Section: .text (1)
21 # CHECK-NEXT:     BaseType: Null (0x0)
22 # CHECK-NEXT:     ComplexType: Function (0x2)
23 # CHECK-NEXT:     StorageClass: External (0x2)
24 # CHECK-NEXT:     AuxSymbolCount: 0
25 # CHECK-NEXT:   }
26 # CHECK-NEXT:   Symbol {
27 # CHECK-NEXT:     Name: __imp_MessageBoxA
28 # CHECK-NEXT:     Value:
29 # CHECK-NEXT:     Section: .rdata (2)
30 # CHECK-NEXT:     BaseType: Null (0x0)
31 # CHECK-NEXT:     ComplexType: Null (0x0)
32 # CHECK-NEXT:     StorageClass: External (0x2)
33 # CHECK-NEXT:     AuxSymbolCount: 0
34 # CHECK-NEXT:   }
35 # CHECK-NEXT:   Symbol {
36 # CHECK-NEXT:     Name: ExitProcess
37 # CHECK-NEXT:     Value: 64
38 # CHECK-NEXT:     Section: .text (1)
39 # CHECK-NEXT:     BaseType: Null (0x0)
40 # CHECK-NEXT:     ComplexType: Function (0x2)
41 # CHECK-NEXT:     StorageClass: External (0x2)
42 # CHECK-NEXT:     AuxSymbolCount: 0
43 # CHECK-NEXT:   }
44 # CHECK-NEXT:   Symbol {
45 # CHECK-NEXT:     Name: __imp_ExitProcess
46 # CHECK-NEXT:     Value:
47 # CHECK-NEXT:     Section: .rdata (2)
48 # CHECK-NEXT:     BaseType: Null (0x0)
49 # CHECK-NEXT:     ComplexType: Null (0x0)
50 # CHECK-NEXT:     StorageClass: External (0x2)
51 # CHECK-NEXT:     AuxSymbolCount: 0
52 # CHECK-NEXT:   }
53 # CHECK-NEXT:   Symbol {
54 # CHECK-NEXT:     Name: message
55 # CHECK-NEXT:     Value: 6
56 # CHECK-NEXT:     Section: .text2
57 # CHECK-NEXT:     BaseType: Null (0x0)
58 # CHECK-NEXT:     ComplexType: Null (0x0)
59 # CHECK-NEXT:     StorageClass: Static (0x3)
60 # CHECK-NEXT:     AuxSymbolCount: 0
61 # CHECK-NEXT:   }
62 # CHECK-NEXT:   Symbol {
63 # CHECK-NEXT:     Name: main
64 # CHECK-NEXT:     Value: 0
65 # CHECK-NEXT:     Section: .text (1)
66 # CHECK-NEXT:     BaseType: Null (0x0)
67 # CHECK-NEXT:     ComplexType: Null (0x0)
68 # CHECK-NEXT:     StorageClass: External (0x2)
69 # CHECK-NEXT:     AuxSymbolCount: 0
70 # CHECK-NEXT:   }
71 # CHECK-NEXT:   Symbol {
72 # CHECK-NEXT:     Name: caption
73 # CHECK-NEXT:     Value: 0
74 # CHECK-NEXT:     Section: .text2
75 # CHECK-NEXT:     BaseType: Null (0x0)
76 # CHECK-NEXT:     ComplexType: Null (0x0)
77 # CHECK-NEXT:     StorageClass: Static (0x3)
78 # CHECK-NEXT:     AuxSymbolCount: 0
79 # CHECK-NEXT:   }
80 # CHECK-NEXT:   Symbol {
81 # CHECK-NEXT:     Name: abs_symbol
82 # CHECK-NEXT:     Value: 3735928559
83 # CHECK-NEXT:     Section: IMAGE_SYM_ABSOLUTE (-1)
84 # CHECK-NEXT:     BaseType: Null (0x0)
85 # CHECK-NEXT:     ComplexType: Null (0x0)
86 # CHECK-NEXT:     StorageClass: External (0x2)
87 # CHECK-NEXT:     AuxSymbolCount: 0
88 # CHECK-NEXT:   }
89 # CHECK-NEXT:   Symbol {
90 # CHECK-NEXT:     Name: weak_main
91 # CHECK-NEXT:     Value: 0
92 # CHECK-NEXT:     Section: .text (1)
93 # CHECK-NEXT:     BaseType: Null (0x0)
94 # CHECK-NEXT:     ComplexType: Null (0x0)
95 # CHECK-NEXT:     StorageClass: External (0x2)
96 # CHECK-NEXT:     AuxSymbolCount: 0
97 # CHECK-NEXT:   }
98 # CHECK-NEXT: ]
100 # NO:       Symbols [
101 # NO-NEXT:  ]
103 --- !COFF
104 header:
105   Machine:         IMAGE_FILE_MACHINE_AMD64
106   Characteristics: []
107 sections:
108   - Name:            .text
109     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
110     Alignment:       4096
111     SectionData:     B800000000000000005068000000000000000068000000000000000050E8000000000000000050E8000000000000000050E80000000000000000
112     Relocations:
113       - VirtualAddress:  0
114         SymbolName:      abs_symbol
115         Type:            IMAGE_REL_AMD64_ADDR64
116       - VirtualAddress:  7
117         SymbolName:      caption
118         Type:            IMAGE_REL_AMD64_ADDR64
119       - VirtualAddress:  12
120         SymbolName:      message
121         Type:            IMAGE_REL_AMD64_ADDR64
122       - VirtualAddress:  18
123         SymbolName:      MessageBoxA
124         Type:            IMAGE_REL_AMD64_REL32
125       - VirtualAddress:  24
126         SymbolName:      ExitProcess
127         Type:            IMAGE_REL_AMD64_REL32
128       - VirtualAddress:  30
129         SymbolName:      __ImageBase
130         Type:            IMAGE_REL_AMD64_ADDR64
131   - Name:            .text2
132     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
133     Alignment:       4096
134     SectionData:     B800000000000000005068000000000000000068000000000000000050E8000000000000000050E8000000000000000050E80000000000000000
135     Relocations:
136       - VirtualAddress:  0
137         SymbolName:      abs_symbol
138         Type:            IMAGE_REL_AMD64_ADDR64
139       - VirtualAddress:  7
140         SymbolName:      caption
141         Type:            IMAGE_REL_AMD64_ADDR64
142       - VirtualAddress:  12
143         SymbolName:      message
144         Type:            IMAGE_REL_AMD64_ADDR64
145       - VirtualAddress:  18
146         SymbolName:      MessageBoxA
147         Type:            IMAGE_REL_AMD64_REL32
148       - VirtualAddress:  24
149         SymbolName:      ExitProcess
150         Type:            IMAGE_REL_AMD64_REL32
151       - VirtualAddress:  30
152         SymbolName:      __ImageBase
153         Type:            IMAGE_REL_AMD64_ADDR64
154   - Name:            .data
155     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
156     Alignment:       4
157     SectionData:     48656C6C6F0048656C6C6F20576F726C6400
158 symbols:
159   - Name:            "@comp.id"
160     Value:           10394907
161     SectionNumber:   65535
162     SimpleType:      IMAGE_SYM_TYPE_NULL
163     ComplexType:     IMAGE_SYM_DTYPE_NULL
164     StorageClass:    IMAGE_SYM_CLASS_STATIC
165   - Name:            .text
166     Value:           0
167     SectionNumber:   1
168     SimpleType:      IMAGE_SYM_TYPE_NULL
169     ComplexType:     IMAGE_SYM_DTYPE_NULL
170     StorageClass:    IMAGE_SYM_CLASS_STATIC
171     SectionDefinition:
172       Length:          28
173       NumberOfRelocations: 6
174       NumberOfLinenumbers: 0
175       CheckSum:        0
176       Number:          0
177   - Name:            .text2
178     Value:           0
179     SectionNumber:   1
180     SimpleType:      IMAGE_SYM_TYPE_NULL
181     ComplexType:     IMAGE_SYM_DTYPE_NULL
182     StorageClass:    IMAGE_SYM_CLASS_STATIC
183     SectionDefinition:
184       Length:          28
185       NumberOfRelocations: 6
186       NumberOfLinenumbers: 0
187       CheckSum:        0
188       Number:          0
189   - Name:            .data
190     Value:           0
191     SectionNumber:   3
192     SimpleType:      IMAGE_SYM_TYPE_NULL
193     ComplexType:     IMAGE_SYM_DTYPE_NULL
194     StorageClass:    IMAGE_SYM_CLASS_STATIC
195     SectionDefinition:
196       Length:          18
197       NumberOfRelocations: 0
198       NumberOfLinenumbers: 0
199       CheckSum:        0
200       Number:          0
201   - Name:            MessageBoxA
202     Value:           0
203     SectionNumber:   0
204     SimpleType:      IMAGE_SYM_TYPE_NULL
205     ComplexType:     IMAGE_SYM_DTYPE_NULL
206     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
207   - Name:            ExitProcess
208     Value:           0
209     SectionNumber:   0
210     SimpleType:      IMAGE_SYM_TYPE_NULL
211     ComplexType:     IMAGE_SYM_DTYPE_NULL
212     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
213   - Name:            message
214     Value:           6
215     SectionNumber:   2
216     SimpleType:      IMAGE_SYM_TYPE_NULL
217     ComplexType:     IMAGE_SYM_DTYPE_NULL
218     StorageClass:    IMAGE_SYM_CLASS_STATIC
219   - Name:            main
220     Value:           0
221     SectionNumber:   1
222     SimpleType:      IMAGE_SYM_TYPE_NULL
223     ComplexType:     IMAGE_SYM_DTYPE_NULL
224     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
225   - Name:            caption
226     Value:           0
227     SectionNumber:   2
228     SimpleType:      IMAGE_SYM_TYPE_NULL
229     ComplexType:     IMAGE_SYM_DTYPE_NULL
230     StorageClass:    IMAGE_SYM_CLASS_STATIC
231   - Name:            abs_symbol
232     Value:           0xDEADBEEF
233     SectionNumber:   -1
234     SimpleType:      IMAGE_SYM_TYPE_NULL
235     ComplexType:     IMAGE_SYM_DTYPE_NULL
236     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
237   - Name:            __ImageBase
238     Value:           0
239     SectionNumber:   0
240     SimpleType:      IMAGE_SYM_TYPE_NULL
241     ComplexType:     IMAGE_SYM_DTYPE_NULL
242     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
243   - Name:            .Ltemp_symbol
244     Value:           1
245     SectionNumber:   1
246     SimpleType:      IMAGE_SYM_TYPE_NULL
247     ComplexType:     IMAGE_SYM_DTYPE_NULL
248     StorageClass:    IMAGE_SYM_CLASS_LABEL
249   - Name:            weak_main
250     Value:           0
251     SectionNumber:   0
252     SimpleType:      IMAGE_SYM_TYPE_NULL
253     ComplexType:     IMAGE_SYM_DTYPE_NULL
254     StorageClass:    IMAGE_SYM_CLASS_WEAK_EXTERNAL
255     WeakExternal:
256       TagIndex:        10
257       Characteristics: IMAGE_WEAK_EXTERN_SEARCH_ALIAS