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