diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch')
-rw-r--r-- | meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch | 549 |
1 files changed, 0 insertions, 549 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch deleted file mode 100644 index 2ce165bc..00000000 --- a/meta-microblaze/recipes-devtools/binutils/binutils/0024-Patch-MicroBlaze-double-imml-generation-for-64-bit-v.patch +++ /dev/null | |||
@@ -1,549 +0,0 @@ | |||
1 | From ec5bfe546213b2cb7fe2a51f9f9571597b2c5aa9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mahesh Bodapati <mbodapat@xilinx.com> | ||
3 | Date: Mon, 26 Aug 2019 15:29:42 +0530 | ||
4 | Subject: [PATCH 24/34] [Patch,MicroBlaze] : double imml generation for 64 bit | ||
5 | values. | ||
6 | |||
7 | Conflicts: | ||
8 | gas/config/tc-microblaze.c | ||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Mark Hatle <mark.hatle@amd.com> | ||
12 | |||
13 | --- | ||
14 | gas/config/tc-microblaze.c | 321 ++++++++++++++++++++++++++++++------- | ||
15 | opcodes/microblaze-opc.h | 4 +- | ||
16 | 2 files changed, 262 insertions(+), 63 deletions(-) | ||
17 | |||
18 | diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c | ||
19 | index 27544b60ea3..4c455ff02b8 100644 | ||
20 | --- a/gas/config/tc-microblaze.c | ||
21 | +++ b/gas/config/tc-microblaze.c | ||
22 | @@ -1008,7 +1008,7 @@ md_assemble (char * str) | ||
23 | char * op_start; | ||
24 | char * op_end; | ||
25 | char * temp_op_end; | ||
26 | - struct op_code_struct * opcode, *opcode1; | ||
27 | + struct op_code_struct * opcode, *opcode1, *opcode2; | ||
28 | char * output = NULL; | ||
29 | int nlen = 0; | ||
30 | int i; | ||
31 | @@ -1192,7 +1192,12 @@ md_assemble (char * str) | ||
32 | reg2 = 0; | ||
33 | } | ||
34 | if (strcmp (op_end, "")) | ||
35 | + { | ||
36 | + if(microblaze_arch_size == 64) | ||
37 | + op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML); | ||
38 | + else | ||
39 | op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM); | ||
40 | + } | ||
41 | else | ||
42 | as_fatal (_("Error in statement syntax")); | ||
43 | |||
44 | @@ -1292,26 +1297,51 @@ md_assemble (char * str) | ||
45 | || streq (name, "lwi") || streq (name, "sbi") | ||
46 | || streq (name, "shi") || streq (name, "swi")))) | ||
47 | { | ||
48 | - temp = immed & 0xFFFFFF8000; | ||
49 | - if (temp != 0 && temp != 0xFFFFFF8000) | ||
50 | + temp = ((long long)immed) & 0xFFFFFFFFFFFF8000; | ||
51 | + if (temp != 0 && temp != 0xFFFFFFFFFFFF8000) | ||
52 | { | ||
53 | /* Needs an immediate inst. */ | ||
54 | - opcode1 | ||
55 | - = (struct op_code_struct *) str_hash_find (opcode_hash_control, | ||
56 | - "imml"); | ||
57 | - if (opcode1 == NULL) | ||
58 | + if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) | ||
59 | + { | ||
60 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
61 | + if (opcode1 == NULL) | ||
62 | { | ||
63 | as_bad (_("unknown opcode \"%s\""), "imml"); | ||
64 | return; | ||
65 | } | ||
66 | inst1 = opcode1->bit_sequence; | ||
67 | - inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
68 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
69 | output[0] = INST_BYTE0 (inst1); | ||
70 | output[1] = INST_BYTE1 (inst1); | ||
71 | output[2] = INST_BYTE2 (inst1); | ||
72 | output[3] = INST_BYTE3 (inst1); | ||
73 | output = frag_more (isize); | ||
74 | } | ||
75 | + else | ||
76 | + { | ||
77 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
78 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
79 | + if (opcode1 == NULL || opcode2 == NULL) | ||
80 | + { | ||
81 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
82 | + return; | ||
83 | + } | ||
84 | + inst1 = opcode2->bit_sequence; | ||
85 | + inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; | ||
86 | + output[0] = INST_BYTE0 (inst1); | ||
87 | + output[1] = INST_BYTE1 (inst1); | ||
88 | + output[2] = INST_BYTE2 (inst1); | ||
89 | + output[3] = INST_BYTE3 (inst1); | ||
90 | + output = frag_more (isize); | ||
91 | + inst1 = opcode1->bit_sequence; | ||
92 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
93 | + output[0] = INST_BYTE0 (inst1); | ||
94 | + output[1] = INST_BYTE1 (inst1); | ||
95 | + output[2] = INST_BYTE2 (inst1); | ||
96 | + output[3] = INST_BYTE3 (inst1); | ||
97 | + output = frag_more (isize); | ||
98 | + } | ||
99 | + } | ||
100 | inst |= (reg1 << RD_LOW) & RD_MASK; | ||
101 | inst |= (reg2 << RA_LOW) & RA_MASK; | ||
102 | inst |= (immed << IMM_LOW) & IMM_MASK; | ||
103 | @@ -1328,8 +1358,7 @@ md_assemble (char * str) | ||
104 | as_bad (_("unknown opcode \"%s\""), "imm"); | ||
105 | return; | ||
106 | } | ||
107 | - | ||
108 | - inst1 = opcode1->bit_sequence; | ||
109 | + inst1 = opcode1->bit_sequence; | ||
110 | inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK; | ||
111 | output[0] = INST_BYTE0 (inst1); | ||
112 | output[1] = INST_BYTE1 (inst1); | ||
113 | @@ -1570,7 +1599,7 @@ md_assemble (char * str) | ||
114 | as_fatal (_("Cannot use special register with this instruction")); | ||
115 | |||
116 | if (exp.X_op != O_constant) | ||
117 | - as_fatal (_("Symbol used as immediate value for msrset/msrclr instructions")); | ||
118 | + as_fatal (_("Symbol used as immediate value for arithmetic long instructions")); | ||
119 | else | ||
120 | { | ||
121 | output = frag_more (isize); | ||
122 | @@ -1904,6 +1933,7 @@ md_assemble (char * str) | ||
123 | temp = immed & 0xFFFF8000; | ||
124 | if ((temp != 0) && (temp != 0xFFFF8000)) | ||
125 | { | ||
126 | + | ||
127 | /* Needs an immediate inst. */ | ||
128 | opcode1 | ||
129 | = (struct op_code_struct *) str_hash_find (opcode_hash_control, | ||
130 | @@ -1936,7 +1966,12 @@ md_assemble (char * str) | ||
131 | reg1 = 0; | ||
132 | } | ||
133 | if (strcmp (op_end, "")) | ||
134 | + { | ||
135 | + if(microblaze_arch_size == 64) | ||
136 | + op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML); | ||
137 | + else | ||
138 | op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM); | ||
139 | + } | ||
140 | else | ||
141 | as_fatal (_("Error in statement syntax")); | ||
142 | |||
143 | @@ -1975,30 +2010,55 @@ md_assemble (char * str) | ||
144 | } | ||
145 | if (streq (name, "brealid") || streq (name, "breaid") || streq (name, "breai")) | ||
146 | { | ||
147 | - temp = immed & 0xFFFFFF8000; | ||
148 | - if (temp != 0 && temp != 0xFFFFFF8000) | ||
149 | + temp = ((long long)immed) & 0xFFFFFFFFFFFF8000; | ||
150 | + if (temp != 0 && temp != 0xFFFFFFFFFFFF8000) | ||
151 | { | ||
152 | /* Needs an immediate inst. */ | ||
153 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
154 | + if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) | ||
155 | + { | ||
156 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
157 | if (opcode1 == NULL) | ||
158 | { | ||
159 | as_bad (_("unknown opcode \"%s\""), "imml"); | ||
160 | return; | ||
161 | } | ||
162 | inst1 = opcode1->bit_sequence; | ||
163 | - inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
164 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
165 | output[0] = INST_BYTE0 (inst1); | ||
166 | output[1] = INST_BYTE1 (inst1); | ||
167 | output[2] = INST_BYTE2 (inst1); | ||
168 | output[3] = INST_BYTE3 (inst1); | ||
169 | output = frag_more (isize); | ||
170 | } | ||
171 | + else { | ||
172 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
173 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
174 | + if (opcode1 == NULL || opcode2 == NULL) | ||
175 | + { | ||
176 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
177 | + return; | ||
178 | + } | ||
179 | + inst1 = opcode2->bit_sequence; | ||
180 | + inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; | ||
181 | + output[0] = INST_BYTE0 (inst1); | ||
182 | + output[1] = INST_BYTE1 (inst1); | ||
183 | + output[2] = INST_BYTE2 (inst1); | ||
184 | + output[3] = INST_BYTE3 (inst1); | ||
185 | + output = frag_more (isize); | ||
186 | + inst1 = opcode1->bit_sequence; | ||
187 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
188 | + output[0] = INST_BYTE0 (inst1); | ||
189 | + output[1] = INST_BYTE1 (inst1); | ||
190 | + output[2] = INST_BYTE2 (inst1); | ||
191 | + output[3] = INST_BYTE3 (inst1); | ||
192 | + output = frag_more (isize); | ||
193 | + } | ||
194 | + } | ||
195 | inst |= (reg1 << RD_LOW) & RD_MASK; | ||
196 | inst |= (immed << IMM_LOW) & IMM_MASK; | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | - | ||
201 | temp = immed & 0xFFFF8000; | ||
202 | if ((temp != 0) && (temp != 0xFFFF8000)) | ||
203 | { | ||
204 | @@ -2086,24 +2146,50 @@ md_assemble (char * str) | ||
205 | streq (name, "breaid") || | ||
206 | streq (name, "brai") || streq (name, "braid"))) | ||
207 | { | ||
208 | - temp = immed & 0xFFFFFF8000; | ||
209 | + temp = immed & 0xFFFFFFFFFFFF8000; | ||
210 | if (temp != 0) | ||
211 | { | ||
212 | /* Needs an immediate inst. */ | ||
213 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
214 | + if (((long long)immed) > (long long)-549755813888 && ((long long)immed) < (long long)549755813887) | ||
215 | + { | ||
216 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
217 | if (opcode1 == NULL) | ||
218 | { | ||
219 | as_bad (_("unknown opcode \"%s\""), "imml"); | ||
220 | return; | ||
221 | } | ||
222 | inst1 = opcode1->bit_sequence; | ||
223 | - inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
224 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
225 | output[0] = INST_BYTE0 (inst1); | ||
226 | output[1] = INST_BYTE1 (inst1); | ||
227 | output[2] = INST_BYTE2 (inst1); | ||
228 | output[3] = INST_BYTE3 (inst1); | ||
229 | output = frag_more (isize); | ||
230 | } | ||
231 | + else { | ||
232 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
233 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
234 | + if (opcode1 == NULL || opcode2 == NULL) | ||
235 | + { | ||
236 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
237 | + return; | ||
238 | + } | ||
239 | + inst1 = opcode2->bit_sequence; | ||
240 | + inst1 |= ((immed & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; | ||
241 | + output[0] = INST_BYTE0 (inst1); | ||
242 | + output[1] = INST_BYTE1 (inst1); | ||
243 | + output[2] = INST_BYTE2 (inst1); | ||
244 | + output[3] = INST_BYTE3 (inst1); | ||
245 | + output = frag_more (isize); | ||
246 | + inst1 = opcode1->bit_sequence; | ||
247 | + inst1 |= ((immed & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
248 | + output[0] = INST_BYTE0 (inst1); | ||
249 | + output[1] = INST_BYTE1 (inst1); | ||
250 | + output[2] = INST_BYTE2 (inst1); | ||
251 | + output[3] = INST_BYTE3 (inst1); | ||
252 | + output = frag_more (isize); | ||
253 | + } | ||
254 | + } | ||
255 | inst |= (immed << IMM_LOW) & IMM_MASK; | ||
256 | } | ||
257 | else | ||
258 | @@ -2203,21 +2289,45 @@ md_assemble (char * str) | ||
259 | { | ||
260 | output = frag_more (isize); | ||
261 | immedl = exp.X_add_number; | ||
262 | - | ||
263 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
264 | - if (opcode1 == NULL) | ||
265 | - { | ||
266 | - as_bad (_("unknown opcode \"%s\""), "imml"); | ||
267 | - return; | ||
268 | - } | ||
269 | - | ||
270 | - inst1 = opcode1->bit_sequence; | ||
271 | - inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
272 | - output[0] = INST_BYTE0 (inst1); | ||
273 | - output[1] = INST_BYTE1 (inst1); | ||
274 | - output[2] = INST_BYTE2 (inst1); | ||
275 | - output[3] = INST_BYTE3 (inst1); | ||
276 | - output = frag_more (isize); | ||
277 | + if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887) | ||
278 | + { | ||
279 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
280 | + if (opcode1 == NULL) | ||
281 | + { | ||
282 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
283 | + return; | ||
284 | + } | ||
285 | + inst1 = opcode1->bit_sequence; | ||
286 | + inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
287 | + output[0] = INST_BYTE0 (inst1); | ||
288 | + output[1] = INST_BYTE1 (inst1); | ||
289 | + output[2] = INST_BYTE2 (inst1); | ||
290 | + output[3] = INST_BYTE3 (inst1); | ||
291 | + output = frag_more (isize); | ||
292 | + } | ||
293 | + else { | ||
294 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
295 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
296 | + if (opcode2 == NULL || opcode1 == NULL) | ||
297 | + { | ||
298 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
299 | + return; | ||
300 | + } | ||
301 | + inst1 = opcode2->bit_sequence; | ||
302 | + inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; | ||
303 | + output[0] = INST_BYTE0 (inst1); | ||
304 | + output[1] = INST_BYTE1 (inst1); | ||
305 | + output[2] = INST_BYTE2 (inst1); | ||
306 | + output[3] = INST_BYTE3 (inst1); | ||
307 | + output = frag_more (isize); | ||
308 | + inst1 = opcode1->bit_sequence; | ||
309 | + inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
310 | + output[0] = INST_BYTE0 (inst1); | ||
311 | + output[1] = INST_BYTE1 (inst1); | ||
312 | + output[2] = INST_BYTE2 (inst1); | ||
313 | + output[3] = INST_BYTE3 (inst1); | ||
314 | + output = frag_more (isize); | ||
315 | + } | ||
316 | } | ||
317 | |||
318 | inst |= (reg1 << RD_LOW) & RD_MASK; | ||
319 | @@ -2266,21 +2376,46 @@ md_assemble (char * str) | ||
320 | { | ||
321 | output = frag_more (isize); | ||
322 | immedl = exp.X_add_number; | ||
323 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
324 | - if (opcode1 == NULL) | ||
325 | - { | ||
326 | - as_bad (_("unknown opcode \"%s\""), "imml"); | ||
327 | - return; | ||
328 | - } | ||
329 | - | ||
330 | + if (((long long)immedl) > (long long)-549755813888 && ((long long)immedl) < (long long)549755813887) | ||
331 | + { | ||
332 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
333 | + if (opcode1 == NULL) | ||
334 | + { | ||
335 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
336 | + return; | ||
337 | + } | ||
338 | + inst1 = opcode1->bit_sequence; | ||
339 | + inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
340 | + output[0] = INST_BYTE0 (inst1); | ||
341 | + output[1] = INST_BYTE1 (inst1); | ||
342 | + output[2] = INST_BYTE2 (inst1); | ||
343 | + output[3] = INST_BYTE3 (inst1); | ||
344 | + output = frag_more (isize); | ||
345 | + } | ||
346 | + else { | ||
347 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
348 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
349 | + if (opcode2 == NULL || opcode1 == NULL) | ||
350 | + { | ||
351 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
352 | + return; | ||
353 | + } | ||
354 | + inst1 = opcode2->bit_sequence; | ||
355 | + inst1 |= ((immedl & 0xFFFFFF0000000000L) >> 40) & IMML_MASK; | ||
356 | + output[0] = INST_BYTE0 (inst1); | ||
357 | + output[1] = INST_BYTE1 (inst1); | ||
358 | + output[2] = INST_BYTE2 (inst1); | ||
359 | + output[3] = INST_BYTE3 (inst1); | ||
360 | + output = frag_more (isize); | ||
361 | inst1 = opcode1->bit_sequence; | ||
362 | - inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
363 | + inst1 |= ((immedl & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
364 | output[0] = INST_BYTE0 (inst1); | ||
365 | output[1] = INST_BYTE1 (inst1); | ||
366 | output[2] = INST_BYTE2 (inst1); | ||
367 | output[3] = INST_BYTE3 (inst1); | ||
368 | output = frag_more (isize); | ||
369 | } | ||
370 | + } | ||
371 | |||
372 | inst |= (reg1 << RA_LOW) & RA_MASK; | ||
373 | inst |= (immedl << IMM_LOW) & IMM_MASK; | ||
374 | @@ -2560,8 +2695,8 @@ md_apply_fix (fixS * fixP, | ||
375 | /* Note: use offsetT because it is signed, valueT is unsigned. */ | ||
376 | offsetT val = (offsetT) * valp; | ||
377 | int i; | ||
378 | - struct op_code_struct * opcode1; | ||
379 | - unsigned long inst1; | ||
380 | + struct op_code_struct * opcode1, * opcode2; | ||
381 | + unsigned long inst1,inst2; | ||
382 | |||
383 | symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>"); | ||
384 | |||
385 | @@ -2743,30 +2878,75 @@ md_apply_fix (fixS * fixP, | ||
386 | case BFD_RELOC_MICROBLAZE_64_TEXTREL: | ||
387 | case BFD_RELOC_MICROBLAZE_64: | ||
388 | case BFD_RELOC_MICROBLAZE_64_PCREL: | ||
389 | - /* Add an imm instruction. First save the current instruction. */ | ||
390 | - for (i = 0; i < INST_WORD_SIZE; i++) | ||
391 | - buf[i + INST_WORD_SIZE] = buf[i]; | ||
392 | if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64 | ||
393 | || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
394 | { | ||
395 | /* Generate the imm instruction. */ | ||
396 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
397 | + if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887) | ||
398 | + { | ||
399 | + /* Add an imm instruction. First save the current instruction. */ | ||
400 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
401 | + buf[i + INST_WORD_SIZE] = buf[i]; | ||
402 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
403 | if (opcode1 == NULL) | ||
404 | - { | ||
405 | - as_bad (_("unknown opcode \"%s\""), "imml"); | ||
406 | - return; | ||
407 | - } | ||
408 | + { | ||
409 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
410 | + return; | ||
411 | + } | ||
412 | |||
413 | inst1 = opcode1->bit_sequence; | ||
414 | if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
415 | - inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK; | ||
416 | + inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
417 | if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
418 | - fixP->fx_r_type = BFD_RELOC_64; | ||
419 | + fixP->fx_r_type = BFD_RELOC_64; | ||
420 | if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
421 | - fixP->fx_r_type = BFD_RELOC_64_PCREL; | ||
422 | + fixP->fx_r_type = BFD_RELOC_64_PCREL; | ||
423 | + buf[0] = INST_BYTE0 (inst1); | ||
424 | + buf[1] = INST_BYTE1 (inst1); | ||
425 | + buf[2] = INST_BYTE2 (inst1); | ||
426 | + buf[3] = INST_BYTE3 (inst1); | ||
427 | + } | ||
428 | + else { | ||
429 | + /* Add an imm instruction. First save the current instruction. */ | ||
430 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
431 | + buf[i + INST_WORD_SIZE + 4] = buf[i]; | ||
432 | + | ||
433 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
434 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
435 | + if (opcode1 == NULL || opcode2 ==NULL) | ||
436 | + { | ||
437 | + as_bad (_("unknown opcode \"%s\""), "imml"); | ||
438 | + return; | ||
439 | + } | ||
440 | + inst1 = opcode2->bit_sequence; | ||
441 | + if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
442 | + inst1 |= ((val & 0x000000FFFFFF0000L) >> 40) & IMML_MASK; | ||
443 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
444 | + fixP->fx_r_type = BFD_RELOC_64; | ||
445 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
446 | + fixP->fx_r_type = BFD_RELOC_64_PCREL; | ||
447 | + inst2 = opcode1->bit_sequence; | ||
448 | + if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
449 | + inst1 |= ((val & 0x000000FFFFFF0000L) >> 16) & IMML_MASK; | ||
450 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
451 | + fixP->fx_r_type = BFD_RELOC_64; | ||
452 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
453 | + fixP->fx_r_type = BFD_RELOC_64_PCREL; | ||
454 | + buf[0] = INST_BYTE0 (inst1); | ||
455 | + buf[1] = INST_BYTE1 (inst1); | ||
456 | + buf[2] = INST_BYTE2 (inst1); | ||
457 | + buf[3] = INST_BYTE3 (inst1); | ||
458 | + buf[4] = INST_BYTE0 (inst2); | ||
459 | + buf[5] = INST_BYTE1 (inst2); | ||
460 | + buf[6] = INST_BYTE2 (inst2); | ||
461 | + buf[7] = INST_BYTE3 (inst2); | ||
462 | + } | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | + /* Add an imm instruction. First save the current instruction. */ | ||
467 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
468 | + buf[i + INST_WORD_SIZE] = buf[i]; | ||
469 | /* Generate the imm instruction. */ | ||
470 | opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); | ||
471 | if (opcode1 == NULL) | ||
472 | @@ -2778,12 +2958,11 @@ md_apply_fix (fixS * fixP, | ||
473 | inst1 = opcode1->bit_sequence; | ||
474 | if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
475 | inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; | ||
476 | - } | ||
477 | buf[0] = INST_BYTE0 (inst1); | ||
478 | buf[1] = INST_BYTE1 (inst1); | ||
479 | buf[2] = INST_BYTE2 (inst1); | ||
480 | buf[3] = INST_BYTE3 (inst1); | ||
481 | - | ||
482 | + } | ||
483 | /* Add the value only if the symbol is defined. */ | ||
484 | if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
485 | { | ||
486 | @@ -2816,21 +2995,41 @@ md_apply_fix (fixS * fixP, | ||
487 | for (i = 0; i < INST_WORD_SIZE; i++) | ||
488 | buf[i + INST_WORD_SIZE] = buf[i]; | ||
489 | /* Generate the imm instruction. */ | ||
490 | - if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) | ||
491 | - opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
492 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) { | ||
493 | + if (((long long)val) > (long long)-549755813888 && ((long long)val) < (long long)549755813887) | ||
494 | + { | ||
495 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
496 | + buf[i + INST_WORD_SIZE] = buf[i]; | ||
497 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
498 | + } | ||
499 | + else { | ||
500 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
501 | + buf[i + INST_WORD_SIZE + 4] = buf[i]; | ||
502 | + opcode2 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
503 | + opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
504 | + inst2 = opcode2->bit_sequence; | ||
505 | + | ||
506 | + /* We can fixup call to a defined non-global address | ||
507 | + * within the same section only. */ | ||
508 | + buf[4] = INST_BYTE0 (inst2); | ||
509 | + buf[5] = INST_BYTE1 (inst2); | ||
510 | + buf[6] = INST_BYTE2 (inst2); | ||
511 | + buf[7] = INST_BYTE3 (inst2); | ||
512 | + } | ||
513 | + } | ||
514 | else | ||
515 | opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); | ||
516 | if (opcode1 == NULL) | ||
517 | { | ||
518 | + for (i = 0; i < INST_WORD_SIZE; i++) | ||
519 | + buf[i + INST_WORD_SIZE] = buf[i]; | ||
520 | if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) | ||
521 | as_bad (_("unknown opcode \"%s\""), "imml"); | ||
522 | else | ||
523 | as_bad (_("unknown opcode \"%s\""), "imm"); | ||
524 | return; | ||
525 | } | ||
526 | - | ||
527 | inst1 = opcode1->bit_sequence; | ||
528 | - | ||
529 | /* We can fixup call to a defined non-global address | ||
530 | within the same section only. */ | ||
531 | buf[0] = INST_BYTE0 (inst1); | ||
532 | diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h | ||
533 | index 82da7f1179a..e65f4b58233 100644 | ||
534 | --- a/opcodes/microblaze-opc.h | ||
535 | +++ b/opcodes/microblaze-opc.h | ||
536 | @@ -626,8 +626,8 @@ char pvr_register_prefix[] = "rpvr"; | ||
537 | #define MIN_IMM6_WIDTH ((int) 0x00000001) | ||
538 | #define MAX_IMM6_WIDTH ((int) 0x00000040) | ||
539 | |||
540 | -#define MIN_IMML ((long long) 0xffffff8000000000L) | ||
541 | -#define MAX_IMML ((long long) 0x0000007fffffffffL) | ||
542 | +#define MIN_IMML ((long long) -9223372036854775808) | ||
543 | +#define MAX_IMML ((long long) 9223372036854775807) | ||
544 | |||
545 | #endif /* MICROBLAZE_OPC */ | ||
546 | |||
547 | -- | ||
548 | 2.37.1 (Apple Git-137.1) | ||
549 | |||