1 # RUN: llvm-mc -triple mips-unknown-linux < %s -show-encoding -target-abi=o32 \
2 # RUN: | FileCheck -check-prefix=ASM %s
3 # RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n32 \
4 # RUN: | FileCheck -check-prefix=ASM %s
5 # RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n64 \
6 # RUN: | FileCheck -check-prefix=ASM %s
7 # RUN: llvm-mc -triple mips-unknown-linux < %s -show-encoding -target-abi=o32 \
8 # RUN: -filetype=obj | llvm-readobj --sections --section-data -r - | \
9 # RUN: FileCheck -check-prefix=OBJ-O32 %s
10 # RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n32 \
11 # RUN: -filetype=obj | llvm-readobj --sections --section-data -r - | \
12 # RUN: FileCheck -check-prefix=OBJ-N32 %s
13 # RUN: llvm-mc -triple mips64-unknown-linux < %s -show-encoding -target-abi=n64 \
14 # RUN: -filetype=obj | llvm-readobj --sections --section-data -r - | \
15 # RUN: FileCheck -check-prefix=OBJ-N64 %s
18 .reloc 4, R_MIPS_NONE, foo # ASM: .reloc 4, R_MIPS_NONE, foo
19 .reloc 0, R_MIPS_NONE, foo+4 # ASM: .reloc 0, R_MIPS_NONE, foo+4
20 .reloc 8, R_MIPS_32, foo+8 # ASM: .reloc 8, R_MIPS_32, foo+8
24 .reloc 12, R_MIPS_NONE # ASM: .reloc 12, R_MIPS_NONE{{$}}
26 .reloc 16, R_MIPS_CALL_HI16, 4 # ASM: .reloc 16, R_MIPS_CALL_HI16, 4
28 .reloc 20, R_MIPS_CALL_LO16, 4 # ASM: .reloc 20, R_MIPS_CALL_LO16, 4
30 .reloc 24, R_MIPS_CALL16, 4 # ASM: .reloc 24, R_MIPS_CALL16, 4
32 .reloc 28, R_MIPS_GOT16, 4 # ASM: .reloc 28, R_MIPS_GOT16, 4
34 .reloc 32, R_MIPS_GOT_PAGE, 4 # ASM: .reloc 32, R_MIPS_GOT_PAGE, 4
36 .reloc 36, R_MIPS_GOT_OFST, 4 # ASM: .reloc 36, R_MIPS_GOT_OFST, 4
38 .reloc 40, R_MIPS_GOT_DISP, 4 # ASM: .reloc 40, R_MIPS_GOT_DISP, 4
40 .reloc 44, R_MIPS_GOT_HI16, 4 # ASM: .reloc 44, R_MIPS_GOT_HI16, 4
42 .reloc 48, R_MIPS_GOT_LO16, 4 # ASM: .reloc 48, R_MIPS_GOT_LO16, 4
44 .reloc 52, R_MIPS_TLS_GOTTPREL, 4 # ASM: .reloc 52, R_MIPS_TLS_GOTTPREL, 4
46 .reloc 56, R_MIPS_TLS_DTPREL_HI16, 4 # ASM: .reloc 56, R_MIPS_TLS_DTPREL_HI16, 4
48 .reloc 60, R_MIPS_TLS_DTPREL_LO16, 4 # ASM: .reloc 60, R_MIPS_TLS_DTPREL_LO16, 4
50 .reloc 64, R_MIPS_TLS_GD, 4 # ASM: .reloc 64, R_MIPS_TLS_GD, 4
52 .reloc 68, R_MIPS_TLS_LDM, 4 # ASM: .reloc 68, R_MIPS_TLS_LDM, 4
54 .reloc 72, R_MIPS_TLS_TPREL_HI16, 4 # ASM: .reloc 72, R_MIPS_TLS_TPREL_HI16, 4
56 .reloc 76, R_MIPS_TLS_TPREL_LO16, 4 # ASM: .reloc 76, R_MIPS_TLS_TPREL_LO16, 4
58 .reloc 80, R_MICROMIPS_CALL16, 4 # ASM: .reloc 80, R_MICROMIPS_CALL16, 4
60 .reloc 84, R_MICROMIPS_GOT_DISP, 4 # ASM: .reloc 84, R_MICROMIPS_GOT_DISP, 4
62 .reloc 88, R_MICROMIPS_GOT_PAGE, 4 # ASM: .reloc 88, R_MICROMIPS_GOT_PAGE, 4
64 .reloc 92, R_MICROMIPS_GOT_OFST, 4 # ASM: .reloc 92, R_MICROMIPS_GOT_OFST, 4
66 .reloc 96, R_MICROMIPS_GOT16, 4 # ASM: .reloc 96, R_MICROMIPS_GOT16, 4
68 .reloc 100, R_MICROMIPS_TLS_GOTTPREL, 4 # ASM: .reloc 100, R_MICROMIPS_TLS_GOTTPREL, 4
70 .reloc 104, R_MICROMIPS_TLS_DTPREL_HI16, 4 # ASM: .reloc 104, R_MICROMIPS_TLS_DTPREL_HI16, 4
72 .reloc 108, R_MICROMIPS_TLS_DTPREL_LO16, 4 # ASM: .reloc 108, R_MICROMIPS_TLS_DTPREL_LO16, 4
74 .reloc 112, R_MICROMIPS_TLS_GD, 4 # ASM: .reloc 112, R_MICROMIPS_TLS_GD, 4
76 .reloc 116, R_MICROMIPS_TLS_LDM, 4 # ASM: .reloc 116, R_MICROMIPS_TLS_LDM, 4
78 .reloc 120, R_MICROMIPS_TLS_TPREL_HI16, 4 # ASM: .reloc 120, R_MICROMIPS_TLS_TPREL_HI16, 4
80 .reloc 124, R_MICROMIPS_TLS_TPREL_LO16, 4 # ASM: .reloc 124, R_MICROMIPS_TLS_TPREL_LO16, 4
82 .reloc 128, R_MIPS_JALR, 4 # ASM: .reloc 128, R_MIPS_JALR, 4
84 .reloc 132, R_MICROMIPS_JALR, 4 # ASM: .reloc 132, R_MICROMIPS_JALR, 4
86 .reloc 136, BFD_RELOC_NONE, 9 # ASM: .reloc 136, BFD_RELOC_NONE, 9
87 .reloc 137, BFD_RELOC_16, 9 # ASM: .reloc 137, BFD_RELOC_16, 9
88 .reloc 138, BFD_RELOC_32, 9 # ASM: .reloc 138, BFD_RELOC_32, 9
89 .reloc 139, BFD_RELOC_64, 9 # ASM: .reloc 139, BFD_RELOC_64, 9
92 # OBJ-O32-LABEL: Name: .text
93 # OBJ-O32: 0000: 00000000 00000000 00000008 00000000
94 # OBJ-O32-NEXT: 0010: 00000000 00000004 00000000 00000000
95 # OBJ-O32-NEXT: 0020: 00000004 00000004 00000004 00000000
96 # OBJ-O32-NEXT: 0030: 00000004 00000000 00000000 00000000
97 # OBJ-O32-NEXT: 0040: 00000000 00000000 00000000 00000000
98 # OBJ-O32-NEXT: 0050: 00000000 00000004 00000004 00000004
99 # OBJ-O32-NEXT: 0060: 00000000 00000000 00000000 00000000
100 # OBJ-O32-NEXT: 0070: 00000000 00000000 00000000 00000000
101 # OBJ-O32-NEXT: 0080: 00000000 00000000
103 # OBJ-O32-LABEL: Relocations [
104 # OBJ-O32: 0x0 R_MIPS_NONE .text
105 # OBJ-O32-NEXT: 0x4 R_MIPS_NONE .text
106 # OBJ-O32-NEXT: 0x8 R_MIPS_32 .text
107 # OBJ-O32-NEXT: 0xC R_MIPS_NONE -
108 # OBJ-O32-NEXT: 0x10 R_MIPS_CALL_HI16 -
109 # OBJ-O32-NEXT: 0x14 R_MIPS_CALL_LO16 -
110 # OBJ-O32-NEXT: 0x18 R_MIPS_CALL16 -
111 # OBJ-O32-NEXT: 0x20 R_MIPS_GOT_PAGE -
112 # OBJ-O32-NEXT: 0x24 R_MIPS_GOT_OFST -
113 # OBJ-O32-NEXT: 0x28 R_MIPS_GOT_DISP -
114 # OBJ-O32-NEXT: 0x2C R_MIPS_GOT_HI16 -
115 # OBJ-O32-NEXT: 0x30 R_MIPS_GOT_LO16 -
116 # OBJ-O32-NEXT: 0x34 R_MIPS_TLS_GOTTPREL -
117 # OBJ-O32-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16 -
118 # OBJ-O32-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16 -
119 # OBJ-O32-NEXT: 0x40 R_MIPS_TLS_GD -
120 # OBJ-O32-NEXT: 0x44 R_MIPS_TLS_LDM -
121 # OBJ-O32-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16 -
122 # OBJ-O32-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16 -
123 # OBJ-O32-NEXT: 0x50 R_MICROMIPS_CALL16 -
124 # OBJ-O32-NEXT: 0x54 R_MICROMIPS_GOT_DISP -
125 # OBJ-O32-NEXT: 0x58 R_MICROMIPS_GOT_PAGE -
126 # OBJ-O32-NEXT: 0x5C R_MICROMIPS_GOT_OFST -
127 # OBJ-O32-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL -
128 # OBJ-O32-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16 -
129 # OBJ-O32-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16 -
130 # OBJ-O32-NEXT: 0x70 R_MICROMIPS_TLS_GD -
131 # OBJ-O32-NEXT: 0x74 R_MICROMIPS_TLS_LDM -
132 # OBJ-O32-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16 -
133 # OBJ-O32-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16 -
134 # OBJ-O32-NEXT: 0x80 R_MIPS_JALR -
135 # OBJ-O32-NEXT: 0x84 R_MICROMIPS_JALR -
136 # OBJ-O32-NEXT: 0x88 R_MIPS_NONE -
137 # OBJ-O32-NEXT: 0x89 R_MIPS_16 -
138 # OBJ-O32-NEXT: 0x8A R_MIPS_32 -
139 # OBJ-O32-NEXT: 0x8B R_MIPS_64 -
140 # OBJ-O32-NEXT: 0x1C R_MIPS_GOT16 -
141 # OBJ-O32-NEXT: 0x60 R_MICROMIPS_GOT16 -
143 # OBJ-N32-LABEL: Name: .text
144 # OBJ-N32: 0000: 00000000 00000000 00000000 00000000
145 # OBJ-N32-NEXT: 0010: 00000000 00000000 00000000 00000000
146 # OBJ-N32-NEXT: 0020: 00000000 00000000 00000000 00000000
147 # OBJ-N32-NEXT: 0030: 00000000 00000000 00000000 00000000
148 # OBJ-N32-NEXT: 0040: 00000000 00000000 00000000 00000000
149 # OBJ-N32-NEXT: 0050: 00000000 00000000 00000000 00000000
150 # OBJ-N32-NEXT: 0060: 00000000 00000000 00000000 00000000
151 # OBJ-N32-NEXT: 0070: 00000000 00000000 00000000 00000000
152 # OBJ-N32-NEXT: 0080: 00000000 00000000
154 # OBJ-N32-LABEL: Relocations [
156 # OBJ-N32: 0x4 R_MIPS_NONE .text 0x0
157 # OBJ-N32-NEXT: 0x0 R_MIPS_NONE .text 0x4
158 # OBJ-N32-NEXT: 0x8 R_MIPS_32 .text 0x8
159 # OBJ-N32-NEXT: 0xC R_MIPS_NONE - 0x0
160 # OBJ-N32-NEXT: 0x10 R_MIPS_CALL_HI16 - 0x4
161 # OBJ-N32-NEXT: 0x14 R_MIPS_CALL_LO16 - 0x4
162 # OBJ-N32-NEXT: 0x18 R_MIPS_CALL16 - 0x4
163 # OBJ-N32-NEXT: 0x1C R_MIPS_GOT16 - 0x4
164 # OBJ-N32-NEXT: 0x20 R_MIPS_GOT_PAGE - 0x4
165 # OBJ-N32-NEXT: 0x24 R_MIPS_GOT_OFST - 0x4
166 # OBJ-N32-NEXT: 0x28 R_MIPS_GOT_DISP - 0x4
167 # OBJ-N32-NEXT: 0x2C R_MIPS_GOT_HI16 - 0x4
168 # OBJ-N32-NEXT: 0x30 R_MIPS_GOT_LO16 - 0x4
169 # OBJ-N32-NEXT: 0x34 R_MIPS_TLS_GOTTPREL - 0x4
170 # OBJ-N32-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16 - 0x4
171 # OBJ-N32-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16 - 0x4
172 # OBJ-N32-NEXT: 0x40 R_MIPS_TLS_GD - 0x4
173 # OBJ-N32-NEXT: 0x44 R_MIPS_TLS_LDM - 0x4
174 # OBJ-N32-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16 - 0x4
175 # OBJ-N32-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16 - 0x4
176 # OBJ-N32-NEXT: 0x50 R_MICROMIPS_CALL16 - 0x4
177 # OBJ-N32-NEXT: 0x54 R_MICROMIPS_GOT_DISP - 0x4
178 # OBJ-N32-NEXT: 0x58 R_MICROMIPS_GOT_PAGE - 0x4
179 # OBJ-N32-NEXT: 0x5C R_MICROMIPS_GOT_OFST - 0x4
180 # OBJ-N32-NEXT: 0x60 R_MICROMIPS_GOT16 - 0x4
181 # OBJ-N32-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL - 0x4
182 # OBJ-N32-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16 - 0x4
183 # OBJ-N32-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16 - 0x4
184 # OBJ-N32-NEXT: 0x70 R_MICROMIPS_TLS_GD - 0x4
185 # OBJ-N32-NEXT: 0x74 R_MICROMIPS_TLS_LDM - 0x4
186 # OBJ-N32-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16 - 0x4
187 # OBJ-N32-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16 - 0x4
188 # OBJ-N32-NEXT: 0x80 R_MIPS_JALR - 0x4
189 # OBJ-N32-NEXT: 0x84 R_MICROMIPS_JALR - 0x4
190 # OBJ-N32-NEXT: 0x88 R_MIPS_NONE - 0x9
191 # OBJ-N32-NEXT: 0x89 R_MIPS_16 - 0x9
192 # OBJ-N32-NEXT: 0x8A R_MIPS_32 - 0x9
193 # OBJ-N32-NEXT: 0x8B R_MIPS_64 - 0x9
195 # OBJ-N64-LABEL: Name: .text
196 # OBJ-N64: 0000: 00000000 00000000 00000000 00000000
197 # OBJ-N64-NEXT: 0010: 00000000 00000000 00000000 00000000
198 # OBJ-N64-NEXT: 0020: 00000000 00000000 00000000 00000000
199 # OBJ-N64-NEXT: 0030: 00000000 00000000 00000000 00000000
200 # OBJ-N64-NEXT: 0040: 00000000 00000000 00000000 00000000
201 # OBJ-N64-NEXT: 0050: 00000000 00000000 00000000 00000000
202 # OBJ-N64-NEXT: 0060: 00000000 00000000 00000000 00000000
203 # OBJ-N64-NEXT: 0070: 00000000 00000000 00000000 00000000
204 # OBJ-N64-NEXT: 0080: 00000000 00000000
206 # OBJ-N64-LABEL: Relocations [
207 # OBJ-N64: 0x4 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
208 # OBJ-N64-NEXT: 0x0 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x4
209 # OBJ-N64-NEXT: 0x8 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x8
210 # OBJ-N64-NEXT: 0xC R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE - 0x0
211 # OBJ-N64-NEXT: 0x10 R_MIPS_CALL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
212 # OBJ-N64-NEXT: 0x14 R_MIPS_CALL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
213 # OBJ-N64-NEXT: 0x18 R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE - 0x4
214 # OBJ-N64-NEXT: 0x1C R_MIPS_GOT16/R_MIPS_NONE/R_MIPS_NONE - 0x4
215 # OBJ-N64-NEXT: 0x20 R_MIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE - 0x4
216 # OBJ-N64-NEXT: 0x24 R_MIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE - 0x4
217 # OBJ-N64-NEXT: 0x28 R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE - 0x4
218 # OBJ-N64-NEXT: 0x2C R_MIPS_GOT_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
219 # OBJ-N64-NEXT: 0x30 R_MIPS_GOT_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
220 # OBJ-N64-NEXT: 0x34 R_MIPS_TLS_GOTTPREL/R_MIPS_NONE/R_MIPS_NONE - 0x4
221 # OBJ-N64-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
222 # OBJ-N64-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
223 # OBJ-N64-NEXT: 0x40 R_MIPS_TLS_GD/R_MIPS_NONE/R_MIPS_NONE - 0x4
224 # OBJ-N64-NEXT: 0x44 R_MIPS_TLS_LDM/R_MIPS_NONE/R_MIPS_NONE - 0x4
225 # OBJ-N64-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
226 # OBJ-N64-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
227 # OBJ-N64-NEXT: 0x50 R_MICROMIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE - 0x4
228 # OBJ-N64-NEXT: 0x54 R_MICROMIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE - 0x4
229 # OBJ-N64-NEXT: 0x58 R_MICROMIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE - 0x4
230 # OBJ-N64-NEXT: 0x5C R_MICROMIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE - 0x4
231 # OBJ-N64-NEXT: 0x60 R_MICROMIPS_GOT16/R_MIPS_NONE/R_MIPS_NONE - 0x4
232 # OBJ-N64-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL/R_MIPS_NONE/R_MIPS_NONE - 0x4
233 # OBJ-N64-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
234 # OBJ-N64-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
235 # OBJ-N64-NEXT: 0x70 R_MICROMIPS_TLS_GD/R_MIPS_NONE/R_MIPS_NONE - 0x4
236 # OBJ-N64-NEXT: 0x74 R_MICROMIPS_TLS_LDM/R_MIPS_NONE/R_MIPS_NONE - 0x4
237 # OBJ-N64-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
238 # OBJ-N64-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
239 # OBJ-N64-NEXT: 0x80 R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4
240 # OBJ-N64-NEXT: 0x84 R_MICROMIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4
241 # OBJ-N64-NEXT: 0x88 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE - 0x9
242 # OBJ-N64-NEXT: 0x89 R_MIPS_16/R_MIPS_NONE/R_MIPS_NONE - 0x9
243 # OBJ-N64-NEXT: 0x8A R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE - 0x9
244 # OBJ-N64-NEXT: 0x8B R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE - 0x9