diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch')
-rw-r--r-- | meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch new file mode 100644 index 00000000..fc5c9464 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0019-Update-MB-x.patch | |||
@@ -0,0 +1,116 @@ | |||
1 | From 0bb779328b8564b008a6134826f043b4326f4904 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nagaraju Mekala <nmekala@xilix.com> | ||
3 | Date: Fri, 28 Sep 2018 12:04:55 +0530 | ||
4 | Subject: [PATCH 19/40] Update MB-x | ||
5 | |||
6 | -Fixed MB-x relocation issues | ||
7 | -Added imml for required MB-x instructions | ||
8 | --- | ||
9 | bfd/elf64-microblaze.c | 68 ++++++++++-- | ||
10 | 3 files changed, 209 insertions(+), 82 deletions(-) | ||
11 | |||
12 | diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c | ||
13 | index d55700fc513..f8f52870639 100644 | ||
14 | --- a/bfd/elf64-microblaze.c | ||
15 | +++ b/bfd/elf64-microblaze.c | ||
16 | @@ -1478,8 +1478,17 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
17 | relocation -= (input_section->output_section->vma | ||
18 | + input_section->output_offset | ||
19 | + offset + INST_WORD_SIZE); | ||
20 | - bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
21 | + unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); | ||
22 | + if (insn == 0xb2000000 || insn == 0xb2ffffff) | ||
23 | + { | ||
24 | + insn &= ~0x00ffffff; | ||
25 | + insn |= (relocation >> 16) & 0xffffff; | ||
26 | + bfd_put_32 (input_bfd, insn, | ||
27 | contents + offset + endian); | ||
28 | + } | ||
29 | + else | ||
30 | + bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
31 | + contents + offset + endian); | ||
32 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
33 | contents + offset + endian + INST_WORD_SIZE); | ||
34 | } | ||
35 | @@ -1569,11 +1578,28 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
36 | else | ||
37 | { | ||
38 | if (r_type == R_MICROBLAZE_64_PCREL) | ||
39 | - relocation -= (input_section->output_section->vma | ||
40 | - + input_section->output_offset | ||
41 | - + offset + INST_WORD_SIZE); | ||
42 | - bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
43 | + { | ||
44 | + if (!input_section->output_section->vma && | ||
45 | + !input_section->output_offset && !offset) | ||
46 | + relocation -= (input_section->output_section->vma | ||
47 | + + input_section->output_offset | ||
48 | + + offset); | ||
49 | + else | ||
50 | + relocation -= (input_section->output_section->vma | ||
51 | + + input_section->output_offset | ||
52 | + + offset + INST_WORD_SIZE); | ||
53 | + } | ||
54 | + unsigned long insn = bfd_get_32 (input_bfd, contents + offset +endian); | ||
55 | + if (insn == 0xb2000000 || insn == 0xb2ffffff) | ||
56 | + { | ||
57 | + insn &= ~0x00ffffff; | ||
58 | + insn |= (relocation >> 16) & 0xffffff; | ||
59 | + bfd_put_32 (input_bfd, insn, | ||
60 | contents + offset + endian); | ||
61 | + } | ||
62 | + else | ||
63 | + bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
64 | + contents + offset + endian); | ||
65 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
66 | contents + offset + endian + INST_WORD_SIZE); | ||
67 | } | ||
68 | @@ -1677,9 +1703,19 @@ static void | ||
69 | microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) | ||
70 | { | ||
71 | unsigned long instr = bfd_get_32 (abfd, bfd_addr); | ||
72 | - instr &= ~0x0000ffff; | ||
73 | - instr |= (val & 0x0000ffff); | ||
74 | - bfd_put_32 (abfd, instr, bfd_addr); | ||
75 | + | ||
76 | + if (instr == 0xb2000000 || instr == 0xb2ffffff) | ||
77 | + { | ||
78 | + instr &= ~0x00ffffff; | ||
79 | + instr |= (val & 0xffffff); | ||
80 | + bfd_put_32 (abfd, instr, bfd_addr); | ||
81 | + } | ||
82 | + else | ||
83 | + { | ||
84 | + instr &= ~0x0000ffff; | ||
85 | + instr |= (val & 0x0000ffff); | ||
86 | + bfd_put_32 (abfd, instr, bfd_addr); | ||
87 | + } | ||
88 | } | ||
89 | |||
90 | /* Read-modify-write into the bfd, an immediate value into appropriate fields of | ||
91 | @@ -1691,10 +1727,18 @@ microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) | ||
92 | unsigned long instr_lo; | ||
93 | |||
94 | instr_hi = bfd_get_32 (abfd, bfd_addr); | ||
95 | - instr_hi &= ~0x0000ffff; | ||
96 | - instr_hi |= ((val >> 16) & 0x0000ffff); | ||
97 | - bfd_put_32 (abfd, instr_hi, bfd_addr); | ||
98 | - | ||
99 | + if (instr_hi == 0xb2000000 || instr_hi == 0xb2ffffff) | ||
100 | + { | ||
101 | + instr_hi &= ~0x00ffffff; | ||
102 | + instr_hi |= (val >> 16) & 0xffffff; | ||
103 | + bfd_put_32 (abfd, instr_hi,bfd_addr); | ||
104 | + } | ||
105 | + else | ||
106 | + { | ||
107 | + instr_hi &= ~0x0000ffff; | ||
108 | + instr_hi |= ((val >> 16) & 0x0000ffff); | ||
109 | + bfd_put_32 (abfd, instr_hi, bfd_addr); | ||
110 | + } | ||
111 | instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE); | ||
112 | instr_lo &= ~0x0000ffff; | ||
113 | instr_lo |= (val & 0x0000ffff); | ||
114 | -- | ||
115 | 2.17.1 | ||
116 | |||