diff options
Diffstat (limited to 'recipes-devtools/binutils/files/0003-eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e.patch')
| -rw-r--r-- | recipes-devtools/binutils/files/0003-eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e.patch | 632 |
1 files changed, 632 insertions, 0 deletions
diff --git a/recipes-devtools/binutils/files/0003-eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e.patch b/recipes-devtools/binutils/files/0003-eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e.patch new file mode 100644 index 00000000..1504b5aa --- /dev/null +++ b/recipes-devtools/binutils/files/0003-eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e.patch | |||
| @@ -0,0 +1,632 @@ | |||
| 1 | From eb7b10e71f9569f0b90e0c6c128121ecf14c2e8e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Michael Eager <eager@eagercon.com> | ||
| 3 | Date: Fri, 9 Nov 2012 16:24:57 +0000 | ||
| 4 | Subject: Add microblazeel target support to bfd, gas and ld. | ||
| 5 | |||
| 6 | binutils/bfd/Changelog | ||
| 7 | |||
| 8 | 2012-11-09 Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
| 9 | |||
| 10 | * config.bfd: Add microblazeel-*-* | ||
| 11 | * configure.in: Likewise. | ||
| 12 | * configure: Regenerate. | ||
| 13 | * elf32-microblaze.c (microblaze_elf_relocate_section): | ||
| 14 | Add endian awareness. | ||
| 15 | (microblaze_elf_merge_private_bfd_data): New. | ||
| 16 | (microblaze_bfd_write_imm_value_32): New. | ||
| 17 | (microblaze_bfd_write_imm_value_64): New. | ||
| 18 | (microblaze_elf_relax_section): Add endian awareness. | ||
| 19 | (microblaze_elf_add_symbol_hook): Define TARGET_LITTLE_NAME, | ||
| 20 | TARGET_LITTLE_SYM and bfd_elf32_bfd_merge_private_bfd_data. | ||
| 21 | * targets.c: Add bfd target bfd_elf32_microblazeel_vec. | ||
| 22 | |||
| 23 | binutils/gas/Changelog | ||
| 24 | |||
| 25 | 2012-11-09 Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
| 26 | |||
| 27 | * tc-microblaze.c (md_longopts): Define OPTION_EB and | ||
| 28 | OPTION_EL for target. | ||
| 29 | (md_parse_option): Likewise. | ||
| 30 | * tc-microblaze.h: Set elf32-microblazeel if not | ||
| 31 | target_big_endian for TARGET_FORMAT. | ||
| 32 | * configure.tgt: Add microblazeel and set endian per target. | ||
| 33 | |||
| 34 | binutils/gas/testsuite/Changelog | ||
| 35 | |||
| 36 | 2012-11-09 David Holsgrove <david.holsgrove@xilinx.com> | ||
| 37 | |||
| 38 | * gas/microblaze/endian.exp: New file - endian | ||
| 39 | testcase for microblaze / microblazeel. | ||
| 40 | * gas/microblaze/endian.s: Likewise. | ||
| 41 | * gas/microblaze/endian_be.d: Likewise. | ||
| 42 | * gas/microblaze/endian_le.d: Likewise. | ||
| 43 | * gas/microblaze/endian_le_elf.d: Likewise. | ||
| 44 | * gas/microblaze/reloc_sym.d: Update to accept targets | ||
| 45 | other than elf32-microblaze. | ||
| 46 | * gas/microblaze/special_reg.d: Likewise. | ||
| 47 | |||
| 48 | binutils/ld/Changelog | ||
| 49 | |||
| 50 | 2012-11-09 Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
| 51 | |||
| 52 | * Makefile.am: Add eelf32microblazeel.c and eelf32mbel_linux.c. | ||
| 53 | * Makefile.in: Regenerated. | ||
| 54 | * configure.tgt: Add microblazeel and set endian per target. | ||
| 55 | * emulparams/elf32mb_linux.sh: Add OUTPUT_FORMAT. | ||
| 56 | * emulparams/elf32microblaze.sh: Likewise. | ||
| 57 | * emulparams/elf32mbel_linux.sh: New file. | ||
| 58 | * emulparams/elf32microblazeel.sh: Likewise. | ||
| 59 | |||
| 60 | Upstream-Status: Backport | ||
| 61 | |||
| 62 | diff --git a/bfd/config.bfd b/bfd/config.bfd | ||
| 63 | index 7def642..e59ab25 100644 | ||
| 64 | --- a/bfd/config.bfd | ||
| 65 | +++ b/bfd/config.bfd | ||
| 66 | @@ -916,8 +916,14 @@ case "${targ}" in | ||
| 67 | targ_selvecs=bfd_elf32_mep_little_vec | ||
| 68 | ;; | ||
| 69 | |||
| 70 | + microblazeel*-*) | ||
| 71 | + targ_defvec=bfd_elf32_microblazeel_vec | ||
| 72 | + targ_selvecs=bfd_elf32_microblaze_vec | ||
| 73 | + ;; | ||
| 74 | + | ||
| 75 | microblaze*-*) | ||
| 76 | targ_defvec=bfd_elf32_microblaze_vec | ||
| 77 | + targ_selvecs=bfd_elf32_microblazeel_vec | ||
| 78 | ;; | ||
| 79 | |||
| 80 | mips*-big-*) | ||
| 81 | diff --git a/bfd/configure b/bfd/configure | ||
| 82 | index 43bff03..7b073cc 100755 | ||
| 83 | --- a/bfd/configure | ||
| 84 | +++ b/bfd/configure | ||
| 85 | @@ -15283,6 +15283,7 @@ do | ||
| 86 | bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; | ||
| 87 | bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; | ||
| 88 | bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; | ||
| 89 | + bfd_elf32_microblazeel_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; | ||
| 90 | bfd_elf32_microblaze_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; | ||
| 91 | bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; | ||
| 92 | bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; | ||
| 93 | diff --git a/bfd/configure.in b/bfd/configure.in | ||
| 94 | index f7e3929..78f2744 100644 | ||
| 95 | --- a/bfd/configure.in | ||
| 96 | +++ b/bfd/configure.in | ||
| 97 | @@ -764,6 +764,7 @@ do | ||
| 98 | bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; | ||
| 99 | bfd_elf32_mep_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; | ||
| 100 | bfd_elf32_mep_little_vec) tb="$tb elf32-mep.lo elf32.lo $elf" ;; | ||
| 101 | + bfd_elf32_microblazeel_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; | ||
| 102 | bfd_elf32_microblaze_vec) tb="$tb elf32-microblaze.lo elf32.lo $elf" ;; | ||
| 103 | bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; | ||
| 104 | bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; | ||
| 105 | diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c | ||
| 106 | index c000424..be2de13 100644 | ||
| 107 | --- a/bfd/elf32-microblaze.c | ||
| 108 | +++ b/bfd/elf32-microblaze.c | ||
| 109 | @@ -702,6 +702,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 110 | Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; | ||
| 111 | struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd); | ||
| 112 | Elf_Internal_Rela *rel, *relend; | ||
| 113 | + int endian = (bfd_little_endian (output_bfd)) ? 0 : 2; | ||
| 114 | /* Assume success. */ | ||
| 115 | bfd_boolean ret = TRUE; | ||
| 116 | asection *sreloc; | ||
| 117 | @@ -933,9 +934,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 118 | + offset + INST_WORD_SIZE); | ||
| 119 | relocation += addend; | ||
| 120 | bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
| 121 | - contents + offset + 2); | ||
| 122 | + contents + offset + endian); | ||
| 123 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
| 124 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 125 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 126 | break; | ||
| 127 | |||
| 128 | case (int) R_MICROBLAZE_PLT_64: | ||
| 129 | @@ -952,9 +953,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 130 | + input_section->output_offset | ||
| 131 | + offset + INST_WORD_SIZE); | ||
| 132 | bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff, | ||
| 133 | - contents + offset + 2); | ||
| 134 | + contents + offset + endian); | ||
| 135 | bfd_put_16 (input_bfd, immediate & 0xffff, | ||
| 136 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 137 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 138 | } | ||
| 139 | else | ||
| 140 | { | ||
| 141 | @@ -963,9 +964,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 142 | + offset + INST_WORD_SIZE); | ||
| 143 | immediate = relocation; | ||
| 144 | bfd_put_16 (input_bfd, (immediate >> 16) & 0xffff, | ||
| 145 | - contents + offset + 2); | ||
| 146 | + contents + offset + endian); | ||
| 147 | bfd_put_16 (input_bfd, immediate & 0xffff, | ||
| 148 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 149 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 150 | } | ||
| 151 | break; | ||
| 152 | } | ||
| 153 | @@ -1031,9 +1032,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 154 | abort (); /* ??? */ | ||
| 155 | } | ||
| 156 | bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
| 157 | - contents + offset + 2); | ||
| 158 | + contents + offset + endian); | ||
| 159 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
| 160 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 161 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 162 | break; | ||
| 163 | } | ||
| 164 | |||
| 165 | @@ -1048,8 +1049,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 166 | immediate = relocation; | ||
| 167 | lo = immediate & 0x0000ffff; | ||
| 168 | high = (immediate >> 16) & 0x0000ffff; | ||
| 169 | - bfd_put_16 (input_bfd, high, contents + offset + 2); | ||
| 170 | - bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + 2); | ||
| 171 | + bfd_put_16 (input_bfd, high, contents + offset + endian); | ||
| 172 | + bfd_put_16 (input_bfd, lo, contents + offset + INST_WORD_SIZE + endian); | ||
| 173 | break; | ||
| 174 | } | ||
| 175 | |||
| 176 | @@ -1082,9 +1083,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 177 | + input_section->output_offset | ||
| 178 | + offset + INST_WORD_SIZE); | ||
| 179 | bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
| 180 | - contents + offset + 2); | ||
| 181 | + contents + offset + endian); | ||
| 182 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
| 183 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 184 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 185 | } | ||
| 186 | break; | ||
| 187 | } | ||
| 188 | @@ -1176,9 +1177,9 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 189 | + input_section->output_offset | ||
| 190 | + offset + INST_WORD_SIZE); | ||
| 191 | bfd_put_16 (input_bfd, (relocation >> 16) & 0xffff, | ||
| 192 | - contents + offset + 2); | ||
| 193 | + contents + offset + endian); | ||
| 194 | bfd_put_16 (input_bfd, relocation & 0xffff, | ||
| 195 | - contents + offset + 2 + INST_WORD_SIZE); | ||
| 196 | + contents + offset + endian + INST_WORD_SIZE); | ||
| 197 | } | ||
| 198 | break; | ||
| 199 | } | ||
| 200 | @@ -1253,6 +1254,21 @@ microblaze_elf_relocate_section (bfd *output_bfd, | ||
| 201 | |||
| 202 | return ret; | ||
| 203 | } | ||
| 204 | + | ||
| 205 | +/* Merge backend specific data from an object file to the output | ||
| 206 | + object file when linking. | ||
| 207 | + | ||
| 208 | + Note: We only use this hook to catch endian mismatches. */ | ||
| 209 | +static bfd_boolean | ||
| 210 | +microblaze_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd) | ||
| 211 | +{ | ||
| 212 | + /* Check if we have the same endianess. */ | ||
| 213 | + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) | ||
| 214 | + return FALSE; | ||
| 215 | + | ||
| 216 | + return TRUE; | ||
| 217 | +} | ||
| 218 | + | ||
| 219 | |||
| 220 | /* Calculate fixup value for reference. */ | ||
| 221 | |||
| 222 | @@ -1275,6 +1291,36 @@ calc_fixup (bfd_vma addr, asection *sec) | ||
| 223 | return fixup; | ||
| 224 | } | ||
| 225 | |||
| 226 | +/* Read-modify-write into the bfd, an immediate value into appropriate fields of | ||
| 227 | + a 32-bit instruction. */ | ||
| 228 | +static void | ||
| 229 | +microblaze_bfd_write_imm_value_32 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) | ||
| 230 | +{ | ||
| 231 | + unsigned long instr = bfd_get_32 (abfd, bfd_addr); | ||
| 232 | + instr &= ~0x0000ffff; | ||
| 233 | + instr |= (val & 0x0000ffff); | ||
| 234 | + bfd_put_32 (abfd, instr, bfd_addr); | ||
| 235 | +} | ||
| 236 | + | ||
| 237 | +/* Read-modify-write into the bfd, an immediate value into appropriate fields of | ||
| 238 | + two consecutive 32-bit instructions. */ | ||
| 239 | +static void | ||
| 240 | +microblaze_bfd_write_imm_value_64 (bfd *abfd, bfd_byte *bfd_addr, bfd_vma val) | ||
| 241 | +{ | ||
| 242 | + unsigned long instr_hi; | ||
| 243 | + unsigned long instr_lo; | ||
| 244 | + | ||
| 245 | + instr_hi = bfd_get_32 (abfd, bfd_addr); | ||
| 246 | + instr_hi &= ~0x0000ffff; | ||
| 247 | + instr_hi |= ((val >> 16) & 0x0000ffff); | ||
| 248 | + bfd_put_32 (abfd, instr_hi, bfd_addr); | ||
| 249 | + | ||
| 250 | + instr_lo = bfd_get_32 (abfd, bfd_addr + INST_WORD_SIZE); | ||
| 251 | + instr_lo &= ~0x0000ffff; | ||
| 252 | + instr_lo |= (val & 0x0000ffff); | ||
| 253 | + bfd_put_32 (abfd, instr_lo, bfd_addr + INST_WORD_SIZE); | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | static bfd_boolean | ||
| 257 | microblaze_elf_relax_section (bfd *abfd, | ||
| 258 | asection *sec, | ||
| 259 | @@ -1305,7 +1351,8 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 260 | /* Only do this for a text section. */ | ||
| 261 | if (link_info->relocatable | ||
| 262 | || (sec->flags & SEC_RELOC) == 0 | ||
| 263 | - || (sec->reloc_count == 0)) | ||
| 264 | + || (sec->reloc_count == 0) | ||
| 265 | + || (sec->flags & SEC_CODE) == 0) | ||
| 266 | return TRUE; | ||
| 267 | |||
| 268 | BFD_ASSERT ((sec->size > 0) || (sec->rawsize > 0)); | ||
| 269 | @@ -1485,7 +1532,8 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 270 | efix = calc_fixup (target_address, sec); | ||
| 271 | irel->r_addend -= (efix - sfix); | ||
| 272 | /* Should use HOWTO. */ | ||
| 273 | - bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset + 2); | ||
| 274 | + microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset, | ||
| 275 | + irel->r_addend); | ||
| 276 | } | ||
| 277 | break; | ||
| 278 | case R_MICROBLAZE_64_NONE: | ||
| 279 | @@ -1498,8 +1546,8 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 280 | sfix = calc_fixup (irel->r_offset + INST_WORD_SIZE, sec); | ||
| 281 | efix = calc_fixup (target_address, sec); | ||
| 282 | irel->r_addend -= (efix - sfix); | ||
| 283 | - bfd_put_16 (abfd, irel->r_addend, contents + irel->r_offset | ||
| 284 | - + INST_WORD_SIZE + 2); | ||
| 285 | + microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset | ||
| 286 | + + INST_WORD_SIZE, irel->r_addend); | ||
| 287 | } | ||
| 288 | break; | ||
| 289 | } | ||
| 290 | @@ -1627,13 +1675,14 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | - immediate = (unsigned short) bfd_get_16 (abfd, ocontents + | ||
| 295 | - irelscan->r_offset + 2); | ||
| 296 | + unsigned long instr = bfd_get_32 (abfd, ocontents + irelscan->r_offset); | ||
| 297 | + immediate = instr & 0x0000ffff; | ||
| 298 | target_address = immediate; | ||
| 299 | offset = calc_fixup (target_address, sec); | ||
| 300 | immediate -= offset; | ||
| 301 | irelscan->r_addend -= offset; | ||
| 302 | - bfd_put_16 (abfd, immediate, ocontents + irelscan->r_offset + 2); | ||
| 303 | + microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, | ||
| 304 | + irelscan->r_addend); | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | @@ -1669,15 +1718,13 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 309 | elf_section_data (o)->this_hdr.contents = ocontents; | ||
| 310 | } | ||
| 311 | } | ||
| 312 | - immediate = (unsigned short) (bfd_get_16 (abfd, ocontents | ||
| 313 | - + irelscan->r_offset | ||
| 314 | - + 2) << 16) | ||
| 315 | - & 0xffff0000; | ||
| 316 | - immediate += (unsigned short) (bfd_get_16 (abfd, ocontents | ||
| 317 | - + irelscan->r_offset | ||
| 318 | - + INST_WORD_SIZE + 2)) | ||
| 319 | - & 0x0000ffff; | ||
| 320 | - | ||
| 321 | + unsigned long instr_hi = bfd_get_32 (abfd, ocontents | ||
| 322 | + + irelscan->r_offset); | ||
| 323 | + unsigned long instr_lo = bfd_get_32 (abfd, ocontents | ||
| 324 | + + irelscan->r_offset | ||
| 325 | + + INST_WORD_SIZE); | ||
| 326 | + immediate = (instr_hi & 0x0000ffff) << 16; | ||
| 327 | + immediate |= (instr_lo & 0x0000ffff); | ||
| 328 | offset = calc_fixup (irelscan->r_addend, sec); | ||
| 329 | immediate -= offset; | ||
| 330 | irelscan->r_addend -= offset; | ||
| 331 | @@ -1715,22 +1762,19 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 332 | elf_section_data (o)->this_hdr.contents = ocontents; | ||
| 333 | } | ||
| 334 | } | ||
| 335 | - | ||
| 336 | - immediate = (unsigned short) | ||
| 337 | - (bfd_get_16 (abfd, ocontents + irelscan->r_offset + 2) << 16) | ||
| 338 | - & 0xffff0000; | ||
| 339 | - immediate += (unsigned short) | ||
| 340 | - (bfd_get_16 (abfd, ocontents + irelscan->r_offset | ||
| 341 | - + INST_WORD_SIZE + 2)) | ||
| 342 | - & 0x0000ffff; | ||
| 343 | + unsigned long instr_hi = bfd_get_32 (abfd, ocontents | ||
| 344 | + + irelscan->r_offset); | ||
| 345 | + unsigned long instr_lo = bfd_get_32 (abfd, ocontents | ||
| 346 | + + irelscan->r_offset | ||
| 347 | + + INST_WORD_SIZE); | ||
| 348 | + immediate = (instr_hi & 0x0000ffff) << 16; | ||
| 349 | + immediate |= (instr_lo & 0x0000ffff); | ||
| 350 | target_address = immediate; | ||
| 351 | offset = calc_fixup (target_address, sec); | ||
| 352 | immediate -= offset; | ||
| 353 | irelscan->r_addend -= offset; | ||
| 354 | - bfd_put_16 (abfd, ((immediate >> 16) & 0x0000ffff), | ||
| 355 | - ocontents + irelscan->r_offset + 2); | ||
| 356 | - bfd_put_16 (abfd, (immediate & 0x0000ffff), | ||
| 357 | - ocontents + irelscan->r_offset + INST_WORD_SIZE + 2); | ||
| 358 | + microblaze_bfd_write_imm_value_64 (abfd, ocontents | ||
| 359 | + + irelscan->r_offset, immediate); | ||
| 360 | } | ||
| 361 | } | ||
| 362 | } | ||
| 363 | @@ -1800,9 +1844,12 @@ microblaze_elf_relax_section (bfd *abfd, | ||
| 364 | |||
| 365 | if (sec->relax_count == 0) | ||
| 366 | { | ||
| 367 | + *again = FALSE; | ||
| 368 | free (sec->relax); | ||
| 369 | sec->relax = NULL; | ||
| 370 | } | ||
| 371 | + else | ||
| 372 | + *again = TRUE; | ||
| 373 | return TRUE; | ||
| 374 | |||
| 375 | error_return: | ||
| 376 | @@ -3016,6 +3063,8 @@ microblaze_elf_add_symbol_hook (bfd *abfd, | ||
| 377 | return TRUE; | ||
| 378 | } | ||
| 379 | |||
| 380 | +#define TARGET_LITTLE_SYM bfd_elf32_microblazeel_vec | ||
| 381 | +#define TARGET_LITTLE_NAME "elf32-microblazeel" | ||
| 382 | |||
| 383 | #define TARGET_BIG_SYM bfd_elf32_microblaze_vec | ||
| 384 | #define TARGET_BIG_NAME "elf32-microblaze" | ||
| 385 | @@ -3032,6 +3081,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, | ||
| 386 | #define bfd_elf32_bfd_is_local_label_name microblaze_elf_is_local_label_name | ||
| 387 | #define elf_backend_relocate_section microblaze_elf_relocate_section | ||
| 388 | #define bfd_elf32_bfd_relax_section microblaze_elf_relax_section | ||
| 389 | +#define bfd_elf32_bfd_merge_private_bfd_data microblaze_elf_merge_private_bfd_data | ||
| 390 | #define bfd_elf32_bfd_reloc_name_lookup microblaze_elf_reloc_name_lookup | ||
| 391 | |||
| 392 | #define elf_backend_gc_mark_hook microblaze_elf_gc_mark_hook | ||
| 393 | diff --git a/bfd/targets.c b/bfd/targets.c | ||
| 394 | index 621bf8d..442cb8f 100644 | ||
| 395 | --- a/bfd/targets.c | ||
| 396 | +++ b/bfd/targets.c | ||
| 397 | @@ -659,6 +659,7 @@ extern const bfd_target bfd_elf32_mcore_big_vec; | ||
| 398 | extern const bfd_target bfd_elf32_mcore_little_vec; | ||
| 399 | extern const bfd_target bfd_elf32_mep_vec; | ||
| 400 | extern const bfd_target bfd_elf32_mep_little_vec; | ||
| 401 | +extern const bfd_target bfd_elf32_microblazeel_vec; | ||
| 402 | extern const bfd_target bfd_elf32_microblaze_vec; | ||
| 403 | extern const bfd_target bfd_elf32_mn10200_vec; | ||
| 404 | extern const bfd_target bfd_elf32_mn10300_vec; | ||
| 405 | diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c | ||
| 406 | index de0efda..04dfa1e 100644 | ||
| 407 | --- a/gas/config/tc-microblaze.c | ||
| 408 | +++ b/gas/config/tc-microblaze.c | ||
| 409 | @@ -35,6 +35,9 @@ | ||
| 410 | #define streq(a,b) (strcmp (a, b) == 0) | ||
| 411 | #endif | ||
| 412 | |||
| 413 | +#define OPTION_EB (OPTION_MD_BASE + 0) | ||
| 414 | +#define OPTION_EL (OPTION_MD_BASE + 1) | ||
| 415 | + | ||
| 416 | void microblaze_generate_symbol (char *sym); | ||
| 417 | static bfd_boolean check_spl_reg (unsigned *); | ||
| 418 | |||
| 419 | @@ -1707,6 +1710,8 @@ const char * md_shortopts = ""; | ||
| 420 | |||
| 421 | struct option md_longopts[] = | ||
| 422 | { | ||
| 423 | + {"EB", no_argument, NULL, OPTION_EB}, | ||
| 424 | + {"EL", no_argument, NULL, OPTION_EL}, | ||
| 425 | { NULL, no_argument, NULL, 0} | ||
| 426 | }; | ||
| 427 | |||
| 428 | @@ -2304,6 +2309,12 @@ md_parse_option (int c, char * arg ATTRIBUTE_UNUSED) | ||
| 429 | { | ||
| 430 | switch (c) | ||
| 431 | { | ||
| 432 | + case OPTION_EB: | ||
| 433 | + target_big_endian = 1; | ||
| 434 | + break; | ||
| 435 | + case OPTION_EL: | ||
| 436 | + target_big_endian = 0; | ||
| 437 | + break; | ||
| 438 | default: | ||
| 439 | return 0; | ||
| 440 | } | ||
| 441 | diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h | ||
| 442 | index db8d227..0651040 100644 | ||
| 443 | --- a/gas/config/tc-microblaze.h | ||
| 444 | +++ b/gas/config/tc-microblaze.h | ||
| 445 | @@ -23,8 +23,10 @@ | ||
| 446 | #define TC_MICROBLAZE 1 | ||
| 447 | |||
| 448 | #define TARGET_ARCH bfd_arch_microblaze | ||
| 449 | +#ifndef TARGET_BYTES_BIG_ENDIAN | ||
| 450 | /* Used to initialise target_big_endian. */ | ||
| 451 | #define TARGET_BYTES_BIG_ENDIAN 1 | ||
| 452 | +#endif | ||
| 453 | |||
| 454 | #define IGNORE_NONSTANDARD_ESCAPES | ||
| 455 | |||
| 456 | @@ -75,7 +77,7 @@ extern const struct relax_type md_relax_table[]; | ||
| 457 | |||
| 458 | #ifdef OBJ_ELF | ||
| 459 | |||
| 460 | -#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblaze-little") | ||
| 461 | +#define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel") | ||
| 462 | |||
| 463 | #define ELF_TC_SPECIAL_SECTIONS \ | ||
| 464 | { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \ | ||
| 465 | diff --git a/gas/configure.tgt b/gas/configure.tgt | ||
| 466 | index ff4cb3f..774031e 100644 | ||
| 467 | --- a/gas/configure.tgt | ||
| 468 | +++ b/gas/configure.tgt | ||
| 469 | @@ -57,7 +57,8 @@ case ${cpu} in | ||
| 470 | m6811|m6812|m68hc12) cpu_type=m68hc11 ;; | ||
| 471 | m683??) cpu_type=m68k ;; | ||
| 472 | mep) cpu_type=mep endian=little ;; | ||
| 473 | - microblaze*) cpu_type=microblaze ;; | ||
| 474 | + microblazeel*) cpu_type=microblaze endian=little;; | ||
| 475 | + microblaze*) cpu_type=microblaze endian=big;; | ||
| 476 | mips*el) cpu_type=mips endian=little ;; | ||
| 477 | mips*) cpu_type=mips endian=big ;; | ||
| 478 | mt) cpu_type=mt endian=big ;; | ||
| 479 | diff --git a/gas/testsuite/gas/microblaze/reloc_sym.d b/gas/testsuite/gas/microblaze/reloc_sym.d | ||
| 480 | index 212d0bb..571ffe1 100644 | ||
| 481 | --- a/gas/testsuite/gas/microblaze/reloc_sym.d | ||
| 482 | +++ b/gas/testsuite/gas/microblaze/reloc_sym.d | ||
| 483 | @@ -1,6 +1,5 @@ | ||
| 484 | |||
| 485 | -reloc_sym.x: file format elf32-microblaze | ||
| 486 | - | ||
| 487 | +.*: +file format .* | ||
| 488 | |||
| 489 | Disassembly of section .text: | ||
| 490 | |||
| 491 | diff --git a/gas/testsuite/gas/microblaze/special_reg.d b/gas/testsuite/gas/microblaze/special_reg.d | ||
| 492 | index aad0131..c2041fd 100644 | ||
| 493 | --- a/gas/testsuite/gas/microblaze/special_reg.d | ||
| 494 | +++ b/gas/testsuite/gas/microblaze/special_reg.d | ||
| 495 | @@ -1,10 +1,7 @@ | ||
| 496 | #as: | ||
| 497 | -#objdump: -ds | ||
| 498 | +#objdump: -d | ||
| 499 | |||
| 500 | -.*: file format .* | ||
| 501 | - | ||
| 502 | -Contents of section .text: | ||
| 503 | - 0000 9409d000 6c00d000 001ff800 ....l....... | ||
| 504 | +.*: +file format .* | ||
| 505 | |||
| 506 | Disassembly of section .text: | ||
| 507 | |||
| 508 | diff --git a/ld/Makefile.am b/ld/Makefile.am | ||
| 509 | index 4c692ea..f6f814f 100644 | ||
| 510 | --- a/ld/Makefile.am | ||
| 511 | +++ b/ld/Makefile.am | ||
| 512 | @@ -237,6 +237,7 @@ ALL_EMULATION_SOURCES = \ | ||
| 513 | eelf32mb_linux.c \ | ||
| 514 | eelf32mcore.c \ | ||
| 515 | eelf32mep.c \ | ||
| 516 | + eelf32microblazeel.c \ | ||
| 517 | eelf32microblaze.c \ | ||
| 518 | eelf32mipswindiss.c \ | ||
| 519 | eelf32moxie.c \ | ||
| 520 | @@ -1107,6 +1108,9 @@ eelf32m32c.c: $(srcdir)/emulparams/elf32m32c.sh \ | ||
| 521 | $(ELF_DEPS) $(srcdir)/emultempl/needrelax.em \ | ||
| 522 | $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 523 | ${GENSCRIPTS} elf32m32c "$(tdir_m32c)" | ||
| 524 | +eelf32mbel_linux.c: $(srcdir)/emulparams/elf32mbel_linux.sh \ | ||
| 525 | + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 526 | + ${GENSCRIPTS} elf32mbel_linux "$(tdir_microblazeel)" | ||
| 527 | eelf32mb_linux.c: $(srcdir)/emulparams/elf32mb_linux.sh \ | ||
| 528 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 529 | ${GENSCRIPTS} elf32mb_linux "$(tdir_microblaze)" | ||
| 530 | @@ -1116,6 +1120,9 @@ eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \ | ||
| 531 | eelf32mep.c: $(srcdir)/emulparams/elf32mep.sh \ | ||
| 532 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/mep.sc ${GEN_DEPENDS} | ||
| 533 | ${GENSCRIPTS} elf32mep "$(tdir_mep)" | ||
| 534 | +eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \ | ||
| 535 | + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} | ||
| 536 | + ${GENSCRIPTS} elf32microblazeel "$(tdir_microblazeel)" | ||
| 537 | eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \ | ||
| 538 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} | ||
| 539 | ${GENSCRIPTS} elf32microblaze "$(tdir_microblaze)" | ||
| 540 | diff --git a/ld/Makefile.in b/ld/Makefile.in | ||
| 541 | index a675d01..fb0c21e 100644 | ||
| 542 | --- a/ld/Makefile.in | ||
| 543 | +++ b/ld/Makefile.in | ||
| 544 | @@ -544,6 +544,7 @@ ALL_EMULATION_SOURCES = \ | ||
| 545 | eelf32mb_linux.c \ | ||
| 546 | eelf32mcore.c \ | ||
| 547 | eelf32mep.c \ | ||
| 548 | + eelf32microblazeel.c \ | ||
| 549 | eelf32microblaze.c \ | ||
| 550 | eelf32mipswindiss.c \ | ||
| 551 | eelf32moxie.c \ | ||
| 552 | @@ -1166,6 +1167,7 @@ distclean-compile: | ||
| 553 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mcore.Po@am__quote@ | ||
| 554 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mep.Po@am__quote@ | ||
| 555 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32microblaze.Po@am__quote@ | ||
| 556 | +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32microblazeel.Po@am__quote@ | ||
| 557 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mipswindiss.Po@am__quote@ | ||
| 558 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32moxie.Po@am__quote@ | ||
| 559 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32mt.Po@am__quote@ | ||
| 560 | @@ -2577,6 +2579,9 @@ eelf32m32c.c: $(srcdir)/emulparams/elf32m32c.sh \ | ||
| 561 | $(ELF_DEPS) $(srcdir)/emultempl/needrelax.em \ | ||
| 562 | $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 563 | ${GENSCRIPTS} elf32m32c "$(tdir_m32c)" | ||
| 564 | +eelf32mbel_linux.c: $(srcdir)/emulparams/elf32mbel_linux.sh \ | ||
| 565 | + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 566 | + ${GENSCRIPTS} elf32mbel_linux "$(tdir_microblazeel)" | ||
| 567 | eelf32mb_linux.c: $(srcdir)/emulparams/elf32mb_linux.sh \ | ||
| 568 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} | ||
| 569 | ${GENSCRIPTS} elf32mb_linux "$(tdir_microblaze)" | ||
| 570 | @@ -2586,6 +2591,9 @@ eelf32mcore.c: $(srcdir)/emulparams/elf32mcore.sh \ | ||
| 571 | eelf32mep.c: $(srcdir)/emulparams/elf32mep.sh \ | ||
| 572 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/mep.sc ${GEN_DEPENDS} | ||
| 573 | ${GENSCRIPTS} elf32mep "$(tdir_mep)" | ||
| 574 | +eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \ | ||
| 575 | + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} | ||
| 576 | + ${GENSCRIPTS} elf32microblazeel "$(tdir_microblazeel)" | ||
| 577 | eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \ | ||
| 578 | $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} | ||
| 579 | ${GENSCRIPTS} elf32microblaze "$(tdir_microblaze)" | ||
| 580 | diff --git a/ld/configure.tgt b/ld/configure.tgt | ||
| 581 | index 0e62b52..9f0025a 100644 | ||
| 582 | --- a/ld/configure.tgt | ||
| 583 | +++ b/ld/configure.tgt | ||
| 584 | @@ -395,9 +395,18 @@ mcore-*-pe) targ_emul=mcorepe ; | ||
| 585 | mcore-*-elf) targ_emul=elf32mcore | ||
| 586 | ;; | ||
| 587 | mep-*-elf) targ_emul=elf32mep ;; | ||
| 588 | -microblaze*-linux*) | ||
| 589 | - targ_emul="elf32mb_linux" ;; | ||
| 590 | -microblaze*) targ_emul=elf32microblaze ;; | ||
| 591 | +microblazeel*-linux*) targ_emul="elf32mbel_linux" | ||
| 592 | + targ_extra_emuls="elf32mb_linux" | ||
| 593 | + ;; | ||
| 594 | +microblaze*-linux*) targ_emul="elf32mb_linux" | ||
| 595 | + targ_extra_emuls="elf32mbel_linux" | ||
| 596 | + ;; | ||
| 597 | +microblazeel*) targ_emul=elf32microblazeel | ||
| 598 | + targ_extra_emuls=elf32microblaze | ||
| 599 | + ;; | ||
| 600 | +microblaze*) targ_emul=elf32microblaze | ||
| 601 | + targ_extra_emuls=elf32microblazeel | ||
| 602 | + ;; | ||
| 603 | mips*-*-pe) targ_emul=mipspe ; | ||
| 604 | targ_extra_ofiles="deffilep.o pe-dll.o" ;; | ||
| 605 | mips*-dec-ultrix*) targ_emul=mipslit ;; | ||
| 606 | diff --git a/ld/emulparams/elf32mb_linux.sh b/ld/emulparams/elf32mb_linux.sh | ||
| 607 | index f26f1a0..bb60d1f 100644 | ||
| 608 | --- a/ld/emulparams/elf32mb_linux.sh | ||
| 609 | +++ b/ld/emulparams/elf32mb_linux.sh | ||
| 610 | @@ -1,5 +1,7 @@ | ||
| 611 | SCRIPT_NAME=elf | ||
| 612 | OUTPUT_FORMAT="elf32-microblaze" | ||
| 613 | +BIG_OUTPUT_FORMAT="elf32-microblaze" | ||
| 614 | +LITTLE_OUTPUT_FORMAT="elf32-microblazeel" | ||
| 615 | TEXT_START_ADDR=0x10000000 | ||
| 616 | NONPAGED_TEXT_START_ADDR=0x28 | ||
| 617 | ALIGNMENT=4 | ||
| 618 | diff --git a/ld/emulparams/elf32microblaze.sh b/ld/emulparams/elf32microblaze.sh | ||
| 619 | index ccc20d1..1f80447 100644 | ||
| 620 | --- a/ld/emulparams/elf32microblaze.sh | ||
| 621 | +++ b/ld/emulparams/elf32microblaze.sh | ||
| 622 | @@ -1,5 +1,7 @@ | ||
| 623 | SCRIPT_NAME=elfmicroblaze | ||
| 624 | OUTPUT_FORMAT="elf32-microblaze" | ||
| 625 | +BIG_OUTPUT_FORMAT="elf32-microblaze" | ||
| 626 | +LITTLE_OUTPUT_FORMAT="elf32-microblazeel" | ||
| 627 | #TEXT_START_ADDR=0 | ||
| 628 | NONPAGED_TEXT_START_ADDR=0x28 | ||
| 629 | ALIGNMENT=4 | ||
| 630 | -- | ||
| 631 | 1.7.5.4 | ||
| 632 | |||
