summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch365
1 files changed, 0 insertions, 365 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch
deleted file mode 100644
index 91f37443..00000000
--- a/meta-microblaze/recipes-devtools/binutils/binutils/0015-Fixed-MB-x-relocation-issues.patch
+++ /dev/null
@@ -1,365 +0,0 @@
1From da36307dff05dff1eebd44aec56f9bdc196ad632 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 28 Sep 2018 12:04:55 +0530
4Subject: [PATCH 15/34] -Fixed MB-x relocation issues -Added imml for required
5 MB-x instructions
6
7Conflicts:
8 bfd/elf64-microblaze.c
9 gas/config/tc-microblaze.c
10
11Conflicts:
12 gas/config/tc-microblaze.c
13Upstream-Status: Pending
14
15Signed-off-by: Mark Hatle <mark.hatle@amd.com>
16
17---
18 bfd/elf64-microblaze.c | 48 ++++++++++--
19 gas/config/tc-microblaze.c | 155 ++++++++++++++++++++++++++-----------
20 gas/tc.h | 2 +-
21 3 files changed, 152 insertions(+), 53 deletions(-)
22
23diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
24index 0faa8de73c8..951bb36506d 100644
25--- a/bfd/elf64-microblaze.c
26+++ b/bfd/elf64-microblaze.c
27@@ -1552,6 +1552,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
28 bfd_put_16 (input_bfd, relocation & 0xffff,
29 contents + offset + endian);
30
31+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
32+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
33+ {
34+ insn &= ~0x00ffffff;
35+ insn |= (relocation >> 16) & 0xffffff;
36+ bfd_put_32 (input_bfd, insn,
37+ contents + offset + endian);
38+ }
39 else
40 {
41 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
42@@ -1659,6 +1667,14 @@ microblaze_elf_relocate_section (bfd *output_bfd,
43 bfd_put_16 (input_bfd, relocation & 0xffff,
44 contents + offset + endian);
45 }
46+ unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian);
47+ if (insn == 0xb2000000 || insn == 0xb2ffffff)
48+ {
49+ insn &= ~0x00ffffff;
50+ insn |= (relocation >> 16) & 0xffffff;
51+ bfd_put_32 (input_bfd, insn,
52+ contents + offset + endian);
53+ }
54 else
55 {
56 bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff,
57@@ -1769,9 +1785,19 @@ static void
58 microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
59 {
60 unsigned long instr = bfd_get_32 (abfd, bfd_addr);
61- instr &= ~0x0000ffff;
62- instr |= (val & 0x0000ffff);
63- bfd_put_32 (abfd, instr, bfd_addr);
64+
65+ if (instr == 0xb2000000 || instr == 0xb2ffffff)
66+ {
67+ instr &= ~0x00ffffff;
68+ instr |= (val & 0xffffff);
69+ bfd_put_32 (abfd, instr, bfd_addr);
70+ }
71+ else
72+ {
73+ instr &= ~0x0000ffff;
74+ instr |= (val & 0x0000ffff);
75+ bfd_put_32 (abfd, instr, bfd_addr);
76+ }
77 }
78
79 /* Read-modify-write into the bfd, an immediate value into appropriate fields of
80@@ -1783,10 +1809,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val)
81 unsigned long instr_lo;
82
83 instr_hi = bfd_get_32 (abfd, bfd_addr);
84- instr_hi &= ~0x0000ffff;
85- instr_hi |= ((val >> 16) & 0x0000ffff);
86- bfd_put_32 (abfd, instr_hi, bfd_addr);
87-
88+ if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff)
89+ {
90+ instr_hi &= ~0x00ffffff;
91+ instr_hi |= (val >> 16) & 0xffffff;
92+ bfd_put_32 (abfd, instr_hi,bfd_addr);
93+ }
94+ else
95+ {
96+ instr_hi &= ~0x0000ffff;
97+ instr_hi |= ((val >> 16) & 0x0000ffff);
98+ bfd_put_32 (abfd, instr_hi, bfd_addr);
99+ }
100 instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE);
101 instr_lo &= ~0x0000ffff;
102 instr_lo |= (val & 0x0000ffff);
103diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
104index 9d4dbc12ab3..a0e97231a41 100644
105--- a/gas/config/tc-microblaze.c
106+++ b/gas/config/tc-microblaze.c
107@@ -392,7 +392,7 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED)
108 Integer arg to pass to the function. */
109 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
110 and then in the read.c table. */
111-const pseudo_typeS md_pseudo_table[] =
112+pseudo_typeS md_pseudo_table[] =
113 {
114 {"lcomm", microblaze_s_lcomm, 1},
115 {"data", microblaze_s_data, 0},
116@@ -401,7 +401,7 @@ const pseudo_typeS md_pseudo_table[] =
117 {"data32", cons, 4}, /* Same as word. */
118 {"ent", s_func, 0}, /* Treat ent as function entry point. */
119 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
120- {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
121+ {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
122 {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
123 {"weakext", microblaze_s_weakext, 0},
124 {"rodata", microblaze_s_rdata, 0},
125@@ -996,7 +996,7 @@ md_assemble (char * str)
126 unsigned reg2;
127 unsigned reg3;
128 unsigned isize;
129- unsigned int immed = 0, immed2 = 0, temp;
130+ unsigned long immed = 0, immed2 = 0, temp;
131 expressionS exp;
132 char name[20];
133 long immedl;
134@@ -1118,8 +1118,9 @@ md_assemble (char * str)
135 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
136 else if (streq (name, "smi"))
137 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
138-
139- if (reg2 == REG_ROSDP)
140+ if(streq (name, "lli") || streq (name, "sli"))
141+ opc = str_microblaze_64;
142+ else if (reg2 == REG_ROSDP)
143 opc = str_microblaze_ro_anchor;
144 else if (reg2 == REG_RWSDP)
145 opc = str_microblaze_rw_anchor;
146@@ -1186,33 +1187,57 @@ md_assemble (char * str)
147 inst |= (immed << IMM_LOW) & IMM_MASK;
148 }
149 }
150- else
151- {
152- temp = immed & 0xFFFF8000;
153- if ((temp != 0) && (temp != 0xFFFF8000))
154- {
155+ else if (streq (name, "lli") || streq (name, "sli"))
156+ {
157+ temp = immed & 0xFFFFFF8000;
158+ if (temp != 0 && temp != 0xFFFFFF8000)
159+ {
160 /* Needs an immediate inst. */
161 opcode1
162 = (struct op_code_struct *) str_hash_find (opcode_hash_control,
163- "imm");
164+ "imml");
165 if (opcode1 == NULL)
166 {
167- as_bad (_("unknown opcode \"%s\""), "imm");
168+ as_bad (_("unknown opcode \"%s\""), "imml");
169 return;
170 }
171-
172 inst1 = opcode1->bit_sequence;
173- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
174+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
175 output[0] = INST_BYTE0 (inst1);
176 output[1] = INST_BYTE1 (inst1);
177 output[2] = INST_BYTE2 (inst1);
178 output[3] = INST_BYTE3 (inst1);
179 output = frag_more (isize);
180- }
181- inst |= (reg1 << RD_LOW) & RD_MASK;
182- inst |= (reg2 << RA_LOW) & RA_MASK;
183- inst |= (immed << IMM_LOW) & IMM_MASK;
184- }
185+ }
186+ inst |= (reg1 << RD_LOW) & RD_MASK;
187+ inst |= (reg2 << RA_LOW) & RA_MASK;
188+ inst |= (immed << IMM_LOW) & IMM_MASK;
189+ }
190+ else
191+ {
192+ temp = immed & 0xFFFF8000;
193+ if ((temp != 0) && (temp != 0xFFFF8000))
194+ {
195+ /* Needs an immediate inst. */
196+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
197+ if (opcode1 == NULL)
198+ {
199+ as_bad (_("unknown opcode \"%s\""), "imm");
200+ return;
201+ }
202+
203+ inst1 = opcode1->bit_sequence;
204+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
205+ output[0] = INST_BYTE0 (inst1);
206+ output[1] = INST_BYTE1 (inst1);
207+ output[2] = INST_BYTE2 (inst1);
208+ output[3] = INST_BYTE3 (inst1);
209+ output = frag_more (isize);
210+ }
211+ inst |= (reg1 << RD_LOW) & RD_MASK;
212+ inst |= (reg2 << RA_LOW) & RA_MASK;
213+ inst |= (immed << IMM_LOW) & IMM_MASK;
214+ }
215 break;
216
217 case INST_TYPE_RD_R1_IMMS:
218@@ -1842,12 +1867,20 @@ md_assemble (char * str)
219 case INST_TYPE_IMM:
220 if (streq (name, "imm"))
221 as_fatal (_("An IMM instruction should not be present in the .s file"));
222-
223- op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
224+ if (microblaze_arch_size == 64)
225+ op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML);
226+ else
227+ op_end = parse_imm (op_end + 1, & exp, MIN_IMM, MAX_IMM);
228
229 if (exp.X_op != O_constant)
230 {
231- char *opc = NULL;
232+ char *opc;
233+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
234+ streq (name, "breaid") ||
235+ streq (name, "brai") || streq (name, "braid")))
236+ opc = str_microblaze_64;
237+ else
238+ opc = NULL;
239 relax_substateT subtype;
240
241 if (exp.X_md != 0)
242@@ -1870,29 +1903,53 @@ md_assemble (char * str)
243 immed = exp.X_add_number;
244 }
245
246-
247- temp = immed & 0xFFFF8000;
248- if ((temp != 0) && (temp != 0xFFFF8000))
249- {
250- /* Needs an immediate inst. */
251- opcode1
252- = (struct op_code_struct *) str_hash_find (opcode_hash_control,
253- "imm");
254- if (opcode1 == NULL)
255- {
256- as_bad (_("unknown opcode \"%s\""), "imm");
257- return;
258+ if (microblaze_arch_size == 64 && (streq (name, "breai") ||
259+ streq (name, "breaid") ||
260+ streq (name, "brai") || streq (name, "braid")))
261+ {
262+ temp = immed & 0xFFFFFF8000;
263+ if (temp != 0)
264+ {
265+ /* Needs an immediate inst. */
266+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml");
267+ if (opcode1 == NULL)
268+ {
269+ as_bad (_("unknown opcode \"%s\""), "imml");
270+ return;
271+ }
272+ inst1 = opcode1->bit_sequence;
273+ inst1 |= ((immed & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
274+ output[0] = INST_BYTE0 (inst1);
275+ output[1] = INST_BYTE1 (inst1);
276+ output[2] = INST_BYTE2 (inst1);
277+ output[3] = INST_BYTE3 (inst1);
278+ output = frag_more (isize);
279 }
280+ inst |= (immed << IMM_LOW) & IMM_MASK;
281+ }
282+ else
283+ {
284+ temp = immed & 0xFFFF8000;
285+ if ((temp != 0) && (temp != 0xFFFF8000))
286+ {
287+ /* Needs an immediate inst. */
288+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
289+ if (opcode1 == NULL)
290+ {
291+ as_bad (_("unknown opcode \"%s\""), "imm");
292+ return;
293+ }
294
295- inst1 = opcode1->bit_sequence;
296- inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_MASK;
297- output[0] = INST_BYTE0 (inst1);
298- output[1] = INST_BYTE1 (inst1);
299- output[2] = INST_BYTE2 (inst1);
300- output[3] = INST_BYTE3 (inst1);
301- output = frag_more (isize);
302- }
303- inst |= (immed << IMM_LOW) & IMM_MASK;
304+ inst1 = opcode1->bit_sequence;
305+ inst1 |= ((immed & 0xFFFF0000) >> 16) & IMM_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+ inst |= (immed << IMM_LOW) & IMM_MASK;
313+ }
314 break;
315
316 case INST_TYPE_NONE:
317@@ -2467,7 +2524,7 @@ md_apply_fix (fixS * fixP,
318
319 inst1 = opcode1->bit_sequence;
320 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
321- inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK;
322+ inst1 |= ((val & 0xFFFFFF0000L) >> 16) & IMML_MASK;
323 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64)
324 fixP->fx_r_type = BFD_RELOC_64;
325 if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL)
326@@ -2636,7 +2693,14 @@ md_estimate_size_before_relax (fragS * fragP,
327 }
328 else
329 {
330- fragP->fr_subtype = UNDEFINED_PC_OFFSET;
331+ if (fragP->fr_opcode != NULL) {
332+ if (streq (fragP->fr_opcode, str_microblaze_64))
333+ fragP->fr_subtype = DEFINED_64_PC_OFFSET;
334+ else
335+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
336+ }
337+ else
338+ fragP->fr_subtype = UNDEFINED_PC_OFFSET;
339 fragP->fr_var = INST_WORD_SIZE*2;
340 }
341 break;
342@@ -2913,6 +2977,7 @@ md_parse_option (int c, const char * arg ATTRIBUTE_UNUSED)
343 case OPTION_M64:
344 //if (arg != NULL && strcmp (arg, "64") == 0)
345 microblaze_arch_size = 64;
346+ md_pseudo_table[7].poc_val = 8;
347 break;
348 default:
349 return 0;
350diff --git a/gas/tc.h b/gas/tc.h
351index 4a740f9bdd9..bb9a935a353 100644
352--- a/gas/tc.h
353+++ b/gas/tc.h
354@@ -22,7 +22,7 @@
355 /* In theory (mine, at least!) the machine dependent part of the assembler
356 should only have to include one file. This one. -- JF */
357
358-extern const pseudo_typeS md_pseudo_table[];
359+extern pseudo_typeS md_pseudo_table[];
360
361 const char * md_atof (int, char *, int *);
362 int md_parse_option (int, const char *);
363--
3642.37.1 (Apple Git-137.1)
365