Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 1 | From 49a85544705ec3057f0a1f32807b7b986127cec1 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 2 | From: Nagaraju Mekala <nmekala@xilix.com> |
| 3 | Date: Sun, 30 Sep 2018 16:31:26 +0530 |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 16/40] MB-X initial commit code cleanup is needed. |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 5 | |
| 6 | --- |
| 7 | bfd/bfd-in2.h | 10 +++ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 8 | bfd/elf32-microblaze.c | 63 +++++++++++++++++- |
| 9 | bfd/elf64-microblaze.c | 59 +++++++++++++++++ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 10 | bfd/libbfd.h | 2 + |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 11 | bfd/reloc.c | 12 ++++ |
| 12 | gas/config/tc-microblaze.c | 127 +++++++++++++++++++++++++++---------- |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 13 | include/elf/microblaze.h | 2 + |
| 14 | opcodes/microblaze-opc.h | 4 +- |
| 15 | opcodes/microblaze-opcm.h | 4 +- |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 16 | 9 files changed, 243 insertions(+), 40 deletions(-) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 17 | |
| 18 | diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 19 | index 3fdbf8ed755..c55092c9ec7 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 20 | --- a/bfd/bfd-in2.h |
| 21 | +++ b/bfd/bfd-in2.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 22 | @@ -5438,11 +5438,21 @@ value in two words (with an imm instruction). No relocation is |
| 23 | done here - only used for relaxing */ |
| 24 | BFD_RELOC_MICROBLAZE_64_NONE, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 25 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 26 | +/* This is a 64 bit reloc that stores the 32 bit pc relative |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 27 | +value in two words (with an imml instruction). No relocation is |
| 28 | +done here - only used for relaxing */ |
| 29 | + BFD_RELOC_MICROBLAZE_64, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 30 | + |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 31 | /* This is a 64 bit reloc that stores the 32 bit pc relative |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 32 | value in two words (with an imm instruction). The relocation is |
| 33 | PC-relative GOT offset */ |
| 34 | BFD_RELOC_MICROBLAZE_64_GOTPC, |
| 35 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 36 | +/* This is a 64 bit reloc that stores the 32 bit pc relative |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 37 | +value in two words (with an imml instruction). The relocation is |
| 38 | +PC-relative GOT offset */ |
| 39 | + BFD_RELOC_MICROBLAZE_64_GPC, |
| 40 | + |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 41 | /* This is a 64 bit reloc that stores the 32 bit pc relative |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 42 | value in two words (with an imm instruction). The relocation is |
| 43 | GOT offset */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 44 | diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 45 | index cf4a7fdba33..e1a66f57e79 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 46 | --- a/bfd/elf32-microblaze.c |
| 47 | +++ b/bfd/elf32-microblaze.c |
| 48 | @@ -116,6 +116,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] = |
| 49 | 0x0000ffff, /* Dest Mask. */ |
| 50 | TRUE), /* PC relative offset? */ |
| 51 | |
| 52 | + HOWTO (R_MICROBLAZE_IMML_64, /* Type. */ |
| 53 | + 0, /* Rightshift. */ |
| 54 | + 2, /* Size (0 = byte, 1 = short, 2 = long). */ |
| 55 | + 16, /* Bitsize. */ |
| 56 | + TRUE, /* PC_relative. */ |
| 57 | + 0, /* Bitpos. */ |
| 58 | + complain_overflow_dont, /* Complain on overflow. */ |
| 59 | + bfd_elf_generic_reloc,/* Special Function. */ |
| 60 | + "R_MICROBLAZE_IMML_64", /* Name. */ |
| 61 | + FALSE, /* Partial Inplace. */ |
| 62 | + 0, /* Source Mask. */ |
| 63 | + 0x0000ffff, /* Dest Mask. */ |
| 64 | + FALSE), /* PC relative offset? */ |
| 65 | + |
| 66 | /* A 64 bit relocation. Table entry not really used. */ |
| 67 | HOWTO (R_MICROBLAZE_64, /* Type. */ |
| 68 | 0, /* Rightshift. */ |
| 69 | @@ -280,6 +294,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = |
| 70 | 0x0000ffff, /* Dest Mask. */ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 71 | TRUE), /* PC relative offset? */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 72 | |
| 73 | + /* A 64 bit GOTPC relocation. Table-entry not really used. */ |
| 74 | + HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ |
| 75 | + 0, /* Rightshift. */ |
| 76 | + 2, /* Size (0 = byte, 1 = short, 2 = long). */ |
| 77 | + 16, /* Bitsize. */ |
| 78 | + TRUE, /* PC_relative. */ |
| 79 | + 0, /* Bitpos. */ |
| 80 | + complain_overflow_dont, /* Complain on overflow. */ |
| 81 | + bfd_elf_generic_reloc, /* Special Function. */ |
| 82 | + "R_MICROBLAZE_GPC_64", /* Name. */ |
| 83 | + FALSE, /* Partial Inplace. */ |
| 84 | + 0, /* Source Mask. */ |
| 85 | + 0x0000ffff, /* Dest Mask. */ |
| 86 | + TRUE), /* PC relative offset? */ |
| 87 | + |
| 88 | /* A 64 bit GOT relocation. Table-entry not really used. */ |
| 89 | HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ |
| 90 | 0, /* Rightshift. */ |
| 91 | @@ -619,9 +648,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, |
| 92 | case BFD_RELOC_VTABLE_ENTRY: |
| 93 | microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; |
| 94 | break; |
| 95 | + case BFD_RELOC_MICROBLAZE_64: |
| 96 | + microblaze_reloc = R_MICROBLAZE_IMML_64; |
| 97 | + break; |
| 98 | case BFD_RELOC_MICROBLAZE_64_GOTPC: |
| 99 | microblaze_reloc = R_MICROBLAZE_GOTPC_64; |
| 100 | break; |
| 101 | + case BFD_RELOC_MICROBLAZE_64_GPC: |
| 102 | + microblaze_reloc = R_MICROBLAZE_GPC_64; |
| 103 | + break; |
| 104 | case BFD_RELOC_MICROBLAZE_64_GOT: |
| 105 | microblaze_reloc = R_MICROBLAZE_GOT_64; |
| 106 | break; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 107 | @@ -1929,6 +1964,28 @@ microblaze_elf_relax_section (bfd *abfd, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 108 | irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); |
| 109 | } |
| 110 | break; |
| 111 | + case R_MICROBLAZE_IMML_64: |
| 112 | + { |
| 113 | + /* This was a PC-relative instruction that was |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 114 | + completely resolved. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 115 | + int sfix, efix; |
| 116 | + unsigned int val; |
| 117 | + bfd_vma target_address; |
| 118 | + target_address = irel->r_addend + irel->r_offset; |
| 119 | + sfix = calc_fixup (irel->r_offset, 0, sec); |
| 120 | + efix = calc_fixup (target_address, 0, sec); |
| 121 | + |
| 122 | + /* Validate the in-band val. */ |
| 123 | + val = bfd_get_32 (abfd, contents + irel->r_offset); |
| 124 | + if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { |
| 125 | + fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); |
| 126 | + } |
| 127 | + irel->r_addend -= (efix - sfix); |
| 128 | + /* Should use HOWTO. */ |
| 129 | + microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, |
| 130 | + irel->r_addend); |
| 131 | + } |
| 132 | + break; |
| 133 | case R_MICROBLAZE_NONE: |
| 134 | case R_MICROBLAZE_32_NONE: |
| 135 | { |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 136 | @@ -2034,9 +2091,9 @@ microblaze_elf_relax_section (bfd *abfd, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 137 | microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, |
| 138 | irelscan->r_addend); |
| 139 | } |
| 140 | - if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) |
| 141 | - { |
| 142 | - isym = isymbuf + ELF32_R_SYM (irelscan->r_info); |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 143 | + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) |
| 144 | + { |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 145 | + isym = isymbuf + ELF32_R_SYM (irelscan->r_info); |
| 146 | |
| 147 | /* Look at the reloc only if the value has been resolved. */ |
| 148 | if (isym->st_shndx == shndx |
| 149 | diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 150 | index fa4b95e47e0..d55700fc513 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 151 | --- a/bfd/elf64-microblaze.c |
| 152 | +++ b/bfd/elf64-microblaze.c |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 153 | @@ -116,6 +116,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = |
| 154 | 0x0000ffff, /* Dest Mask. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 155 | TRUE), /* PC relative offset? */ |
| 156 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 157 | + /* A 64 bit relocation. Table entry not really used. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 158 | + HOWTO (R_MICROBLAZE_IMML_64, /* Type. */ |
| 159 | + 0, /* Rightshift. */ |
| 160 | + 4, /* Size (0 = byte, 1 = short, 2 = long). */ |
| 161 | + 64, /* Bitsize. */ |
| 162 | + TRUE, /* PC_relative. */ |
| 163 | + 0, /* Bitpos. */ |
| 164 | + complain_overflow_dont, /* Complain on overflow. */ |
| 165 | + bfd_elf_generic_reloc,/* Special Function. */ |
| 166 | + "R_MICROBLAZE_IMML_64", /* Name. */ |
| 167 | + FALSE, /* Partial Inplace. */ |
| 168 | + 0, /* Source Mask. */ |
| 169 | + 0x0000ffff, /* Dest Mask. */ |
| 170 | + TRUE), /* PC relative offset? */ |
| 171 | + |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 172 | /* A 64 bit relocation. Table entry not really used. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 173 | HOWTO (R_MICROBLAZE_64, /* Type. */ |
| 174 | 0, /* Rightshift. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 175 | @@ -265,6 +280,21 @@ static reloc_howto_type microblaze_elf_howto_raw[] = |
| 176 | 0x0000ffff, /* Dest Mask. */ |
| 177 | TRUE), /* PC relative offset? */ |
| 178 | |
| 179 | + /* A 64 bit GOTPC relocation. Table-entry not really used. */ |
| 180 | + HOWTO (R_MICROBLAZE_GPC_64, /* Type. */ |
| 181 | + 0, /* Rightshift. */ |
| 182 | + 2, /* Size (0 = byte, 1 = short, 2 = long). */ |
| 183 | + 16, /* Bitsize. */ |
| 184 | + TRUE, /* PC_relative. */ |
| 185 | + 0, /* Bitpos. */ |
| 186 | + complain_overflow_dont, /* Complain on overflow. */ |
| 187 | + bfd_elf_generic_reloc, /* Special Function. */ |
| 188 | + "R_MICROBLAZE_GPC_64", /* Name. */ |
| 189 | + FALSE, /* Partial Inplace. */ |
| 190 | + 0, /* Source Mask. */ |
| 191 | + 0x0000ffff, /* Dest Mask. */ |
| 192 | + TRUE), /* PC relative offset? */ |
| 193 | + |
| 194 | /* A 64 bit GOT relocation. Table-entry not really used. */ |
| 195 | HOWTO (R_MICROBLAZE_GOT_64, /* Type. */ |
| 196 | 0, /* Rightshift. */ |
| 197 | @@ -589,9 +619,15 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, |
| 198 | case BFD_RELOC_VTABLE_ENTRY: |
| 199 | microblaze_reloc = R_MICROBLAZE_GNU_VTENTRY; |
| 200 | break; |
| 201 | + case BFD_RELOC_MICROBLAZE_64: |
| 202 | + microblaze_reloc = R_MICROBLAZE_IMML_64; |
| 203 | + break; |
| 204 | case BFD_RELOC_MICROBLAZE_64_GOTPC: |
| 205 | microblaze_reloc = R_MICROBLAZE_GOTPC_64; |
| 206 | break; |
| 207 | + case BFD_RELOC_MICROBLAZE_64_GPC: |
| 208 | + microblaze_reloc = R_MICROBLAZE_GPC_64; |
| 209 | + break; |
| 210 | case BFD_RELOC_MICROBLAZE_64_GOT: |
| 211 | microblaze_reloc = R_MICROBLAZE_GOT_64; |
| 212 | break; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 213 | @@ -1162,6 +1198,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 214 | break; /* Do nothing. */ |
| 215 | |
| 216 | case (int) R_MICROBLAZE_GOTPC_64: |
| 217 | + case (int) R_MICROBLAZE_GPC_64: |
| 218 | relocation = htab->sgotplt->output_section->vma |
| 219 | + htab->sgotplt->output_offset; |
| 220 | relocation -= (input_section->output_section->vma |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 221 | @@ -1863,6 +1900,28 @@ microblaze_elf_relax_section (bfd *abfd, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 222 | irel->r_addend -= calc_fixup (irel->r_addend, 0, sec); |
| 223 | } |
| 224 | break; |
| 225 | + case R_MICROBLAZE_IMML_64: |
| 226 | + { |
| 227 | + /* This was a PC-relative instruction that was |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 228 | + completely resolved. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 229 | + int sfix, efix; |
| 230 | + unsigned int val; |
| 231 | + bfd_vma target_address; |
| 232 | + target_address = irel->r_addend + irel->r_offset; |
| 233 | + sfix = calc_fixup (irel->r_offset, 0, sec); |
| 234 | + efix = calc_fixup (target_address, 0, sec); |
| 235 | + |
| 236 | + /* Validate the in-band val. */ |
| 237 | + val = bfd_get_32 (abfd, contents + irel->r_offset); |
| 238 | + if (val != irel->r_addend && ELF64_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) { |
| 239 | + fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend); |
| 240 | + } |
| 241 | + irel->r_addend -= (efix - sfix); |
| 242 | + /* Should use HOWTO. */ |
| 243 | + microblaze_bfd_write_imm_value_64 (abfd, contents + irel->r_offset, |
| 244 | + irel->r_addend); |
| 245 | + } |
| 246 | + break; |
| 247 | case R_MICROBLAZE_NONE: |
| 248 | case R_MICROBLAZE_32_NONE: |
| 249 | { |
| 250 | diff --git a/bfd/libbfd.h b/bfd/libbfd.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 251 | index c1551b92405..b4aace6a70d 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 252 | --- a/bfd/libbfd.h |
| 253 | +++ b/bfd/libbfd.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 254 | @@ -2969,7 +2969,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 255 | "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM", |
| 256 | "BFD_RELOC_MICROBLAZE_32_NONE", |
| 257 | "BFD_RELOC_MICROBLAZE_64_NONE", |
| 258 | + "BFD_RELOC_MICROBLAZE_64", |
| 259 | "BFD_RELOC_MICROBLAZE_64_GOTPC", |
| 260 | + "BFD_RELOC_MICROBLAZE_64_GPC", |
| 261 | "BFD_RELOC_MICROBLAZE_64_GOT", |
| 262 | "BFD_RELOC_MICROBLAZE_64_PLT", |
| 263 | "BFD_RELOC_MICROBLAZE_64_GOTOFF", |
| 264 | diff --git a/bfd/reloc.c b/bfd/reloc.c |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 265 | index 9b39b419415..0e8a24e9cb0 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 266 | --- a/bfd/reloc.c |
| 267 | +++ b/bfd/reloc.c |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 268 | @@ -6866,12 +6866,24 @@ ENUMDOC |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 269 | done here - only used for relaxing |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 270 | ENUM |
| 271 | BFD_RELOC_MICROBLAZE_64_NONE |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 272 | +ENUMDOC |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 273 | + This is a 32 bit reloc that stores the 32 bit pc relative |
| 274 | + value in two words (with an imml instruction). No relocation is |
| 275 | + done here - only used for relaxing |
| 276 | +ENUM |
| 277 | + BFD_RELOC_MICROBLAZE_64 |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 278 | ENUMDOC |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 279 | This is a 64 bit reloc that stores the 32 bit pc relative |
| 280 | value in two words (with an imm instruction). No relocation is |
| 281 | done here - only used for relaxing |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 282 | ENUM |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 283 | BFD_RELOC_MICROBLAZE_64_GOTPC |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 284 | +ENUMDOC |
| 285 | + This is a 64 bit reloc that stores the 32 bit pc relative |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 286 | + value in two words (with an imml instruction). No relocation is |
| 287 | + done here - only used for relaxing |
| 288 | +ENUM |
| 289 | + BFD_RELOC_MICROBLAZE_64_GPC |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 290 | ENUMDOC |
| 291 | This is a 64 bit reloc that stores the 32 bit pc relative |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 292 | value in two words (with an imm instruction). The relocation is |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 293 | diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 294 | index ffbb843d33e..b8250e4cded 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 295 | --- a/gas/config/tc-microblaze.c |
| 296 | +++ b/gas/config/tc-microblaze.c |
| 297 | @@ -94,6 +94,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; |
| 298 | #define TLSTPREL_OFFSET 16 |
| 299 | #define TEXT_OFFSET 17 |
| 300 | #define TEXT_PC_OFFSET 18 |
| 301 | +#define DEFINED_64_OFFSET 19 |
| 302 | |
| 303 | /* Initialize the relax table. */ |
| 304 | const relax_typeS md_relax_table[] = |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 305 | @@ -116,7 +117,8 @@ const relax_typeS md_relax_table[] = |
| 306 | { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 15: TLSGOTTPREL_OFFSET. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 307 | { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 16: TLSTPREL_OFFSET. */ |
| 308 | { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 17: TEXT_OFFSET. */ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 309 | - { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */ |
| 310 | + { 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 }, /* 18: TEXT_PC_OFFSET. */ |
| 311 | + { 0x7fffffffffffffff, 0x8000000000000000, INST_WORD_SIZE, 0 } /* 19: DEFINED_64_OFFSET. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 312 | }; |
| 313 | |
| 314 | static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 315 | @@ -396,7 +398,8 @@ const pseudo_typeS md_pseudo_table[] = |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 316 | {"data32", cons, 4}, /* Same as word. */ |
| 317 | {"ent", s_func, 0}, /* Treat ent as function entry point. */ |
| 318 | {"end", microblaze_s_func, 1}, /* Treat end as function end point. */ |
| 319 | - {"gpword", s_rva, 4}, /* gpword label => store resolved label address in data section. */ |
| 320 | + {"gpword", s_rva, 8}, /* gpword label => store resolved label address in data section. */ |
| 321 | + {"gpdword", s_rva, 8}, /* gpword label => store resolved label address in data section. */ |
| 322 | {"weakext", microblaze_s_weakext, 0}, |
| 323 | {"rodata", microblaze_s_rdata, 0}, |
| 324 | {"sdata2", microblaze_s_rdata, 1}, |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 325 | @@ -405,6 +408,7 @@ const pseudo_typeS md_pseudo_table[] = |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 326 | {"sbss", microblaze_s_bss, 1}, |
| 327 | {"text", microblaze_s_text, 0}, |
| 328 | {"word", cons, 4}, |
| 329 | + {"dword", cons, 8}, |
| 330 | {"frame", s_ignore, 0}, |
| 331 | {"mask", s_ignore, 0}, /* Emitted by gcc. */ |
| 332 | {NULL, NULL, 0} |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 333 | @@ -898,7 +902,7 @@ check_got (int * got_type, int * got_len) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 334 | extern bfd_reloc_code_real_type |
| 335 | parse_cons_expression_microblaze (expressionS *exp, int size) |
| 336 | { |
| 337 | - if (size == 4) |
| 338 | + if (size == 4 || (microblaze_arch_size == 64 && size == 8)) |
| 339 | { |
| 340 | /* Handle @GOTOFF et.al. */ |
| 341 | char *save, *gotfree_copy; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 342 | @@ -930,6 +934,7 @@ parse_cons_expression_microblaze (expressionS *exp, int size) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 343 | |
| 344 | static const char * str_microblaze_ro_anchor = "RO"; |
| 345 | static const char * str_microblaze_rw_anchor = "RW"; |
| 346 | +static const char * str_microblaze_64 = "64"; |
| 347 | |
| 348 | static bfd_boolean |
| 349 | check_spl_reg (unsigned * reg) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 350 | @@ -1926,6 +1931,7 @@ md_assemble (char * str) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 351 | if (exp.X_op != O_constant) |
| 352 | { |
| 353 | char *opc = NULL; |
| 354 | + //char *opc = str_microblaze_64; |
| 355 | relax_substateT subtype; |
| 356 | |
| 357 | if (exp.X_md != 0) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 358 | @@ -1939,7 +1945,7 @@ md_assemble (char * str) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 359 | subtype, /* PC-relative or not. */ |
| 360 | exp.X_add_symbol, |
| 361 | exp.X_add_number, |
| 362 | - opc); |
| 363 | + (char *) opc); |
| 364 | immedl = 0L; |
| 365 | } |
| 366 | else |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 367 | @@ -1977,7 +1983,7 @@ md_assemble (char * str) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 368 | reg1 = 0; |
| 369 | } |
| 370 | if (strcmp (op_end, "")) |
| 371 | - op_end = parse_imml (op_end + 1, & exp, MIN_IMM, MAX_IMM); |
| 372 | + op_end = parse_imml (op_end + 1, & exp, MIN_IMML, MAX_IMML); |
| 373 | else |
| 374 | as_fatal (_("Error in statement syntax")); |
| 375 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 376 | @@ -1987,7 +1993,8 @@ md_assemble (char * str) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 377 | |
| 378 | if (exp.X_op != O_constant) |
| 379 | { |
| 380 | - char *opc = NULL; |
| 381 | + //char *opc = NULL; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 382 | + char *opc = strdup(str_microblaze_64); |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 383 | relax_substateT subtype; |
| 384 | |
| 385 | if (exp.X_md != 0) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 386 | @@ -2001,14 +2008,13 @@ md_assemble (char * str) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 387 | subtype, /* PC-relative or not. */ |
| 388 | exp.X_add_symbol, |
| 389 | exp.X_add_number, |
| 390 | - opc); |
| 391 | + (char *) opc); |
| 392 | immedl = 0L; |
| 393 | } |
| 394 | else |
| 395 | { |
| 396 | output = frag_more (isize); |
| 397 | immedl = exp.X_add_number; |
| 398 | - |
| 399 | opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); |
| 400 | if (opcode1 == NULL) |
| 401 | { |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 402 | @@ -2184,13 +2190,23 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 403 | fragP->fr_fix += INST_WORD_SIZE * 2; |
| 404 | fragP->fr_var = 0; |
| 405 | break; |
| 406 | + case DEFINED_64_OFFSET: |
| 407 | + if (fragP->fr_symbol == GOT_symbol) |
| 408 | + fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, |
| 409 | + fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GPC); |
| 410 | + else |
| 411 | + fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE, fragP->fr_symbol, |
| 412 | + fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64); |
| 413 | + fragP->fr_fix += INST_WORD_SIZE * 2; |
| 414 | + fragP->fr_var = 0; |
| 415 | + break; |
| 416 | case DEFINED_ABS_SEGMENT: |
| 417 | if (fragP->fr_symbol == GOT_symbol) |
| 418 | fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, |
| 419 | fragP->fr_offset, TRUE, BFD_RELOC_MICROBLAZE_64_GOTPC); |
| 420 | else |
| 421 | fix_new (fragP, fragP->fr_fix, INST_WORD_SIZE * 2, fragP->fr_symbol, |
| 422 | - fragP->fr_offset, FALSE, BFD_RELOC_64); |
| 423 | + fragP->fr_offset, TRUE, BFD_RELOC_64); |
| 424 | fragP->fr_fix += INST_WORD_SIZE * 2; |
| 425 | fragP->fr_var = 0; |
| 426 | break; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 427 | @@ -2412,22 +2428,38 @@ md_apply_fix (fixS * fixP, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 428 | case BFD_RELOC_64_PCREL: |
| 429 | case BFD_RELOC_64: |
| 430 | case BFD_RELOC_MICROBLAZE_64_TEXTREL: |
| 431 | + case BFD_RELOC_MICROBLAZE_64: |
| 432 | /* Add an imm instruction. First save the current instruction. */ |
| 433 | for (i = 0; i < INST_WORD_SIZE; i++) |
| 434 | buf[i + INST_WORD_SIZE] = buf[i]; |
| 435 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) |
| 436 | + { |
| 437 | + /* Generate the imm instruction. */ |
| 438 | + opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); |
| 439 | + if (opcode1 == NULL) |
| 440 | + { |
| 441 | + as_bad (_("unknown opcode \"%s\""), "imml"); |
| 442 | + return; |
| 443 | + } |
| 444 | |
| 445 | - /* Generate the imm instruction. */ |
| 446 | - opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); |
| 447 | - if (opcode1 == NULL) |
| 448 | - { |
| 449 | - as_bad (_("unknown opcode \"%s\""), "imm"); |
| 450 | - return; |
| 451 | - } |
| 452 | - |
| 453 | - inst1 = opcode1->bit_sequence; |
| 454 | - if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) |
| 455 | - inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; |
| 456 | - |
| 457 | + inst1 = opcode1->bit_sequence; |
| 458 | + if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) |
| 459 | + inst1 |= ((val & 0xFFFFFFFFFFFF0000L) >> 16) & IMML_MASK; |
| 460 | + } |
| 461 | + else |
| 462 | + { |
| 463 | + /* Generate the imm instruction. */ |
| 464 | + opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); |
| 465 | + if (opcode1 == NULL) |
| 466 | + { |
| 467 | + as_bad (_("unknown opcode \"%s\""), "imm"); |
| 468 | + return; |
| 469 | + } |
| 470 | + |
| 471 | + inst1 = opcode1->bit_sequence; |
| 472 | + if (fixP->fx_addsy == NULL || S_IS_DEFINED (fixP->fx_addsy)) |
| 473 | + inst1 |= ((val & 0xFFFF0000) >> 16) & IMM_MASK; |
| 474 | + } |
| 475 | buf[0] = INST_BYTE0 (inst1); |
| 476 | buf[1] = INST_BYTE1 (inst1); |
| 477 | buf[2] = INST_BYTE2 (inst1); |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 478 | @@ -2456,6 +2488,7 @@ md_apply_fix (fixS * fixP, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 479 | /* Fall through. */ |
| 480 | |
| 481 | case BFD_RELOC_MICROBLAZE_64_GOTPC: |
| 482 | + case BFD_RELOC_MICROBLAZE_64_GPC: |
| 483 | case BFD_RELOC_MICROBLAZE_64_GOT: |
| 484 | case BFD_RELOC_MICROBLAZE_64_PLT: |
| 485 | case BFD_RELOC_MICROBLAZE_64_GOTOFF: |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 486 | @@ -2463,12 +2496,16 @@ md_apply_fix (fixS * fixP, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 487 | /* Add an imm instruction. First save the current instruction. */ |
| 488 | for (i = 0; i < INST_WORD_SIZE; i++) |
| 489 | buf[i + INST_WORD_SIZE] = buf[i]; |
| 490 | - |
| 491 | - /* Generate the imm instruction. */ |
| 492 | - opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); |
| 493 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) |
| 494 | + opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imml"); |
| 495 | + else |
| 496 | + opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm"); |
| 497 | if (opcode1 == NULL) |
| 498 | { |
| 499 | - as_bad (_("unknown opcode \"%s\""), "imm"); |
| 500 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64_GPC) |
| 501 | + as_bad (_("unknown opcode \"%s\""), "imml"); |
| 502 | + else |
| 503 | + as_bad (_("unknown opcode \"%s\""), "imm"); |
| 504 | return; |
| 505 | } |
| 506 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 507 | @@ -2490,7 +2527,7 @@ md_apply_fix (fixS * fixP, |
| 508 | { |
| 509 | /* This fixup has been resolved. Create a reloc in case the linker |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 510 | moves code around due to relaxing. */ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 511 | - if (fixP->fx_r_type == BFD_RELOC_64_PCREL) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 512 | + if (fixP->fx_r_type == BFD_RELOC_MICROBLAZE_64) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 513 | fixP->fx_r_type = BFD_RELOC_MICROBLAZE_64_NONE; |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 514 | else if (fixP->fx_r_type == BFD_RELOC_32) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 515 | fixP->fx_r_type = BFD_RELOC_MICROBLAZE_32_NONE; |
| 516 | @@ -2535,12 +2572,30 @@ md_estimate_size_before_relax (fragS * fragP, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 517 | as_bad (_("Absolute PC-relative value in relaxation code. Assembler error.....")); |
| 518 | abort (); |
| 519 | } |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 520 | - else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type && |
| 521 | - !S_IS_WEAK (fragP->fr_symbol)) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 522 | + else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type |
| 523 | + && !S_IS_WEAK (fragP->fr_symbol)) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 524 | { |
| 525 | - fragP->fr_subtype = DEFINED_PC_OFFSET; |
| 526 | - /* Don't know now whether we need an imm instruction. */ |
| 527 | - fragP->fr_var = INST_WORD_SIZE; |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 528 | + if (fragP->fr_opcode != NULL) { |
| 529 | + if(streq (fragP->fr_opcode, str_microblaze_64)) |
| 530 | + { |
| 531 | + /* Used as an absolute value. */ |
| 532 | + fragP->fr_subtype = DEFINED_64_OFFSET; |
| 533 | + /* Variable part does not change. */ |
| 534 | + fragP->fr_var = INST_WORD_SIZE; |
| 535 | + } |
| 536 | + else |
| 537 | + { |
| 538 | + fragP->fr_subtype = DEFINED_PC_OFFSET; |
| 539 | + /* Don't know now whether we need an imm instruction. */ |
| 540 | + fragP->fr_var = INST_WORD_SIZE; |
| 541 | + } |
| 542 | + } |
| 543 | + else |
| 544 | + { |
| 545 | + fragP->fr_subtype = DEFINED_PC_OFFSET; |
| 546 | + /* Don't know now whether we need an imm instruction. */ |
| 547 | + fragP->fr_var = INST_WORD_SIZE; |
| 548 | + } |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 549 | } |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 550 | else if (S_IS_DEFINED (fragP->fr_symbol) |
| 551 | && (((S_GET_SEGMENT (fragP->fr_symbol))->flags & SEC_CODE) == 0)) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 552 | @@ -2644,6 +2699,7 @@ md_estimate_size_before_relax (fragS * fragP, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 553 | case TLSLD_OFFSET: |
| 554 | case TLSTPREL_OFFSET: |
| 555 | case TLSDTPREL_OFFSET: |
| 556 | + case DEFINED_64_OFFSET: |
| 557 | fragP->fr_var = INST_WORD_SIZE*2; |
| 558 | break; |
| 559 | case DEFINED_RO_SEGMENT: |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 560 | @@ -2697,7 +2753,7 @@ md_pcrel_from_section (fixS * fixp, segT sec ATTRIBUTE_UNUSED) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 561 | else |
| 562 | { |
| 563 | /* The case where we are going to resolve things... */ |
| 564 | - if (fixp->fx_r_type == BFD_RELOC_64_PCREL) |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 565 | + if (fixp->fx_r_type == BFD_RELOC_64_PCREL || fixp->fx_r_type == BFD_RELOC_MICROBLAZE_64) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 566 | return fixp->fx_where + fixp->fx_frag->fr_address + INST_WORD_SIZE; |
| 567 | else |
| 568 | return fixp->fx_where + fixp->fx_frag->fr_address; |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 569 | @@ -2730,6 +2786,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 570 | case BFD_RELOC_MICROBLAZE_32_RWSDA: |
| 571 | case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM: |
| 572 | case BFD_RELOC_MICROBLAZE_64_GOTPC: |
| 573 | + case BFD_RELOC_MICROBLAZE_64_GPC: |
| 574 | + case BFD_RELOC_MICROBLAZE_64: |
| 575 | case BFD_RELOC_MICROBLAZE_64_GOT: |
| 576 | case BFD_RELOC_MICROBLAZE_64_PLT: |
| 577 | case BFD_RELOC_MICROBLAZE_64_GOTOFF: |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 578 | @@ -2872,7 +2930,10 @@ cons_fix_new_microblaze (fragS * frag, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 579 | r = BFD_RELOC_32; |
| 580 | break; |
| 581 | case 8: |
| 582 | - r = BFD_RELOC_64; |
| 583 | + if (microblaze_arch_size == 64) |
| 584 | + r = BFD_RELOC_32; |
| 585 | + else |
| 586 | + r = BFD_RELOC_64; |
| 587 | break; |
| 588 | default: |
| 589 | as_bad (_("unsupported BFD relocation size %u"), size); |
| 590 | diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 591 | index 55f34f72b0d..8576e55cb8a 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 592 | --- a/include/elf/microblaze.h |
| 593 | +++ b/include/elf/microblaze.h |
| 594 | @@ -62,6 +62,8 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type) |
| 595 | RELOC_NUMBER (R_MICROBLAZE_TEXTREL_64, 31) /* TEXT Entry offset 64-bit. */ |
| 596 | RELOC_NUMBER (R_MICROBLAZE_TEXTREL_32_LO, 32) /* TEXT Entry offset 32-bit. */ |
| 597 | RELOC_NUMBER (R_MICROBLAZE_32_NONE, 33) |
| 598 | + RELOC_NUMBER (R_MICROBLAZE_IMML_64, 34) |
| 599 | + RELOC_NUMBER (R_MICROBLAZE_GPC_64, 35) /* GOT entry offset. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 600 | END_RELOC_NUMBERS (R_MICROBLAZE_max) |
| 601 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 602 | /* Global base address names. */ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 603 | diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 604 | index 61eaa39b3eb..f2139a6839b 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 605 | --- a/opcodes/microblaze-opc.h |
| 606 | +++ b/opcodes/microblaze-opc.h |
| 607 | @@ -538,8 +538,8 @@ struct op_code_struct |
| 608 | {"llr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xC8000300, OPCODE_MASK_H4, llr, memory_load_inst }, |
| 609 | {"sl", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000100, OPCODE_MASK_H4, sl, memory_store_inst }, |
| 610 | {"slr", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xD8000300, OPCODE_MASK_H4, slr, memory_store_inst }, |
| 611 | - {"lli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xE8000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */ |
| 612 | - {"sli", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xF8000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */ |
| 613 | + {"lli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xEC000000, OPCODE_MASK_H, invalid_inst, memory_load_inst }, /* Identical to 32-bit */ |
| 614 | + {"sli", INST_TYPE_RD_R1_IMM, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xFC000000, OPCODE_MASK_H, invalid_inst, memory_store_inst }, /* Identical to 32-bit */ |
| 615 | {"lla", INST_TYPE_RD_R1_IMML, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x30000000, OPCODE_MASK_H, invalid_inst, arithmetic_inst }, /* lla translates to addlik */ |
| 616 | {"dadd", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000400, OPCODE_MASK_H4, dadd, arithmetic_inst }, |
| 617 | {"drsub", INST_TYPE_RD_R1_R2, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x58000480, OPCODE_MASK_H4, drsub, arithmetic_inst }, |
| 618 | diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 619 | index 1dcd3dca3d1..ad8b8ce345b 100644 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 620 | --- a/opcodes/microblaze-opcm.h |
| 621 | +++ b/opcodes/microblaze-opcm.h |
| 622 | @@ -40,8 +40,8 @@ enum microblaze_instr |
| 623 | imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid, |
| 624 | brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti, |
| 625 | bgtid, bgei, bgeid, lbu, lbuea, lbur, lhu, lhuea, lhur, lw, lwea, lwr, lwx, |
| 626 | - sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 627 | - sbi, shi, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 628 | + sb, sbea, sbr, sh, shea, shr, sw, swea, swr, swx, lbui, lhui, lwi, lli, |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame^] | 629 | + sbi, shi, sli, swi, msrset, msrclr, tuqula, mbi_fadd, frsub, mbi_fmul, mbi_fdiv, |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 630 | fcmp_lt, fcmp_eq, fcmp_le, fcmp_gt, fcmp_ne, fcmp_ge, fcmp_un, flt, |
| 631 | fint, fsqrt, |
| 632 | tget, tcget, tnget, tncget, tput, tcput, tnput, tncput, |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 633 | -- |
| 634 | 2.17.1 |
| 635 | |