summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch')
-rw-r--r--meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch227
1 files changed, 227 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch
new file mode 100644
index 00000000..4c0496c3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/binutils/binutils/0017-Fixed-address-computation-issues-with-64bit-address.patch
@@ -0,0 +1,227 @@
1From a6003437722a8f04c1e31435eb7f9101c50cc292 Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Tue, 9 Oct 2018 10:14:22 +0530
4Subject: [PATCH 17/34] - Fixed address computation issues with 64bit address -
5 Fixed imml dissassamble issue
6
7Conflicts:
8 gas/config/tc-microblaze.c
9 opcodes/microblaze-dis.c
10
11Conflicts:
12 bfd/elf64-microblaze.c
13
14Conflicts:
15 bfd/elf64-microblaze.c
16---
17 bfd/bfd-in2.h | 5 +++
18 bfd/elf64-microblaze.c | 12 +++----
19 gas/config/tc-microblaze.c | 74 +++++++++++++++++++++++++++++++++-----
20 opcodes/microblaze-dis.c | 2 +-
21 4 files changed, 78 insertions(+), 15 deletions(-)
22
23diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
24index 14e228c9c0e..d4b5006902c 100644
25--- a/bfd/bfd-in2.h
26+++ b/bfd/bfd-in2.h
27@@ -5394,6 +5394,11 @@ done here - only used for relaxing */
28 * +done here - only used for relaxing */
29 BFD_RELOC_MICROBLAZE_64,
30
31+/* This is a 64 bit reloc that stores the 32 bit relative
32+ * +value in two words (with an imml instruction). No relocation is
33+ * +done here - only used for relaxing */
34+ BFD_RELOC_MICROBLAZE_EA64,
35+
36 /* This is a 64 bit reloc that stores the 32 bit pc relative
37 * +value in two words (with an imm instruction). No relocation is
38 * +done here - only used for relaxing */
39diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c
40index 6d698383404..f16b544b1fc 100644
41--- a/bfd/elf64-microblaze.c
42+++ b/bfd/elf64-microblaze.c
43@@ -118,14 +118,14 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
44 0, /* Rightshift. */
45 4, /* Size (0 = byte, 1 = short, 2 = long). */
46 64, /* Bitsize. */
47- true, /* PC_relative. */
48+ false, /* PC_relative. */
49 0, /* Bitpos. */
50 complain_overflow_dont, /* Complain on overflow. */
51 bfd_elf_generic_reloc,/* Special Function. */
52 "R_MICROBLAZE_IMML_64", /* Name. */
53 false, /* Partial Inplace. */
54 0, /* Source Mask. */
55- 0x0000ffff, /* Dest Mask. */
56+ 0xffffffffffffff, /* Dest Mask. */
57 false), /* PC relative offset? */
58
59 /* A 64 bit relocation. Table entry not really used. */
60@@ -613,9 +613,9 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
61 case BFD_RELOC_32:
62 microblaze_reloc = R_MICROBLAZE_32;
63 break;
64- /* RVA is treated the same as 32 */
65+ /* RVA is treated the same as 64 */
66 case BFD_RELOC_RVA:
67- microblaze_reloc = R_MICROBLAZE_32;
68+ microblaze_reloc = R_MICROBLAZE_IMML_64;
69 break;
70 case BFD_RELOC_32_PCREL:
71 microblaze_reloc = R_MICROBLAZE_32_PCREL;
72@@ -647,7 +647,7 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
73 case BFD_RELOC_VTABLE_ENTRY:
74 microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY;
75 break;
76- case BFD_RELOC_MICROBLAZE_64:
77+ case BFD_RELOC_MICROBLAZE_EA64:
78 microblaze_reloc = R_MICROBLAZE_IMML_64;
79 break;
80 case BFD_RELOC_MICROBLAZE_64_GOTPC:
81@@ -2050,7 +2050,7 @@ microblaze_elf_relax_section (bfd *abfd,
82 efix = calc_fixup (target_address, 0, sec);
83
84 /* Validate the in-band val. */
85- val = bfd_get_32 (abfd, contents + irel->r_offset);
86+ val = bfd_get_64 (abfd, contents + irel->r_offset);
87 if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
88 fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
89 }
90diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
91index a0e97231a41..d3de049e9c0 100644
92--- a/gas/config/tc-microblaze.c
93+++ b/gas/config/tc-microblaze.c
94@@ -402,7 +402,6 @@ pseudo_typeS md_pseudo_table[] =
95 {"ent", s_func, 0}, /* Treat ent as function entry point. */
96 {"end", microblaze_s_func, 1}, /* Treat end as function end point. */
97 {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */
98- {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */
99 {"weakext", microblaze_s_weakext, 0},
100 {"rodata", microblaze_s_rdata, 0},
101 {"sdata2", microblaze_s_rdata, 1},
102@@ -2483,18 +2482,74 @@ md_apply_fix (fixS * fixP,
103 case BFD_RELOC_RVA:
104 case BFD_RELOC_32_PCREL:
105 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
106+ /* Don't do anything if the symbol is not defined. */
107+ if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
108+ {
109+ if ((fixP->fx_r_type == BFD_RELOC_RVA) && (microblaze_arch_size == 64))
110+ {
111+ if (target_big_endian)
112+ {
113+ buf[0] |= ((val >> 56) & 0xff);
114+ buf[1] |= ((val >> 48) & 0xff);
115+ buf[2] |= ((val >> 40) & 0xff);
116+ buf[3] |= ((val >> 32) & 0xff);
117+ buf[4] |= ((val >> 24) & 0xff);
118+ buf[5] |= ((val >> 16) & 0xff);
119+ buf[6] |= ((val >> 8) & 0xff);
120+ buf[7] |= (val & 0xff);
121+ }
122+ else
123+ {
124+ buf[7] |= ((val >> 56) & 0xff);
125+ buf[6] |= ((val >> 48) & 0xff);
126+ buf[5] |= ((val >> 40) & 0xff);
127+ buf[4] |= ((val >> 32) & 0xff);
128+ buf[3] |= ((val >> 24) & 0xff);
129+ buf[2] |= ((val >> 16) & 0xff);
130+ buf[1] |= ((val >> 8) & 0xff);
131+ buf[0] |= (val & 0xff);
132+ }
133+ }
134+ else {
135+ if (target_big_endian)
136+ {
137+ buf[0] |= ((val >> 24) & 0xff);
138+ buf[1] |= ((val >> 16) & 0xff);
139+ buf[2] |= ((val >> 8) & 0xff);
140+ buf[3] |= (val & 0xff);
141+ }
142+ else
143+ {
144+ buf[3] |= ((val >> 24) & 0xff);
145+ buf[2] |= ((val >> 16) & 0xff);
146+ buf[1] |= ((val >> 8) & 0xff);
147+ buf[0] |= (val & 0xff);
148+ }
149+ }
150+ }
151+ break;
152+
153+ case BFD_RELOC_MICROBLAZE_EA64:
154 /* Don't do anything if the symbol is not defined. */
155 if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy))
156 {
157 if (target_big_endian)
158 {
159- buf[0] |= ((val >> 24) & 0xff);
160- buf[1] |= ((val >> 16) & 0xff);
161- buf[2] |= ((val >> 8) & 0xff);
162- buf[3] |= (val & 0xff);
163+ buf[0] |= ((val >> 56) & 0xff);
164+ buf[1] |= ((val >> 48) & 0xff);
165+ buf[2] |= ((val >> 40) & 0xff);
166+ buf[3] |= ((val >> 32) & 0xff);
167+ buf[4] |= ((val >> 24) & 0xff);
168+ buf[5] |= ((val >> 16) & 0xff);
169+ buf[6] |= ((val >> 8) & 0xff);
170+ buf[7] |= (val & 0xff);
171 }
172 else
173 {
174+ buf[7] |= ((val >> 56) & 0xff);
175+ buf[6] |= ((val >> 48) & 0xff);
176+ buf[5] |= ((val >> 40) & 0xff);
177+ buf[4] |= ((val >> 32) & 0xff);
178 buf[3] |= ((val >> 24) & 0xff);
179 buf[2] |= ((val >> 16) & 0xff);
180 buf[1] |= ((val >> 8) & 0xff);
181@@ -2616,6 +2671,8 @@ md_apply_fix (fixS * fixP,
182 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE;
183 else if (fixP->fx_r_type == BFD_RELOC_32)
184 fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE;
185+ else if(fixP->fx_r_type == BFD_RELOC_MICROBLAZE_EA64)
186+ fixP->fx_r_type = BFD_RELOC_MICROBLAZE_EA64;
187 else
188 fixP->fx_r_type = BFD_RELOC_NONE;
189 fixP->fx_addsy = section_symbol (absolute_section);
190@@ -2887,6 +2944,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
191 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM:
192 case BFD_RELOC_MICROBLAZE_64_GOTPC:
193 case BFD_RELOC_MICROBLAZE_64_GPC:
194+ case BFD_RELOC_MICROBLAZE_EA64:
195 case BFD_RELOC_MICROBLAZE_64:
196 case BFD_RELOC_MICROBLAZE_64_PCREL:
197 case BFD_RELOC_MICROBLAZE_64_GOT:
198@@ -3032,10 +3090,10 @@ cons_fix_new_microblaze (fragS * frag,
199 r = BFD_RELOC_32;
200 break;
201 case 8:
202- if (microblaze_arch_size == 64)
203+ /*if (microblaze_arch_size == 64)
204 r = BFD_RELOC_32;
205- else
206- r = BFD_RELOC_64;
207+ else*/
208+ r = BFD_RELOC_MICROBLAZE_EA64;
209 break;
210 default:
211 as_bad (_("unsupported BFD relocation size %u"), size);
212diff --git a/opcodes/microblaze-dis.c b/opcodes/microblaze-dis.c
213index 921adce04ea..d837ebb38e2 100644
214--- a/opcodes/microblaze-dis.c
215+++ b/opcodes/microblaze-dis.c
216@@ -77,7 +77,7 @@ static char *
217 get_field_imml (struct string_buf *buf, long instr)
218 {
219 char *p = strbuf (buf);
220- sprintf (p, "%d", (short)((instr & IMML_MASK) >> IMM_LOW));
221+ sprintf (p, "%d", (int)((instr & IMML_MASK) >> IMM_LOW));
222 return p;
223 }
224
225--
2262.37.1 (Apple Git-137.1)
227