1 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
2 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix CHECK
4 ; RUN: llc -filetype=obj -mtriple powerpc-ibm-aix-xcoff -verify-machineinstrs < %s -o %t32.o
5 ; RUN: llvm-readobj %t32.o --syms --relocs | FileCheck %s --check-prefix=OBJ32
6 ; RUN: llvm-objdump %t32.o -dr | FileCheck %s --check-prefix=DIS32
8 ; RUN: llc -filetype=obj -mtriple powerpc64-ibm-aix-xcoff -verify-machineinstrs < %s -o %t64.o
9 ; RUN: llvm-readobj %t64.o --syms --relocs | FileCheck %s --check-prefix=OBJ64
10 ; RUN: llvm-objdump %t64.o -dr | FileCheck %s --check-prefix=DIS64
12 @i1 = external constant i32 #0
13 @i2 = constant ptr @i1 #0
16 %1 = load i32, ptr @i1, align 4
20 define ptr @retptr() {
24 attributes #0 = { "toc-data" }
27 ; CHECK: la 3, i1[TD](2)
30 ; CHECK: la 3, i2[TD](2)
33 ; CHECK: .extern i1[TD]
34 ; CHECK: .csect i2[TD]
36 ; OBJ32: Relocations [
37 ; OBJ32-NEXT: Section (index: 1) .text {
38 ; OBJ32-NEXT: 0x2 R_TOC i1(1) 0xF
39 ; OBJ32-NEXT: 0x26 R_TOC i2(15) 0xF
41 ; OBJ32-NEXT: Section (index: 2) .data {
42 ; OBJ32-NEXT: 0x44 R_POS .read(5) 0x1F
43 ; OBJ32-NEXT: 0x48 R_POS TOC(13) 0x1F
44 ; OBJ32-NEXT: 0x50 R_POS .retptr(7) 0x1F
45 ; OBJ32-NEXT: 0x54 R_POS TOC(13) 0x1F
46 ; OBJ32-NEXT: 0x5C R_POS i1(1) 0x1F
52 ; OBJ32-NEXT: Name: i1
53 ; OBJ32-NEXT: Value (RelocatableAddress): 0x0
54 ; OBJ32-NEXT: Section: N_UNDEF
55 ; OBJ32-NEXT: Type: 0x0
56 ; OBJ32-NEXT: StorageClass: C_EXT (0x2)
57 ; OBJ32-NEXT: NumberOfAuxEntries: 1
58 ; OBJ32-NEXT: CSECT Auxiliary Entry {
59 ; OBJ32-NEXT: Index: 2
60 ; OBJ32-NEXT: SectionLen: 0
61 ; OBJ32-NEXT: ParameterHashIndex: 0x0
62 ; OBJ32-NEXT: TypeChkSectNum: 0x0
63 ; OBJ32-NEXT: SymbolAlignmentLog2: 0
64 ; OBJ32-NEXT: SymbolType: XTY_ER (0x0)
65 ; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
66 ; OBJ32-NEXT: StabInfoIndex: 0x0
67 ; OBJ32-NEXT: StabSectNum: 0x0
72 ; OBJ32-NEXT: Name: TOC
73 ; OBJ32-NEXT: Value (RelocatableAddress): 0x5C
74 ; OBJ32-NEXT: Section: .data
75 ; OBJ32-NEXT: Type: 0x0
76 ; OBJ32-NEXT: StorageClass: C_HIDEXT (0x6B)
77 ; OBJ32-NEXT: NumberOfAuxEntries: 1
78 ; OBJ32-NEXT: CSECT Auxiliary Entry {
79 ; OBJ32-NEXT: Index: 14
80 ; OBJ32-NEXT: SectionLen: 0
81 ; OBJ32-NEXT: ParameterHashIndex: 0x0
82 ; OBJ32-NEXT: TypeChkSectNum: 0x0
83 ; OBJ32-NEXT: SymbolAlignmentLog2: 2
84 ; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
85 ; OBJ32-NEXT: StorageMappingClass: XMC_TC0 (0xF)
86 ; OBJ32-NEXT: StabInfoIndex: 0x0
87 ; OBJ32-NEXT: StabSectNum: 0x0
92 ; OBJ32-NEXT: Name: i2
93 ; OBJ32-NEXT: Value (RelocatableAddress): 0x5C
94 ; OBJ32-NEXT: Section: .data
95 ; OBJ32-NEXT: Type: 0x0
96 ; OBJ32-NEXT: StorageClass: C_EXT (0x2)
97 ; OBJ32-NEXT: NumberOfAuxEntries: 1
98 ; OBJ32-NEXT: CSECT Auxiliary Entry {
99 ; OBJ32-NEXT: Index: 16
100 ; OBJ32-NEXT: SectionLen: 4
101 ; OBJ32-NEXT: ParameterHashIndex: 0x0
102 ; OBJ32-NEXT: TypeChkSectNum: 0x0
103 ; OBJ32-NEXT: SymbolAlignmentLog2: 2
104 ; OBJ32-NEXT: SymbolType: XTY_SD (0x1)
105 ; OBJ32-NEXT: StorageMappingClass: XMC_TD (0x10)
106 ; OBJ32-NEXT: StabInfoIndex: 0x0
107 ; OBJ32-NEXT: StabSectNum: 0x0
111 ; OBJ64: Relocations [
112 ; OBJ64-NEXT: Section (index: 1) .text {
113 ; OBJ64-NEXT: 0x2 R_TOC i1(1) 0xF
114 ; OBJ64-NEXT: 0x26 R_TOC i2(15) 0xF
116 ; OBJ64-NEXT: Section (index: 2) .data {
117 ; OBJ64-NEXT: 0x48 R_POS .read(5) 0x3F
118 ; OBJ64-NEXT: 0x50 R_POS TOC(13) 0x3F
119 ; OBJ64-NEXT: 0x60 R_POS .retptr(7) 0x3F
120 ; OBJ64-NEXT: 0x68 R_POS TOC(13) 0x3F
121 ; OBJ64-NEXT: 0x78 R_POS i1(1) 0x3F
127 ; OBJ64-NEXT: Name: i1
128 ; OBJ64-NEXT: Value (RelocatableAddress): 0x0
129 ; OBJ64-NEXT: Section: N_UNDEF
130 ; OBJ64-NEXT: Type: 0x0
131 ; OBJ64-NEXT: StorageClass: C_EXT (0x2)
132 ; OBJ64-NEXT: NumberOfAuxEntries: 1
133 ; OBJ64-NEXT: CSECT Auxiliary Entry {
134 ; OBJ64-NEXT: Index: 2
135 ; OBJ64-NEXT: SectionLen: 0
136 ; OBJ64-NEXT: ParameterHashIndex: 0x0
137 ; OBJ64-NEXT: TypeChkSectNum: 0x0
138 ; OBJ64-NEXT: SymbolAlignmentLog2: 0
139 ; OBJ64-NEXT: SymbolType: XTY_ER (0x0)
140 ; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
141 ; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
146 ; OBJ64-NEXT: Name: TOC
147 ; OBJ64-NEXT: Value (RelocatableAddress): 0x78
148 ; OBJ64-NEXT: Section: .data
149 ; OBJ64-NEXT: Type: 0x0
150 ; OBJ64-NEXT: StorageClass: C_HIDEXT (0x6B)
151 ; OBJ64-NEXT: NumberOfAuxEntries: 1
152 ; OBJ64-NEXT: CSECT Auxiliary Entry {
153 ; OBJ64-NEXT: Index: 14
154 ; OBJ64-NEXT: SectionLen: 0
155 ; OBJ64-NEXT: ParameterHashIndex: 0x0
156 ; OBJ64-NEXT: TypeChkSectNum: 0x0
157 ; OBJ64-NEXT: SymbolAlignmentLog2: 2
158 ; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
159 ; OBJ64-NEXT: StorageMappingClass: XMC_TC0 (0xF)
160 ; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
165 ; OBJ64-NEXT: Name: i2
166 ; OBJ64-NEXT: Value (RelocatableAddress): 0x78
167 ; OBJ64-NEXT: Section: .data
168 ; OBJ64-NEXT: Type: 0x0
169 ; OBJ64-NEXT: StorageClass: C_EXT (0x2)
170 ; OBJ64-NEXT: NumberOfAuxEntries: 1
171 ; OBJ64-NEXT: CSECT Auxiliary Entry {
172 ; OBJ64-NEXT: Index: 16
173 ; OBJ64-NEXT: SectionLen: 8
174 ; OBJ64-NEXT: ParameterHashIndex: 0x0
175 ; OBJ64-NEXT: TypeChkSectNum: 0x0
176 ; OBJ64-NEXT: SymbolAlignmentLog2: 3
177 ; OBJ64-NEXT: SymbolType: XTY_SD (0x1)
178 ; OBJ64-NEXT: StorageMappingClass: XMC_TD (0x10)
179 ; OBJ64-NEXT: Auxiliary Type: AUX_CSECT (0xFB)
183 ; DIS32: 00000000 <.read>:
184 ; DIS32-NEXT: 0: 38 62 00 00 addi 3, 2, 0
185 ; DIS32-NEXT: 00000002: R_TOC i1
186 ; DIS32: 00000024 <.retptr>:
187 ; DIS32-NEXT: 24: 38 62 00 00 addi 3, 2, 0
188 ; DIS32-NEXT: 00000026: R_TOC i2
190 ; DIS64: 0000000000000000 <.read>:
191 ; DIS64-NEXT: 0: 38 62 00 00 addi 3, 2, 0
192 ; DIS64-NEXT: 0000000000000002: R_TOC i1
193 ; DIS64: 0000000000000024 <.retptr>:
194 ; DIS64-NEXT: 24: 38 62 00 00 addi 3, 2, 0
195 ; DIS64-NEXT: 0000000000000026: R_TOC i2