diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch')
-rw-r--r-- | meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch | 353 |
1 files changed, 0 insertions, 353 deletions
diff --git a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch b/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch deleted file mode 100644 index 12e33a85..00000000 --- a/meta-microblaze/recipes-devtools/binutils/binutils/0014-Added-relocations-for-MB-X.patch +++ /dev/null | |||
@@ -1,353 +0,0 @@ | |||
1 | From 4e94c1683a806ac46f3a0d54bfe8f7247d5f0cbd Mon Sep 17 00:00:00 2001 | ||
2 | From: Nagaraju Mekala <nmekala@xilix.com> | ||
3 | Date: Tue, 11 Sep 2018 17:30:17 +0530 | ||
4 | Subject: [PATCH 14/34] Added relocations for MB-X | ||
5 | |||
6 | Conflicts: | ||
7 | bfd/bfd-in2.h | ||
8 | gas/config/tc-microblaze.c | ||
9 | |||
10 | Conflicts: | ||
11 | gas/config/tc-microblaze.c | ||
12 | Upstream-Status: Pending | ||
13 | |||
14 | Signed-off-by: Mark Hatle <mark.hatle@amd.com> | ||
15 | |||
16 | --- | ||
17 | bfd/bfd-in2.h | 9 +++- | ||
18 | bfd/libbfd.h | 4 +- | ||
19 | bfd/reloc.c | 26 ++++++----- | ||
20 | gas/config/tc-microblaze.c | 90 ++++++++++++++++---------------------- | ||
21 | 4 files changed, 61 insertions(+), 68 deletions(-) | ||
22 | |||
23 | diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h | ||
24 | index 6cf701abf10..14e228c9c0e 100644 | ||
25 | --- a/bfd/bfd-in2.h | ||
26 | +++ b/bfd/bfd-in2.h | ||
27 | @@ -5387,13 +5387,18 @@ done here - only used for relaxing */ | ||
28 | /* This is a 64 bit reloc that stores the 32 bit pc relative | ||
29 | value in two words (with an imm instruction). No relocation is | ||
30 | done here - only used for relaxing */ | ||
31 | - BFD_RELOC_MICROBLAZE_64_NONE, | ||
32 | + BFD_RELOC_MICROBLAZE_64_PCREL, | ||
33 | |||
34 | -/* This is a 64 bit reloc that stores the 32 bit pc relative | ||
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_64, | ||
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 | + BFD_RELOC_MICROBLAZE_64_NONE, | ||
44 | + | ||
45 | /* This is a 64 bit reloc that stores the 32 bit pc relative | ||
46 | value in two words (with an imm instruction). The relocation is | ||
47 | PC-relative GOT offset */ | ||
48 | diff --git a/bfd/libbfd.h b/bfd/libbfd.h | ||
49 | index e74c051e781..20086ba608b 100644 | ||
50 | --- a/bfd/libbfd.h | ||
51 | +++ b/bfd/libbfd.h | ||
52 | @@ -2991,14 +2991,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", | ||
53 | "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", | ||
54 | "BFD_RELOC_MICROBLAZE_32_NONE", | ||
55 | "BFD_RELOC_MICROBLAZE_64_NONE", | ||
56 | - "BFD_RELOC_MICROBLAZE_64", | ||
57 | "BFD_RELOC_MICROBLAZE_64_GOTPC", | ||
58 | - "BFD_RELOC_MICROBLAZE_64_GPC", | ||
59 | "BFD_RELOC_MICROBLAZE_64_GOT", | ||
60 | "BFD_RELOC_MICROBLAZE_64_PLT", | ||
61 | "BFD_RELOC_MICROBLAZE_64_GOTOFF", | ||
62 | "BFD_RELOC_MICROBLAZE_32_GOTOFF", | ||
63 | "BFD_RELOC_MICROBLAZE_COPY", | ||
64 | + "BFD_RELOC_MICROBLAZE_64", | ||
65 | + "BFD_RELOC_MICROBLAZE_64_PCREL", | ||
66 | "BFD_RELOC_MICROBLAZE_64_TLS", | ||
67 | "BFD_RELOC_MICROBLAZE_64_TLSGD", | ||
68 | "BFD_RELOC_MICROBLAZE_64_TLSLD", | ||
69 | diff --git a/bfd/reloc.c b/bfd/reloc.c | ||
70 | index 0f99df91299..6165ff3adf1 100644 | ||
71 | --- a/bfd/reloc.c | ||
72 | +++ b/bfd/reloc.c | ||
73 | @@ -6875,24 +6875,12 @@ ENUMDOC | ||
74 | done here - only used for relaxing | ||
75 | ENUM | ||
76 | BFD_RELOC_MICROBLAZE_64_NONE | ||
77 | -ENUMDOC | ||
78 | - This is a 32 bit reloc that stores the 32 bit pc relative | ||
79 | - value in two words (with an imml instruction). No relocation is | ||
80 | - done here - only used for relaxing | ||
81 | -ENUM | ||
82 | - BFD_RELOC_MICROBLAZE_64 | ||
83 | ENUMDOC | ||
84 | This is a 64 bit reloc that stores the 32 bit pc relative | ||
85 | value in two words (with an imm instruction). No relocation is | ||
86 | done here - only used for relaxing | ||
87 | ENUM | ||
88 | BFD_RELOC_MICROBLAZE_64_GOTPC | ||
89 | -ENUMDOC | ||
90 | - This is a 64 bit reloc that stores the 32 bit pc relative | ||
91 | - value in two words (with an imml instruction). No relocation is | ||
92 | - done here - only used for relaxing | ||
93 | -ENUM | ||
94 | - BFD_RELOC_MICROBLAZE_64_GPC | ||
95 | ENUMDOC | ||
96 | This is a 64 bit reloc that stores the 32 bit pc relative | ||
97 | value in two words (with an imm instruction). The relocation is | ||
98 | @@ -6978,6 +6966,20 @@ ENUMDOC | ||
99 | value in two words (with an imm instruction). The relocation is | ||
100 | relative offset from start of TEXT. | ||
101 | |||
102 | + This is a 64 bit reloc that stores 64-bit thread pointer relative offset | ||
103 | + to two words (uses imml instruction). | ||
104 | +ENUM | ||
105 | +BFD_RELOC_MICROBLAZE_64, | ||
106 | +ENUMDOC | ||
107 | + This is a 64 bit reloc that stores the 64 bit pc relative | ||
108 | + value in two words (with an imml instruction). No relocation is | ||
109 | + done here - only used for relaxing | ||
110 | +ENUM | ||
111 | +BFD_RELOC_MICROBLAZE_64_PCREL, | ||
112 | +ENUMDOC | ||
113 | + This is a 32 bit reloc that stores the 32 bit pc relative | ||
114 | + value in two words (with an imml instruction). No relocation is | ||
115 | + done here - only used for relaxing | ||
116 | ENUM | ||
117 | BFD_RELOC_AARCH64_RELOC_START | ||
118 | ENUMDOC | ||
119 | diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c | ||
120 | index a6f12dda54a..9d4dbc12ab3 100644 | ||
121 | --- a/gas/config/tc-microblaze.c | ||
122 | +++ b/gas/config/tc-microblaze.c | ||
123 | @@ -95,6 +95,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; | ||
124 | #define TEXT_OFFSET 17 | ||
125 | #define TEXT_PC_OFFSET 18 | ||
126 | #define DEFINED_64_OFFSET 19 | ||
127 | +#define DEFINED_64_PC_OFFSET 20 | ||
128 | |||
129 | /* Initialize the relax table. */ | ||
130 | const relax_typeS md_relax_table[] = | ||
131 | @@ -119,7 +120,8 @@ const relax_typeS md_relax_table[] = | ||
132 | { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ | ||
133 | { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */ | ||
134 | // { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 16: TLSTPREL_OFFSET. */ | ||
135 | - { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 17: DEFINED_64_OFFSET. */ | ||
136 | + { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 }, /* 19: DEFINED_64_OFFSET. */ | ||
137 | + { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE*2, 0 } /* 20: DEFINED_64_PC_OFFSET. */ | ||
138 | }; | ||
139 | |||
140 | static htab_t opcode_hash_control; /* Opcode mnemonics. */ | ||
141 | @@ -1184,33 +1186,6 @@ md_assemble (char * str) | ||
142 | inst |= (immed << IMM_LOW) & IMM_MASK; | ||
143 | } | ||
144 | } | ||
145 | -#if 0 //revisit | ||
146 | - else if (streq (name, "lli") || streq (name, "sli")) | ||
147 | - { | ||
148 | - temp = immed & 0xFFFFFFFFFFFF8000; | ||
149 | - if ((temp != 0) && (temp != 0xFFFFFFFFFFFF8000)) | ||
150 | - { | ||
151 | - /* Needs an immediate inst. */ | ||
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 | - | ||
159 | - inst1 = opcode1->bit_sequence; | ||
160 | - inst1 |= ((immedl & 0xFFFFFFFFFFFF0000L) >> 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 | - inst |= (reg1 << RD_LOW) & RD_MASK; | ||
168 | - inst |= (reg2 << RA_LOW) & RA_MASK; | ||
169 | - inst |= (immed << IMM_LOW) & IMM_MASK; | ||
170 | - } | ||
171 | -#endif | ||
172 | else | ||
173 | { | ||
174 | temp = immed & 0xFFFF8000; | ||
175 | @@ -1970,8 +1945,8 @@ md_assemble (char * str) | ||
176 | |||
177 | if (exp.X_op != O_constant) | ||
178 | { | ||
179 | - char *opc = NULL; | ||
180 | - //char *opc = str_microblaze_64; | ||
181 | + //char *opc = NULL; | ||
182 | + char *opc = str_microblaze_64; | ||
183 | relax_substateT subtype; | ||
184 | |||
185 | if (exp.X_md != 0) | ||
186 | @@ -2230,13 +2205,19 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, | ||
187 | fragP->fr_fix += INST_WORD_SIZE * 2; | ||
188 | fragP->fr_var = 0; | ||
189 | break; | ||
190 | + case DEFINED_64_PC_OFFSET: | ||
191 | + fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, | ||
192 | + fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_PCREL); | ||
193 | + fragP->fr_fix += INST_WORD_SIZE * 2; | ||
194 | + fragP->fr_var = 0; | ||
195 | + break; | ||
196 | case DEFINED_64_OFFSET: | ||
197 | if (fragP->fr_symbol == GOT_symbol) | ||
198 | fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, | ||
199 | - fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GPC); | ||
200 | + fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64_GPC); | ||
201 | else | ||
202 | fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, | ||
203 | - fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64); | ||
204 | + fragP->fr_offset, false, BFD_RELOC_MICROBLAZE_64); | ||
205 | fragP->fr_fix += INST_WORD_SIZE * 2; | ||
206 | fragP->fr_var = 0; | ||
207 | break; | ||
208 | @@ -2246,7 +2227,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, | ||
209 | fragP->fr_offset, true, BFD_RELOC_MICROBLAZE_64_GOTPC); | ||
210 | else | ||
211 | fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, | ||
212 | - fragP->fr_offset, true, BFD_RELOC_64); | ||
213 | + fragP->fr_offset, false, BFD_RELOC_64); | ||
214 | fragP->fr_fix += INST_WORD_SIZE * 2; | ||
215 | fragP->fr_var = 0; | ||
216 | break; | ||
217 | @@ -2464,14 +2445,17 @@ md_apply_fix (fixS * fixP, | ||
218 | } | ||
219 | } | ||
220 | break; | ||
221 | + | ||
222 | case BFD_RELOC_64_PCREL: | ||
223 | case BFD_RELOC_64: | ||
224 | case BFD_RELOC_MICROBLAZE_64_TEXTREL: | ||
225 | case BFD_RELOC_MICROBLAZE_64: | ||
226 | + case BFD_RELOC_MICROBLAZE_64_PCREL: | ||
227 | /* Add an imm instruction. First save the current instruction. */ | ||
228 | for (i = 0; i < INST_WORD_SIZE; i++) | ||
229 | buf[i + INST_WORD_SIZE] = buf[i]; | ||
230 | - if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
231 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64 | ||
232 | + || fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
233 | { | ||
234 | /* Generate the imm instruction. */ | ||
235 | opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imml"); | ||
236 | @@ -2484,6 +2468,10 @@ md_apply_fix (fixS * fixP, | ||
237 | inst1 = opcode1->bit_sequence; | ||
238 | if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
239 | inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; | ||
240 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
241 | + fixP->fx_r_type = BFD_RELOC_64; | ||
242 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
243 | + fixP->fx_r_type = BFD_RELOC_64_PCREL; | ||
244 | } | ||
245 | else | ||
246 | { | ||
247 | @@ -2494,7 +2482,7 @@ md_apply_fix (fixS * fixP, | ||
248 | as_bad (_("unknown opcode \"%s\""), "imm"); | ||
249 | return; | ||
250 | } | ||
251 | - | ||
252 | + | ||
253 | inst1 = opcode1->bit_sequence; | ||
254 | if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) | ||
255 | inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; | ||
256 | @@ -2542,7 +2530,7 @@ md_apply_fix (fixS * fixP, | ||
257 | opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm"); | ||
258 | if (opcode1 == NULL) | ||
259 | { | ||
260 | - if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) | ||
261 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) | ||
262 | as_bad (_("unknown opcode \"%s\""), "imml"); | ||
263 | else | ||
264 | as_bad (_("unknown opcode \"%s\""), "imm"); | ||
265 | @@ -2569,8 +2557,6 @@ md_apply_fix (fixS * fixP, | ||
266 | moves code around due to relaxing. */ | ||
267 | if (fixP->fx_r_type == BFD_RELOC_64_PCREL) | ||
268 | fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; | ||
269 | - if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
270 | - fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; | ||
271 | else if (fixP->fx_r_type == BFD_RELOC_32) | ||
272 | fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; | ||
273 | else | ||
274 | @@ -2621,33 +2607,24 @@ md_estimate_size_before_relax (fragS * fragP, | ||
275 | if(streq (fragP->fr_opcode, str_microblaze_64)) | ||
276 | { | ||
277 | /* Used as an absolute value. */ | ||
278 | - fragP->fr_subtype = DEFINED_64_OFFSET; | ||
279 | + fragP->fr_subtype = DEFINED_64_PC_OFFSET; | ||
280 | /* Variable part does not change. */ | ||
281 | - fragP->fr_var = INST_WORD_SIZE; | ||
282 | + fragP->fr_var = INST_WORD_SIZE*2; | ||
283 | } | ||
284 | else | ||
285 | { | ||
286 | fragP->fr_subtype = DEFINED_PC_OFFSET; | ||
287 | - /* Don't know now whether we need an imm instruction. */ | ||
288 | + /* Don't know now whether we need an imm instruction. */ | ||
289 | fragP->fr_var = INST_WORD_SIZE; | ||
290 | } | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | fragP->fr_subtype = DEFINED_PC_OFFSET; | ||
295 | - /* Don't know now whether we need an imm instruction. */ | ||
296 | + /* Don't know now whether we need an imm instruction. */ | ||
297 | fragP->fr_var = INST_WORD_SIZE; | ||
298 | } | ||
299 | } | ||
300 | - #if 0 | ||
301 | - else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type && | ||
302 | - !S_IS_WEAK (fragP->fr_symbol)) | ||
303 | - { | ||
304 | - fragP->fr_subtype = DEFINED_PC_OFFSET; | ||
305 | - /* Don't know now whether we need an imm instruction. */ | ||
306 | - fragP->fr_var = INST_WORD_SIZE; | ||
307 | - } | ||
308 | -#endif | ||
309 | else if (S_IS_DEFINED (fragP->fr_symbol) | ||
310 | && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0)) | ||
311 | { | ||
312 | @@ -2677,6 +2654,13 @@ md_estimate_size_before_relax (fragS * fragP, | ||
313 | /* Variable part does not change. */ | ||
314 | fragP->fr_var = INST_WORD_SIZE*2; | ||
315 | } | ||
316 | + else if (streq (fragP->fr_opcode, str_microblaze_64)) | ||
317 | + { | ||
318 | + /* Used as an absolute value. */ | ||
319 | + fragP->fr_subtype = DEFINED_64_OFFSET; | ||
320 | + /* Variable part does not change. */ | ||
321 | + fragP->fr_var = INST_WORD_SIZE; | ||
322 | + } | ||
323 | else if (streq (fragP->fr_opcode, str_microblaze_ro_anchor)) | ||
324 | { | ||
325 | /* It is accessed using the small data read only anchor. */ | ||
326 | @@ -2751,6 +2735,7 @@ md_estimate_size_before_relax (fragS * fragP, | ||
327 | case TLSTPREL_OFFSET: | ||
328 | case TLSDTPREL_OFFSET: | ||
329 | case DEFINED_64_OFFSET: | ||
330 | + case DEFINED_64_PC_OFFSET: | ||
331 | fragP->fr_var = INST_WORD_SIZE*2; | ||
332 | break; | ||
333 | case DEFINED_RO_SEGMENT: | ||
334 | @@ -2804,7 +2789,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) | ||
335 | else | ||
336 | { | ||
337 | /* The case where we are going to resolve things... */ | ||
338 | - if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) | ||
339 | + if (fixp->fx_r_type == BFD_RELOC_64_PCREL ||fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64_PCREL) | ||
340 | return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; | ||
341 | else | ||
342 | return fixp->fx_where + fixp->fx_frag->fr_address; | ||
343 | @@ -2839,6 +2824,7 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) | ||
344 | case BFD_RELOC_MICROBLAZE_64_GOTPC: | ||
345 | case BFD_RELOC_MICROBLAZE_64_GPC: | ||
346 | case BFD_RELOC_MICROBLAZE_64: | ||
347 | + case BFD_RELOC_MICROBLAZE_64_PCREL: | ||
348 | case BFD_RELOC_MICROBLAZE_64_GOT: | ||
349 | case BFD_RELOC_MICROBLAZE_64_PLT: | ||
350 | case BFD_RELOC_MICROBLAZE_64_GOTOFF: | ||
351 | -- | ||
352 | 2.37.1 (Apple Git-137.1) | ||
353 | |||