1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t | FileCheck %s
2
3// This is a long test that checks that the aliases created by weakref are
4// never in the symbol table and that the only case it causes a symbol to
5// be output as a weak undefined symbol is if that variable is not defined
6// in this file and all the references to it are done via the alias.
7
8        .weakref foo1, bar1
9
10        .weakref foo2, bar2
11        .long bar2
12
13        .weakref foo3, bar3
14        .long foo3
15
16        .weakref foo4, bar4
17        .long foo4
18        .long bar4
19
20        .weakref foo5, bar5
21        .long bar5
22        .long foo5
23
24bar6:
25        .weakref foo6, bar6
26
27bar7:
28        .weakref foo7, bar7
29        .long bar7
30
31bar8:
32        .weakref foo8, bar8
33        .long foo8
34
35bar9:
36        .weakref foo9, bar9
37        .long foo9
38        .long bar9
39
40bar10:
41        .global bar10
42        .weakref foo10, bar10
43        .long bar10
44        .long foo10
45
46bar11:
47        .global bar11
48        .weakref foo11, bar11
49
50bar12:
51        .global bar12
52        .weakref foo12, bar12
53        .long bar12
54
55bar13:
56        .global bar13
57        .weakref foo13, bar13
58        .long foo13
59
60bar14:
61        .global bar14
62        .weakref foo14, bar14
63        .long foo14
64        .long bar14
65
66bar15:
67        .global bar15
68        .weakref foo15, bar15
69        .long bar15
70        .long foo15
71
72// CHECK:      Symbols [
73// CHECK-NEXT:   Symbol {
74// CHECK-NEXT:     Name:  (0)
75// CHECK-NEXT:     Value: 0x0
76// CHECK-NEXT:     Size: 0
77// CHECK-NEXT:     Binding: Local (0x0)
78// CHECK-NEXT:     Type: None (0x0)
79// CHECK-NEXT:     Other: 0
80// CHECK-NEXT:     Section: Undefined (0x0)
81// CHECK-NEXT:   }
82// CHECK-NEXT:   Symbol {
83// CHECK-NEXT:     Name: bar6
84// CHECK-NEXT:     Value: 0x18
85// CHECK-NEXT:     Size: 0
86// CHECK-NEXT:     Binding: Local
87// CHECK-NEXT:     Type: None
88// CHECK-NEXT:     Other: 0
89// CHECK-NEXT:     Section: .text
90// CHECK-NEXT:   }
91// CHECK-NEXT:   Symbol {
92// CHECK-NEXT:     Name: bar7
93// CHECK-NEXT:     Value: 0x18
94// CHECK-NEXT:     Size: 0
95// CHECK-NEXT:     Binding: Local
96// CHECK-NEXT:     Type: None
97// CHECK-NEXT:     Other: 0
98// CHECK-NEXT:     Section: .text
99// CHECK-NEXT:   }
100// CHECK-NEXT:   Symbol {
101// CHECK-NEXT:     Name: bar8
102// CHECK-NEXT:     Value: 0x1C
103// CHECK-NEXT:     Size: 0
104// CHECK-NEXT:     Binding: Local
105// CHECK-NEXT:     Type: None
106// CHECK-NEXT:     Other: 0
107// CHECK-NEXT:     Section: .text
108// CHECK-NEXT:   }
109// CHECK-NEXT:   Symbol {
110// CHECK-NEXT:     Name: bar9
111// CHECK-NEXT:     Value: 0x20
112// CHECK-NEXT:     Size: 0
113// CHECK-NEXT:     Binding: Local
114// CHECK-NEXT:     Type: None
115// CHECK-NEXT:     Other: 0
116// CHECK-NEXT:     Section: .text
117// CHECK-NEXT:   }
118// CHECK-NEXT:   Symbol {
119// CHECK-NEXT:     Name: (0)
120// CHECK-NEXT:     Value: 0x0
121// CHECK-NEXT:     Size: 0
122// CHECK-NEXT:     Binding: Local
123// CHECK-NEXT:     Type: Section
124// CHECK-NEXT:     Other: 0
125// CHECK-NEXT:     Section: .text
126// CHECK-NEXT:   }
127// CHECK-NEXT:   Symbol {
128// CHECK-NEXT:     Name: bar10
129// CHECK-NEXT:     Value: 0x28
130// CHECK-NEXT:     Size: 0
131// CHECK-NEXT:     Binding: Global
132// CHECK-NEXT:     Type: None
133// CHECK-NEXT:     Other: 0
134// CHECK-NEXT:     Section: .text
135// CHECK-NEXT:   }
136// CHECK-NEXT:   Symbol {
137// CHECK-NEXT:     Name: bar11
138// CHECK-NEXT:     Value: 0x30
139// CHECK-NEXT:     Size: 0
140// CHECK-NEXT:     Binding: Global
141// CHECK-NEXT:     Type: None
142// CHECK-NEXT:     Other: 0
143// CHECK-NEXT:     Section: .text
144// CHECK-NEXT:   }
145// CHECK-NEXT:   Symbol {
146// CHECK-NEXT:     Name: bar12
147// CHECK-NEXT:     Value: 0x30
148// CHECK-NEXT:     Size: 0
149// CHECK-NEXT:     Binding: Global
150// CHECK-NEXT:     Type: None
151// CHECK-NEXT:     Other: 0
152// CHECK-NEXT:     Section: .text
153// CHECK-NEXT:   }
154// CHECK-NEXT:   Symbol {
155// CHECK-NEXT:     Name: bar13
156// CHECK-NEXT:     Value: 0x34
157// CHECK-NEXT:     Size: 0
158// CHECK-NEXT:     Binding: Global
159// CHECK-NEXT:     Type: None
160// CHECK-NEXT:     Other: 0
161// CHECK-NEXT:     Section: .text
162// CHECK-NEXT:   }
163// CHECK-NEXT:   Symbol {
164// CHECK-NEXT:     Name: bar14
165// CHECK-NEXT:     Value: 0x38
166// CHECK-NEXT:     Size: 0
167// CHECK-NEXT:     Binding: Global
168// CHECK-NEXT:     Type: None
169// CHECK-NEXT:     Other: 0
170// CHECK-NEXT:     Section: .text
171// CHECK-NEXT:   }
172// CHECK-NEXT:   Symbol {
173// CHECK-NEXT:     Name: bar15
174// CHECK-NEXT:     Value: 0x40
175// CHECK-NEXT:     Size: 0
176// CHECK-NEXT:     Binding: Global
177// CHECK-NEXT:     Type: None
178// CHECK-NEXT:     Other: 0
179// CHECK-NEXT:     Section: .text
180// CHECK-NEXT:   }
181// CHECK-NEXT:   Symbol {
182// CHECK-NEXT:     Name: bar2
183// CHECK-NEXT:     Value: 0x0
184// CHECK-NEXT:     Size: 0
185// CHECK-NEXT:     Binding: Global
186// CHECK-NEXT:     Type: None
187// CHECK-NEXT:     Other: 0
188// CHECK-NEXT:     Section: Undefined (0x0)
189// CHECK-NEXT:   }
190// CHECK-NEXT:   Symbol {
191// CHECK-NEXT:     Name: bar3
192// CHECK-NEXT:     Value: 0x0
193// CHECK-NEXT:     Size: 0
194// CHECK-NEXT:     Binding: Weak
195// CHECK-NEXT:     Type: None
196// CHECK-NEXT:     Other: 0
197// CHECK-NEXT:     Section: Undefined (0x0)
198// CHECK-NEXT:   }
199// CHECK-NEXT:   Symbol {
200// CHECK-NEXT:     Name: bar4
201// CHECK-NEXT:     Value: 0x0
202// CHECK-NEXT:     Size: 0
203// CHECK-NEXT:     Binding: Global
204// CHECK-NEXT:     Type: None
205// CHECK-NEXT:     Other: 0
206// CHECK-NEXT:     Section: Undefined (0x0)
207// CHECK-NEXT:   }
208// CHECK-NEXT:   Symbol {
209// CHECK-NEXT:     Name: bar5
210// CHECK-NEXT:     Value: 0x0
211// CHECK-NEXT:     Size: 0
212// CHECK-NEXT:     Binding: Global
213// CHECK-NEXT:     Type: None
214// CHECK-NEXT:     Other: 0
215// CHECK-NEXT:     Section: Undefined (0x0)
216// CHECK-NEXT:   }
217// CHECK-NEXT: ]
218