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
87 # OBJ-O32-LABEL: Name: .text
88 # OBJ-O32: 0000: 00000000 00000000 00000008 00000000
89 # OBJ-O32-NEXT: 0010: 00000000 00000004 00000000 00000000
90 # OBJ-O32-NEXT: 0020: 00000004 00000004 00000004 00000000
91 # OBJ-O32-NEXT: 0030: 00000004 00000000 00000000 00000000
92 # OBJ-O32-NEXT: 0040: 00000000 00000000 00000000 00000000
93 # OBJ-O32-NEXT: 0050: 00000000 00000004 00000004 00000004
94 # OBJ-O32-NEXT: 0060: 00000000 00000000 00000000 00000000
95 # OBJ-O32-NEXT: 0070: 00000000 00000000 00000000 00000000
96 # OBJ-O32-NEXT: 0080: 00000000 00000000
98 # OBJ-O32-LABEL: Relocations [
99 # OBJ-O32: 0x0 R_MIPS_NONE .text 0x0
100 # OBJ-O32-NEXT: 0x4 R_MIPS_NONE .text 0x0
101 # OBJ-O32-NEXT: 0x8 R_MIPS_32 .text 0x0
102 # OBJ-O32-NEXT: 0xC R_MIPS_NONE - 0x0
103 # OBJ-O32-NEXT: 0x10 R_MIPS_CALL_HI16 - 0x0
104 # OBJ-O32-NEXT: 0x14 R_MIPS_CALL_LO16 - 0x0
105 # OBJ-O32-NEXT: 0x18 R_MIPS_CALL16 - 0x0
106 # OBJ-O32-NEXT: 0x20 R_MIPS_GOT_PAGE - 0x0
107 # OBJ-O32-NEXT: 0x24 R_MIPS_GOT_OFST - 0x0
108 # OBJ-O32-NEXT: 0x28 R_MIPS_GOT_DISP - 0x0
109 # OBJ-O32-NEXT: 0x2C R_MIPS_GOT_HI16 - 0x0
110 # OBJ-O32-NEXT: 0x30 R_MIPS_GOT_LO16 - 0x0
111 # OBJ-O32-NEXT: 0x34 R_MIPS_TLS_GOTTPREL - 0x0
112 # OBJ-O32-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16 - 0x0
113 # OBJ-O32-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16 - 0x0
114 # OBJ-O32-NEXT: 0x40 R_MIPS_TLS_GD - 0x0
115 # OBJ-O32-NEXT: 0x44 R_MIPS_TLS_LDM - 0x0
116 # OBJ-O32-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16 - 0x0
117 # OBJ-O32-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16 - 0x0
118 # OBJ-O32-NEXT: 0x50 R_MICROMIPS_CALL16 - 0x0
119 # OBJ-O32-NEXT: 0x54 R_MICROMIPS_GOT_DISP - 0x0
120 # OBJ-O32-NEXT: 0x58 R_MICROMIPS_GOT_PAGE - 0x0
121 # OBJ-O32-NEXT: 0x5C R_MICROMIPS_GOT_OFST - 0x0
122 # OBJ-O32-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL - 0x0
123 # OBJ-O32-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16 - 0x0
124 # OBJ-O32-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16 - 0x0
125 # OBJ-O32-NEXT: 0x70 R_MICROMIPS_TLS_GD - 0x0
126 # OBJ-O32-NEXT: 0x74 R_MICROMIPS_TLS_LDM - 0x0
127 # OBJ-O32-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16 - 0x0
128 # OBJ-O32-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16 - 0x0
129 # OBJ-O32-NEXT: 0x80 R_MIPS_JALR - 0x0
130 # OBJ-O32-NEXT: 0x84 R_MICROMIPS_JALR - 0x0
131 # OBJ-O32-NEXT: 0x1C R_MIPS_GOT16 - 0x0
132 # OBJ-O32-NEXT: 0x60 R_MICROMIPS_GOT16 - 0x0
134 # OBJ-N32-LABEL: Name: .text
135 # OBJ-N32: 0000: 00000000 00000000 00000000 00000000
136 # OBJ-N32-NEXT: 0010: 00000000 00000000 00000000 00000000
137 # OBJ-N32-NEXT: 0020: 00000000 00000000 00000000 00000000
138 # OBJ-N32-NEXT: 0030: 00000000 00000000 00000000 00000000
139 # OBJ-N32-NEXT: 0040: 00000000 00000000 00000000 00000000
140 # OBJ-N32-NEXT: 0050: 00000000 00000000 00000000 00000000
141 # OBJ-N32-NEXT: 0060: 00000000 00000000 00000000 00000000
142 # OBJ-N32-NEXT: 0070: 00000000 00000000 00000000 00000000
143 # OBJ-N32-NEXT: 0080: 00000000 00000000
145 # OBJ-N32-LABEL: Relocations [
147 # OBJ-N32: 0x4 R_MIPS_NONE .text 0x0
148 # OBJ-N32-NEXT: 0x0 R_MIPS_NONE .text 0x4
149 # OBJ-N32-NEXT: 0x8 R_MIPS_32 .text 0x8
150 # OBJ-N32-NEXT: 0xC R_MIPS_NONE - 0x0
151 # OBJ-N32-NEXT: 0x10 R_MIPS_CALL_HI16 - 0x4
152 # OBJ-N32-NEXT: 0x14 R_MIPS_CALL_LO16 - 0x4
153 # OBJ-N32-NEXT: 0x18 R_MIPS_CALL16 - 0x4
154 # OBJ-N32-NEXT: 0x1C R_MIPS_GOT16 - 0x4
155 # OBJ-N32-NEXT: 0x20 R_MIPS_GOT_PAGE - 0x4
156 # OBJ-N32-NEXT: 0x24 R_MIPS_GOT_OFST - 0x4
157 # OBJ-N32-NEXT: 0x28 R_MIPS_GOT_DISP - 0x4
158 # OBJ-N32-NEXT: 0x2C R_MIPS_GOT_HI16 - 0x4
159 # OBJ-N32-NEXT: 0x30 R_MIPS_GOT_LO16 - 0x4
160 # OBJ-N32-NEXT: 0x34 R_MIPS_TLS_GOTTPREL - 0x4
161 # OBJ-N32-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16 - 0x4
162 # OBJ-N32-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16 - 0x4
163 # OBJ-N32-NEXT: 0x40 R_MIPS_TLS_GD - 0x4
164 # OBJ-N32-NEXT: 0x44 R_MIPS_TLS_LDM - 0x4
165 # OBJ-N32-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16 - 0x4
166 # OBJ-N32-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16 - 0x4
167 # OBJ-N32-NEXT: 0x50 R_MICROMIPS_CALL16 - 0x4
168 # OBJ-N32-NEXT: 0x54 R_MICROMIPS_GOT_DISP - 0x4
169 # OBJ-N32-NEXT: 0x58 R_MICROMIPS_GOT_PAGE - 0x4
170 # OBJ-N32-NEXT: 0x5C R_MICROMIPS_GOT_OFST - 0x4
171 # OBJ-N32-NEXT: 0x60 R_MICROMIPS_GOT16 - 0x4
172 # OBJ-N32-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL - 0x4
173 # OBJ-N32-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16 - 0x4
174 # OBJ-N32-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16 - 0x4
175 # OBJ-N32-NEXT: 0x70 R_MICROMIPS_TLS_GD - 0x4
176 # OBJ-N32-NEXT: 0x74 R_MICROMIPS_TLS_LDM - 0x4
177 # OBJ-N32-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16 - 0x4
178 # OBJ-N32-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16 - 0x4
179 # OBJ-N32-NEXT: 0x80 R_MIPS_JALR - 0x4
180 # OBJ-N32-NEXT: 0x84 R_MICROMIPS_JALR - 0x4
182 # OBJ-N64-LABEL: Name: .text
183 # OBJ-N64: 0000: 00000000 00000000 00000000 00000000
184 # OBJ-N64-NEXT: 0010: 00000000 00000000 00000000 00000000
185 # OBJ-N64-NEXT: 0020: 00000000 00000000 00000000 00000000
186 # OBJ-N64-NEXT: 0030: 00000000 00000000 00000000 00000000
187 # OBJ-N64-NEXT: 0040: 00000000 00000000 00000000 00000000
188 # OBJ-N64-NEXT: 0050: 00000000 00000000 00000000 00000000
189 # OBJ-N64-NEXT: 0060: 00000000 00000000 00000000 00000000
190 # OBJ-N64-NEXT: 0070: 00000000 00000000 00000000 00000000
191 # OBJ-N64-NEXT: 0080: 00000000 00000000
193 # OBJ-N64-LABEL: Relocations [
194 # OBJ-N64: 0x4 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x0
195 # OBJ-N64-NEXT: 0x0 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE .text 0x4
196 # OBJ-N64-NEXT: 0x8 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE .text 0x8
197 # OBJ-N64-NEXT: 0xC R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE - 0x0
198 # OBJ-N64-NEXT: 0x10 R_MIPS_CALL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
199 # OBJ-N64-NEXT: 0x14 R_MIPS_CALL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
200 # OBJ-N64-NEXT: 0x18 R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE - 0x4
201 # OBJ-N64-NEXT: 0x1C R_MIPS_GOT16/R_MIPS_NONE/R_MIPS_NONE - 0x4
202 # OBJ-N64-NEXT: 0x20 R_MIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE - 0x4
203 # OBJ-N64-NEXT: 0x24 R_MIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE - 0x4
204 # OBJ-N64-NEXT: 0x28 R_MIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE - 0x4
205 # OBJ-N64-NEXT: 0x2C R_MIPS_GOT_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
206 # OBJ-N64-NEXT: 0x30 R_MIPS_GOT_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
207 # OBJ-N64-NEXT: 0x34 R_MIPS_TLS_GOTTPREL/R_MIPS_NONE/R_MIPS_NONE - 0x4
208 # OBJ-N64-NEXT: 0x38 R_MIPS_TLS_DTPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
209 # OBJ-N64-NEXT: 0x3C R_MIPS_TLS_DTPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
210 # OBJ-N64-NEXT: 0x40 R_MIPS_TLS_GD/R_MIPS_NONE/R_MIPS_NONE - 0x4
211 # OBJ-N64-NEXT: 0x44 R_MIPS_TLS_LDM/R_MIPS_NONE/R_MIPS_NONE - 0x4
212 # OBJ-N64-NEXT: 0x48 R_MIPS_TLS_TPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
213 # OBJ-N64-NEXT: 0x4C R_MIPS_TLS_TPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
214 # OBJ-N64-NEXT: 0x50 R_MICROMIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE - 0x4
215 # OBJ-N64-NEXT: 0x54 R_MICROMIPS_GOT_DISP/R_MIPS_NONE/R_MIPS_NONE - 0x4
216 # OBJ-N64-NEXT: 0x58 R_MICROMIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE - 0x4
217 # OBJ-N64-NEXT: 0x5C R_MICROMIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE - 0x4
218 # OBJ-N64-NEXT: 0x60 R_MICROMIPS_GOT16/R_MIPS_NONE/R_MIPS_NONE - 0x4
219 # OBJ-N64-NEXT: 0x64 R_MICROMIPS_TLS_GOTTPREL/R_MIPS_NONE/R_MIPS_NONE - 0x4
220 # OBJ-N64-NEXT: 0x68 R_MICROMIPS_TLS_DTPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
221 # OBJ-N64-NEXT: 0x6C R_MICROMIPS_TLS_DTPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
222 # OBJ-N64-NEXT: 0x70 R_MICROMIPS_TLS_GD/R_MIPS_NONE/R_MIPS_NONE - 0x4
223 # OBJ-N64-NEXT: 0x74 R_MICROMIPS_TLS_LDM/R_MIPS_NONE/R_MIPS_NONE - 0x4
224 # OBJ-N64-NEXT: 0x78 R_MICROMIPS_TLS_TPREL_HI16/R_MIPS_NONE/R_MIPS_NONE - 0x4
225 # OBJ-N64-NEXT: 0x7C R_MICROMIPS_TLS_TPREL_LO16/R_MIPS_NONE/R_MIPS_NONE - 0x4
226 # OBJ-N64-NEXT: 0x80 R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4
227 # OBJ-N64-NEXT: 0x84 R_MICROMIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4