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-prefix=SYM %s
12 ; RUN: not --crash llc -verify-machineinstrs -mcpu=pwr4 -mattr=-altivec -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o 2>&1 \
13 ; RUN: < %s | FileCheck --check-prefix=XCOFF64 %s
14 ; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
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 void (...)* null, align 4
26 %1 = alloca i8*, align 8
27 %2 = alloca i8*, align 8
28 store i32 0, i32* @a, align 4
29 store i64 0, i64* @b, align 8
30 store i16 0, i16* @c, align 2
31 store i32 0, i32* @globa, align 4
32 store void (...)* bitcast (void ()* @bar to void (...)*), void (...)** @ptr, align 4
33 store i8* bitcast (void ()* @foo to i8*), i8** %1, align 8
34 store i8* bitcast (void ()* @foobar to i8*), i8** %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, i32* @a, align 4
41 store i64 0, i64* @b, align 8
42 store i16 0, i16* @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: File: {{.*}}aix-xcoff-toc.ll.tmp.o
83 ; SYM: Symbol {{[{][[:space:]] *}}Index: [[#UNDEF_INDX:]]{{[[:space:]] *}}Name: a
84 ; SYM-NEXT: Value (RelocatableAddress): 0x0
85 ; SYM-NEXT: Section: N_UNDEF
87 ; SYM-NEXT: StorageClass: C_EXT (0x2)
88 ; SYM-NEXT: NumberOfAuxEntries: 1
89 ; SYM-NEXT: CSECT Auxiliary Entry {
90 ; SYM-NEXT: Index: [[#UNDEF_INDX+1]]
91 ; SYM-NEXT: SectionLen: 0
92 ; SYM-NEXT: ParameterHashIndex: 0x0
93 ; SYM-NEXT: TypeChkSectNum: 0x0
94 ; SYM-NEXT: SymbolAlignmentLog2: 0
95 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
96 ; SYM-NEXT: StorageMappingClass: XMC_UA (0x4)
97 ; SYM-NEXT: StabInfoIndex: 0x0
98 ; SYM-NEXT: StabSectNum: 0x0
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 ; SYM-NEXT: StabInfoIndex: 0x0
118 ; SYM-NEXT: StabSectNum: 0x0
122 ; SYM-NEXT: Index: [[#UNDEF_INDX+4]]
124 ; SYM-NEXT: Value (RelocatableAddress): 0x0
125 ; SYM-NEXT: Section: N_UNDEF
126 ; SYM-NEXT: Type: 0x0
127 ; SYM-NEXT: StorageClass: C_EXT (0x2)
128 ; SYM-NEXT: NumberOfAuxEntries: 1
129 ; SYM-NEXT: CSECT Auxiliary Entry {
130 ; SYM-NEXT: Index: [[#UNDEF_INDX+5]]
131 ; SYM-NEXT: SectionLen: 0
132 ; SYM-NEXT: ParameterHashIndex: 0x0
133 ; SYM-NEXT: TypeChkSectNum: 0x0
134 ; SYM-NEXT: SymbolAlignmentLog2: 0
135 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
136 ; SYM-NEXT: StorageMappingClass: XMC_UA (0x4)
137 ; SYM-NEXT: StabInfoIndex: 0x0
138 ; SYM-NEXT: StabSectNum: 0x0
142 ; SYM-NEXT: Index: [[#UNDEF_INDX+6]]
143 ; SYM-NEXT: Name: .foo
144 ; SYM-NEXT: Value (RelocatableAddress): 0x0
145 ; SYM-NEXT: Section: N_UNDEF
146 ; SYM-NEXT: Type: 0x0
147 ; SYM-NEXT: StorageClass: C_EXT (0x2)
148 ; SYM-NEXT: NumberOfAuxEntries: 1
149 ; SYM-NEXT: CSECT Auxiliary Entry {
150 ; SYM-NEXT: Index: [[#UNDEF_INDX+7]]
151 ; SYM-NEXT: SectionLen: 0
152 ; SYM-NEXT: ParameterHashIndex: 0x0
153 ; SYM-NEXT: TypeChkSectNum: 0x0
154 ; SYM-NEXT: SymbolAlignmentLog2: 0
155 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
156 ; SYM-NEXT: StorageMappingClass: XMC_PR (0x0)
157 ; SYM-NEXT: StabInfoIndex: 0x0
158 ; SYM-NEXT: StabSectNum: 0x0
162 ; SYM-NEXT: Index: [[#UNDEF_INDX+8]]
163 ; SYM-NEXT: Name: foo
164 ; SYM-NEXT: Value (RelocatableAddress): 0x0
165 ; SYM-NEXT: Section: N_UNDEF
166 ; SYM-NEXT: Type: 0x0
167 ; SYM-NEXT: StorageClass: C_EXT (0x2)
168 ; SYM-NEXT: NumberOfAuxEntries: 1
169 ; SYM-NEXT: CSECT Auxiliary Entry {
170 ; SYM-NEXT: Index: [[#UNDEF_INDX+9]]
171 ; SYM-NEXT: SectionLen: 0
172 ; SYM-NEXT: ParameterHashIndex: 0x0
173 ; SYM-NEXT: TypeChkSectNum: 0x0
174 ; SYM-NEXT: SymbolAlignmentLog2: 0
175 ; SYM-NEXT: SymbolType: XTY_ER (0x0)
176 ; SYM-NEXT: StorageMappingClass: XMC_DS (0xA)
177 ; SYM-NEXT: StabInfoIndex: 0x0
178 ; SYM-NEXT: StabSectNum: 0x0
182 ; Test TOC entry symbol generation.
184 ; SYM: Symbol {{[{][[:space:]] *}}Index: [[#TOC_INDX:]]{{[[:space:]] *}}Name: TOC
185 ; SYM-NEXT: Value (RelocatableAddress): 0xA8
186 ; SYM-NEXT: Section: .data
187 ; SYM-NEXT: Type: 0x0
188 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
189 ; SYM-NEXT: NumberOfAuxEntries: 1
190 ; SYM-NEXT: CSECT Auxiliary Entry {
191 ; SYM-NEXT: Index: [[#TOC_INDX+1]]
192 ; SYM-NEXT: SectionLen: 0
193 ; SYM-NEXT: ParameterHashIndex: 0x0
194 ; SYM-NEXT: TypeChkSectNum: 0x0
195 ; SYM-NEXT: SymbolAlignmentLog2: 2
196 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
197 ; SYM-NEXT: StorageMappingClass: XMC_TC0 (0xF)
198 ; SYM-NEXT: StabInfoIndex: 0x0
199 ; SYM-NEXT: StabSectNum: 0x0
203 ; SYM-NEXT: Index: [[#TOC_INDX+2]]
205 ; SYM-NEXT: Value (RelocatableAddress): 0xA8
206 ; SYM-NEXT: Section: .data
207 ; SYM-NEXT: Type: 0x0
208 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
209 ; SYM-NEXT: NumberOfAuxEntries: 1
210 ; SYM-NEXT: CSECT Auxiliary Entry {
211 ; SYM-NEXT: Index: [[#TOC_INDX+3]]
212 ; SYM-NEXT: SectionLen: 4
213 ; SYM-NEXT: ParameterHashIndex: 0x0
214 ; SYM-NEXT: TypeChkSectNum: 0x0
215 ; SYM-NEXT: SymbolAlignmentLog2: 2
216 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
217 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
218 ; SYM-NEXT: StabInfoIndex: 0x0
219 ; SYM-NEXT: StabSectNum: 0x0
223 ; SYM-NEXT: Index: [[#TOC_INDX+4]]
225 ; SYM-NEXT: Value (RelocatableAddress): 0xAC
226 ; SYM-NEXT: Section: .data
227 ; SYM-NEXT: Type: 0x0
228 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
229 ; SYM-NEXT: NumberOfAuxEntries: 1
230 ; SYM-NEXT: CSECT Auxiliary Entry {
231 ; SYM-NEXT: Index: [[#TOC_INDX+5]]
232 ; SYM-NEXT: SectionLen: 4
233 ; SYM-NEXT: ParameterHashIndex: 0x0
234 ; SYM-NEXT: TypeChkSectNum: 0x0
235 ; SYM-NEXT: SymbolAlignmentLog2: 2
236 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
237 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
238 ; SYM-NEXT: StabInfoIndex: 0x0
239 ; SYM-NEXT: StabSectNum: 0x0
243 ; SYM-NEXT: Index: [[#TOC_INDX+6]]
245 ; SYM-NEXT: Value (RelocatableAddress): 0xB0
246 ; SYM-NEXT: Section: .data
247 ; SYM-NEXT: Type: 0x0
248 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
249 ; SYM-NEXT: NumberOfAuxEntries: 1
250 ; SYM-NEXT: CSECT Auxiliary Entry {
251 ; SYM-NEXT: Index: [[#TOC_INDX+7]]
252 ; SYM-NEXT: SectionLen: 4
253 ; SYM-NEXT: ParameterHashIndex: 0x0
254 ; SYM-NEXT: TypeChkSectNum: 0x0
255 ; SYM-NEXT: SymbolAlignmentLog2: 2
256 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
257 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
258 ; SYM-NEXT: StabInfoIndex: 0x0
259 ; SYM-NEXT: StabSectNum: 0x0
263 ; SYM-NEXT: Index: [[#TOC_INDX+8]]
264 ; SYM-NEXT: Name: globa
265 ; SYM-NEXT: Value (RelocatableAddress): 0xB4
266 ; SYM-NEXT: Section: .data
267 ; SYM-NEXT: Type: 0x0
268 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
269 ; SYM-NEXT: NumberOfAuxEntries: 1
270 ; SYM-NEXT: CSECT Auxiliary Entry {
271 ; SYM-NEXT: Index: [[#TOC_INDX+9]]
272 ; SYM-NEXT: SectionLen: 4
273 ; SYM-NEXT: ParameterHashIndex: 0x0
274 ; SYM-NEXT: TypeChkSectNum: 0x0
275 ; SYM-NEXT: SymbolAlignmentLog2: 2
276 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
277 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
278 ; SYM-NEXT: StabInfoIndex: 0x0
279 ; SYM-NEXT: StabSectNum: 0x0
283 ; SYM-NEXT: Index: [[#TOC_INDX+10]]
284 ; SYM-NEXT: Name: ptr
285 ; SYM-NEXT: Value (RelocatableAddress): 0xB8
286 ; SYM-NEXT: Section: .data
287 ; SYM-NEXT: Type: 0x0
288 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
289 ; SYM-NEXT: NumberOfAuxEntries: 1
290 ; SYM-NEXT: CSECT Auxiliary Entry {
291 ; SYM-NEXT: Index: [[#TOC_INDX+11]]
292 ; SYM-NEXT: SectionLen: 4
293 ; SYM-NEXT: ParameterHashIndex: 0x0
294 ; SYM-NEXT: TypeChkSectNum: 0x0
295 ; SYM-NEXT: SymbolAlignmentLog2: 2
296 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
297 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
298 ; SYM-NEXT: StabInfoIndex: 0x0
299 ; SYM-NEXT: StabSectNum: 0x0
303 ; SYM-NEXT: Index: [[#TOC_INDX+12]]
304 ; SYM-NEXT: Name: bar
305 ; SYM-NEXT: Value (RelocatableAddress): 0xBC
306 ; SYM-NEXT: Section: .data
307 ; SYM-NEXT: Type: 0x0
308 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
309 ; SYM-NEXT: NumberOfAuxEntries: 1
310 ; SYM-NEXT: CSECT Auxiliary Entry {
311 ; SYM-NEXT: Index: [[#TOC_INDX+13]]
312 ; SYM-NEXT: SectionLen: 4
313 ; SYM-NEXT: ParameterHashIndex: 0x0
314 ; SYM-NEXT: TypeChkSectNum: 0x0
315 ; SYM-NEXT: SymbolAlignmentLog2: 2
316 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
317 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
318 ; SYM-NEXT: StabInfoIndex: 0x0
319 ; SYM-NEXT: StabSectNum: 0x0
323 ; SYM-NEXT: Index: [[#TOC_INDX+14]]
324 ; SYM-NEXT: Name: foo
325 ; SYM-NEXT: Value (RelocatableAddress): 0xC0
326 ; SYM-NEXT: Section: .data
327 ; SYM-NEXT: Type: 0x0
328 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
329 ; SYM-NEXT: NumberOfAuxEntries: 1
330 ; SYM-NEXT: CSECT Auxiliary Entry {
331 ; SYM-NEXT: Index: [[#TOC_INDX+15]]
332 ; SYM-NEXT: SectionLen: 4
333 ; SYM-NEXT: ParameterHashIndex: 0x0
334 ; SYM-NEXT: TypeChkSectNum: 0x0
335 ; SYM-NEXT: SymbolAlignmentLog2: 2
336 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
337 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
338 ; SYM-NEXT: StabInfoIndex: 0x0
339 ; SYM-NEXT: StabSectNum: 0x0
343 ; SYM-NEXT: Index: [[#TOC_INDX+16]]
344 ; SYM-NEXT: Name: foobar
345 ; SYM-NEXT: Value (RelocatableAddress): 0xC4
346 ; SYM-NEXT: Section: .data
347 ; SYM-NEXT: Type: 0x0
348 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
349 ; SYM-NEXT: NumberOfAuxEntries: 1
350 ; SYM-NEXT: CSECT Auxiliary Entry {
351 ; SYM-NEXT: Index: [[#TOC_INDX+17]]
352 ; SYM-NEXT: SectionLen: 4
353 ; SYM-NEXT: ParameterHashIndex: 0x0
354 ; SYM-NEXT: TypeChkSectNum: 0x0
355 ; SYM-NEXT: SymbolAlignmentLog2: 2
356 ; SYM-NEXT: SymbolType: XTY_SD (0x1)
357 ; SYM-NEXT: StorageMappingClass: XMC_TC (0x3)
358 ; SYM-NEXT: StabInfoIndex: 0x0
359 ; SYM-NEXT: StabSectNum: 0x0