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