1 ; This file tests TOC entry generation and undefined symbol generation.
3 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
4 ; RUN: -xcoff-traceback-table=false < %s | FileCheck --check-prefixes CHECK,CHECK32 %s
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \
6 ; RUN: -xcoff-traceback-table=false < %s 2>&1 | FileCheck --check-prefixes CHECK,CHECK64 %s
8 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc-ibm-aix-xcoff \
9 ; RUN: --xcoff-traceback-table=false -filetype=obj -o %t.o < %s
10 ; RUN: llvm-readobj --syms %t.o | FileCheck --check-prefixes=SYM,SYM32 %s
12 ; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff \
13 ; RUN: --xcoff-traceback-table=false -filetype=obj -o %t64.o < %s
14 ; RUN: llvm-readobj --syms %t64.o | FileCheck --check-prefixes=SYM,SYM64 %s
16 @a = external global i32, align 4
17 @b = external global i64, align 8
18 @c = external global i16, align 2
19 @globa = common global i32 0, align 4
21 @ptr = internal global ptr null, align 4
26 %1 = alloca ptr, align 8
27 %2 = alloca ptr, align 8
28 store i32 0, ptr @a, align 4
29 store i64 0, ptr @b, align 8
30 store i16 0, ptr @c, align 2
31 store i32 0, ptr @globa, align 4
32 store ptr @bar, ptr @ptr, align 4
33 store ptr @foo, ptr %1, align 8
34 store ptr @foobar, ptr %2, align 8
38 ; We initialize a csect when we first reference an external global, so make sure we don't run into problems when we see it again.
40 store i32 0, ptr @a, align 4
41 store i64 0, ptr @b, align 8
42 store i16 0, ptr @c, align 2
46 define void @foobar() {
50 ; Test tc entry assembly generation.
58 ; CHECK: .comm globa[RW],4,2
59 ; CHECK32: .lcomm ptr,4,ptr[BS],2
60 ; CHECK64: .lcomm ptr,8,ptr[BS],2
63 ; CHECK-NEXT: .tc a[TC],a[UA]
65 ; CHECK-NEXT: .tc b[TC],b[UA]
67 ; CHECK-NEXT: .tc c[TC],c[UA]
69 ; CHECK-NEXT: .tc globa[TC],globa[RW]
71 ; CHECK-NEXT: .tc ptr[TC],ptr[BS]
73 ; CHECK-NEXT: .tc bar[TC],bar[DS]
75 ; CHECK-NEXT: .tc foo[TC],foo[DS]
77 ; CHECK-NEXT: .tc foobar[TC],foobar[DS]
80 ; Test undefined symbol generation.
82 ; SYM: Symbol {{[{][[:space:]] *}}Index: [[#UNDEF_INDX:]]{{[[:space:]] *}}Name: a
83 ; SYM-NEXT: Value (RelocatableAddress): 0x0
84 ; SYM-NEXT: Section: N_UNDEF
86 ; SYM-NEXT: StorageClass: C_EXT (0x2)
87 ; SYM-NEXT: NumberOfAuxEntries: 1
88 ; SYM-NEXT: CSECT Auxiliary Entry {
89 ; SYM-NEXT: Index: [[#UNDEF_INDX+1]]
90 ; SYM-NEXT: SectionLen: 0
91 ; SYM-NEXT: ParameterHashIndex: 0x0
92 ; SYM-NEXT: TypeChkSectNum: 0x0
93 ; SYM-NEXT: SymbolAlignmentLog2: 0
94 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
95 ; SYM-NEXT: StorageMappingClass: XMC_UA (0x4)
96 ; SYM32-NEXT: StabInfoIndex: 0x0
97 ; SYM32-NEXT: StabSectNum: 0x0
98 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
102 ; SYM-NEXT: Index: [[#UNDEF_INDX+2]]
104 ; SYM-NEXT: Value (RelocatableAddress): 0x0
105 ; SYM-NEXT: Section: N_UNDEF
106 ; SYM-NEXT: Type: 0x0
107 ; SYM-NEXT: StorageClass: C_EXT (0x2)
108 ; SYM-NEXT: NumberOfAuxEntries: 1
109 ; SYM-NEXT: CSECT Auxiliary Entry {
110 ; SYM-NEXT: Index: [[#UNDEF_INDX+3]]
111 ; SYM-NEXT: SectionLen: 0
112 ; SYM-NEXT: ParameterHashIndex: 0x0
113 ; SYM-NEXT: TypeChkSectNum: 0x0
114 ; SYM-NEXT: SymbolAlignmentLog2: 0
115 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
116 ; SYM-NEXT: StorageMappingClass: XMC_UA (0x4)
117 ; SYM32-NEXT: StabInfoIndex: 0x0
118 ; SYM32-NEXT: StabSectNum: 0x0
119 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
123 ; SYM-NEXT: Index: [[#UNDEF_INDX+4]]
125 ; SYM-NEXT: Value (RelocatableAddress): 0x0
126 ; SYM-NEXT: Section: N_UNDEF
127 ; SYM-NEXT: Type: 0x0
128 ; SYM-NEXT: StorageClass: C_EXT (0x2)
129 ; SYM-NEXT: NumberOfAuxEntries: 1
130 ; SYM-NEXT: CSECT Auxiliary Entry {
131 ; SYM-NEXT: Index: [[#UNDEF_INDX+5]]
132 ; SYM-NEXT: SectionLen: 0
133 ; SYM-NEXT: ParameterHashIndex: 0x0
134 ; SYM-NEXT: TypeChkSectNum: 0x0
135 ; SYM-NEXT: SymbolAlignmentLog2: 0
136 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
137 ; SYM-NEXT: StorageMappingClass: XMC_UA (0x4)
138 ; SYM32-NEXT: StabInfoIndex: 0x0
139 ; SYM32-NEXT: StabSectNum: 0x0
140 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
144 ; SYM-NEXT: Index: [[#UNDEF_INDX+6]]
145 ; SYM-NEXT: Name: .foo
146 ; SYM-NEXT: Value (RelocatableAddress): 0x0
147 ; SYM-NEXT: Section: N_UNDEF
148 ; SYM-NEXT: Type: 0x0
149 ; SYM-NEXT: StorageClass: C_EXT (0x2)
150 ; SYM-NEXT: NumberOfAuxEntries: 1
151 ; SYM-NEXT: CSECT Auxiliary Entry {
152 ; SYM-NEXT: Index: [[#UNDEF_INDX+7]]
153 ; SYM-NEXT: SectionLen: 0
154 ; SYM-NEXT: ParameterHashIndex: 0x0
155 ; SYM-NEXT: TypeChkSectNum: 0x0
156 ; SYM-NEXT: SymbolAlignmentLog2: 0
157 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
158 ; SYM-NEXT: StorageMappingClass: XMC_PR (0x0)
159 ; SYM32-NEXT: StabInfoIndex: 0x0
160 ; SYM32-NEXT: StabSectNum: 0x0
161 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
165 ; SYM-NEXT: Index: [[#UNDEF_INDX+8]]
166 ; SYM-NEXT: Name: foo
167 ; SYM-NEXT: Value (RelocatableAddress): 0x0
168 ; SYM-NEXT: Section: N_UNDEF
169 ; SYM-NEXT: Type: 0x0
170 ; SYM-NEXT: StorageClass: C_EXT (0x2)
171 ; SYM-NEXT: NumberOfAuxEntries: 1
172 ; SYM-NEXT: CSECT Auxiliary Entry {
173 ; SYM-NEXT: Index: [[#UNDEF_INDX+9]]
174 ; SYM-NEXT: SectionLen: 0
175 ; SYM-NEXT: ParameterHashIndex: 0x0
176 ; SYM-NEXT: TypeChkSectNum: 0x0
177 ; SYM-NEXT: SymbolAlignmentLog2: 0
178 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
179 ; SYM-NEXT: StorageMappingClass: XMC_DS (0xA)
180 ; SYM32-NEXT: StabInfoIndex: 0x0
181 ; SYM32-NEXT: StabSectNum: 0x0
182 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
186 ; Test TOC entry symbol generation.
188 ; SYM: Symbol {{[{][[:space:]] *}}Index: [[#TOC_INDX:]]{{[[:space:]] *}}Name: TOC
189 ; SYM32-NEXT: Value (RelocatableAddress): 0xA8
190 ; SYM64-NEXT: Value (RelocatableAddress): 0xC0
191 ; SYM-NEXT: Section: .data
192 ; SYM-NEXT: Type: 0x0
193 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
194 ; SYM-NEXT: NumberOfAuxEntries: 1
195 ; SYM-NEXT: CSECT Auxiliary Entry {
196 ; SYM-NEXT: Index: [[#TOC_INDX+1]]
197 ; SYM-NEXT: SectionLen: 0
198 ; SYM-NEXT: ParameterHashIndex: 0x0
199 ; SYM-NEXT: TypeChkSectNum: 0x0
200 ; SYM-NEXT: SymbolAlignmentLog2: 2
201 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
202 ; SYM-NEXT: StorageMappingClass: XMC_TC0 (0xF)
203 ; SYM32-NEXT: StabInfoIndex: 0x0
204 ; SYM32-NEXT: StabSectNum: 0x0
205 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
209 ; SYM-NEXT: Index: [[#TOC_INDX+2]]
211 ; SYM32-NEXT: Value (RelocatableAddress): 0xA8
212 ; SYM64-NEXT: Value (RelocatableAddress): 0xC0
213 ; SYM-NEXT: Section: .data
214 ; SYM-NEXT: Type: 0x0
215 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
216 ; SYM-NEXT: NumberOfAuxEntries: 1
217 ; SYM-NEXT: CSECT Auxiliary Entry {
218 ; SYM-NEXT: Index: [[#TOC_INDX+3]]
219 ; SYM32-NEXT: SectionLen: 4
220 ; SYM64-NEXT: SectionLen: 8
221 ; SYM-NEXT: ParameterHashIndex: 0x0
222 ; SYM-NEXT: TypeChkSectNum: 0x0
223 ; SYM32-NEXT: SymbolAlignmentLog2: 2
224 ; SYM64-NEXT: SymbolAlignmentLog2: 3
225 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
226 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
227 ; SYM32-NEXT: StabInfoIndex: 0x0
228 ; SYM32-NEXT: StabSectNum: 0x0
229 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
233 ; SYM-NEXT: Index: [[#TOC_INDX+4]]
235 ; SYM32-NEXT: Value (RelocatableAddress): 0xAC
236 ; SYM64-NEXT: Value (RelocatableAddress): 0xC8
237 ; SYM-NEXT: Section: .data
238 ; SYM-NEXT: Type: 0x0
239 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
240 ; SYM-NEXT: NumberOfAuxEntries: 1
241 ; SYM-NEXT: CSECT Auxiliary Entry {
242 ; SYM-NEXT: Index: [[#TOC_INDX+5]]
243 ; SYM32-NEXT: SectionLen: 4
244 ; SYM64-NEXT: SectionLen: 8
245 ; SYM-NEXT: ParameterHashIndex: 0x0
246 ; SYM-NEXT: TypeChkSectNum: 0x0
247 ; SYM32-NEXT: SymbolAlignmentLog2: 2
248 ; SYM64-NEXT: SymbolAlignmentLog2: 3
249 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
250 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
251 ; SYM32-NEXT: StabInfoIndex: 0x0
252 ; SYM32-NEXT: StabSectNum: 0x0
253 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
257 ; SYM-NEXT: Index: [[#TOC_INDX+6]]
259 ; SYM32-NEXT: Value (RelocatableAddress): 0xB0
260 ; SYM64-NEXT: Value (RelocatableAddress): 0xD0
261 ; SYM-NEXT: Section: .data
262 ; SYM-NEXT: Type: 0x0
263 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
264 ; SYM-NEXT: NumberOfAuxEntries: 1
265 ; SYM-NEXT: CSECT Auxiliary Entry {
266 ; SYM-NEXT: Index: [[#TOC_INDX+7]]
267 ; SYM32-NEXT: SectionLen: 4
268 ; SYM64-NEXT: SectionLen: 8
269 ; SYM-NEXT: ParameterHashIndex: 0x0
270 ; SYM-NEXT: TypeChkSectNum: 0x0
271 ; SYM32-NEXT: SymbolAlignmentLog2: 2
272 ; SYM64-NEXT: SymbolAlignmentLog2: 3
273 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
274 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
275 ; SYM32-NEXT: StabInfoIndex: 0x0
276 ; SYM32-NEXT: StabSectNum: 0x0
277 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
281 ; SYM-NEXT: Index: [[#TOC_INDX+8]]
282 ; SYM-NEXT: Name: globa
283 ; SYM32-NEXT: Value (RelocatableAddress): 0xB4
284 ; SYM64-NEXT: Value (RelocatableAddress): 0xD8
285 ; SYM-NEXT: Section: .data
286 ; SYM-NEXT: Type: 0x0
287 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
288 ; SYM-NEXT: NumberOfAuxEntries: 1
289 ; SYM-NEXT: CSECT Auxiliary Entry {
290 ; SYM-NEXT: Index: [[#TOC_INDX+9]]
291 ; SYM32-NEXT: SectionLen: 4
292 ; SYM64-NEXT: SectionLen: 8
293 ; SYM-NEXT: ParameterHashIndex: 0x0
294 ; SYM-NEXT: TypeChkSectNum: 0x0
295 ; SYM32-NEXT: SymbolAlignmentLog2: 2
296 ; SYM64-NEXT: SymbolAlignmentLog2: 3
297 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
298 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
299 ; SYM32-NEXT: StabInfoIndex: 0x0
300 ; SYM32-NEXT: StabSectNum: 0x0
301 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
305 ; SYM-NEXT: Index: [[#TOC_INDX+10]]
306 ; SYM-NEXT: Name: ptr
307 ; SYM32-NEXT: Value (RelocatableAddress): 0xB8
308 ; SYM64-NEXT: Value (RelocatableAddress): 0xE0
309 ; SYM-NEXT: Section: .data
310 ; SYM-NEXT: Type: 0x0
311 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
312 ; SYM-NEXT: NumberOfAuxEntries: 1
313 ; SYM-NEXT: CSECT Auxiliary Entry {
314 ; SYM-NEXT: Index: [[#TOC_INDX+11]]
315 ; SYM32-NEXT: SectionLen: 4
316 ; SYM64-NEXT: SectionLen: 8
317 ; SYM-NEXT: ParameterHashIndex: 0x0
318 ; SYM-NEXT: TypeChkSectNum: 0x0
319 ; SYM32-NEXT: SymbolAlignmentLog2: 2
320 ; SYM64-NEXT: SymbolAlignmentLog2: 3
321 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
322 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
323 ; SYM32-NEXT: StabInfoIndex: 0x0
324 ; SYM32-NEXT: StabSectNum: 0x0
325 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
329 ; SYM-NEXT: Index: [[#TOC_INDX+12]]
330 ; SYM-NEXT: Name: bar
331 ; SYM32-NEXT: Value (RelocatableAddress): 0xBC
332 ; SYM64-NEXT: Value (RelocatableAddress): 0xE8
333 ; SYM-NEXT: Section: .data
334 ; SYM-NEXT: Type: 0x0
335 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
336 ; SYM-NEXT: NumberOfAuxEntries: 1
337 ; SYM-NEXT: CSECT Auxiliary Entry {
338 ; SYM-NEXT: Index: [[#TOC_INDX+13]]
339 ; SYM32-NEXT: SectionLen: 4
340 ; SYM64-NEXT: SectionLen: 8
341 ; SYM-NEXT: ParameterHashIndex: 0x0
342 ; SYM-NEXT: TypeChkSectNum: 0x0
343 ; SYM32-NEXT: SymbolAlignmentLog2: 2
344 ; SYM64-NEXT: SymbolAlignmentLog2: 3
345 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
346 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
347 ; SYM32-NEXT: StabInfoIndex: 0x0
348 ; SYM32-NEXT: StabSectNum: 0x0
349 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
353 ; SYM-NEXT: Index: [[#TOC_INDX+14]]
354 ; SYM-NEXT: Name: foo
355 ; SYM32-NEXT: Value (RelocatableAddress): 0xC0
356 ; SYM64-NEXT: Value (RelocatableAddress): 0xF0
357 ; SYM-NEXT: Section: .data
358 ; SYM-NEXT: Type: 0x0
359 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
360 ; SYM-NEXT: NumberOfAuxEntries: 1
361 ; SYM-NEXT: CSECT Auxiliary Entry {
362 ; SYM-NEXT: Index: [[#TOC_INDX+15]]
363 ; SYM32-NEXT: SectionLen: 4
364 ; SYM64-NEXT: SectionLen: 8
365 ; SYM-NEXT: ParameterHashIndex: 0x0
366 ; SYM-NEXT: TypeChkSectNum: 0x0
367 ; SYM32-NEXT: SymbolAlignmentLog2: 2
368 ; SYM64-NEXT: SymbolAlignmentLog2: 3
369 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
370 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
371 ; SYM32-NEXT: StabInfoIndex: 0x0
372 ; SYM32-NEXT: StabSectNum: 0x0
373 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
377 ; SYM-NEXT: Index: [[#TOC_INDX+16]]
378 ; SYM-NEXT: Name: foobar
379 ; SYM32-NEXT: Value (RelocatableAddress): 0xC4
380 ; SYM64-NEXT: Value (RelocatableAddress): 0xF8
381 ; SYM-NEXT: Section: .data
382 ; SYM-NEXT: Type: 0x0
383 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
384 ; SYM-NEXT: NumberOfAuxEntries: 1
385 ; SYM-NEXT: CSECT Auxiliary Entry {
386 ; SYM-NEXT: Index: [[#TOC_INDX+17]]
387 ; SYM32-NEXT: SectionLen: 4
388 ; SYM64-NEXT: SectionLen: 8
389 ; SYM-NEXT: ParameterHashIndex: 0x0
390 ; SYM-NEXT: TypeChkSectNum: 0x0
391 ; SYM32-NEXT: SymbolAlignmentLog2: 2
392 ; SYM64-NEXT: SymbolAlignmentLog2: 3
393 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
394 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
395 ; SYM32-NEXT: StabInfoIndex: 0x0
396 ; SYM32-NEXT: StabSectNum: 0x0
397 ; SYM64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)