diff --git a/external/gpl3/binutils/dist/bfd/config.bfd b/external/gpl3/binutils/dist/bfd/config.bfd index 3689efd0da4a..1d2ff2054701 100644 --- a/external/gpl3/binutils/dist/bfd/config.bfd +++ b/external/gpl3/binutils/dist/bfd/config.bfd @@ -876,11 +876,11 @@ case "${targ}" in #ifdef BFD64 mips64*el-*-netbsd*) targ_defvec=bfd_elf32_nlittlemips_vec - targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_nbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec" + targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_nbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec" ;; mips64*-*-netbsd*) targ_defvec=bfd_elf32_nbigmips_vec - targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_nlittlemips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec ecoff_little_vec ecoff_big_vec" + targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_nlittlemips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec" ;; #endif mips*el-*-netbsd*) diff --git a/external/gpl3/binutils/dist/bfd/elfxx-mips.c b/external/gpl3/binutils/dist/bfd/elfxx-mips.c index 43a46046192a..69bd6bfd4c3c 100644 --- a/external/gpl3/binutils/dist/bfd/elfxx-mips.c +++ b/external/gpl3/binutils/dist/bfd/elfxx-mips.c @@ -7706,10 +7706,24 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, reloc types into the output file as R_MIPS_REL32 relocs. Make room for this reloc in .rel(a).dyn. */ mips_elf_allocate_dynamic_relocations (dynobj, info, 1); - if (MIPS_ELF_READONLY_SECTION (sec)) - /* We tell the dynamic linker that there are - relocations against the text segment. */ - info->flags |= DF_TEXTREL; + /* In the N32 and 64-bit ABIs there may be multiple + consecutive relocations for the same offset. If we have + a R_MIPS_GPREL32 followed by a R_MIPS_64 then that + relocation is complete and needs no futher adjustment. */ + if ((rel == relocs + || rel[-1].r_offset != rel->r_offset + || r_type != R_MIPS_64 + || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32) + && (MIPS_ELF_READONLY_SECTION (sec)) + { + /* We tell the dynamic linker that there are + relocations against the text segment. */ + info->flags |= DF_TEXTREL; + info->callbacks->warning + (info, + _("relocation emitted against readonly section"), + NULL, abfd, sec, rel->r_offset); + } } else { diff --git a/external/gpl3/binutils/dist/gas/write.c b/external/gpl3/binutils/dist/gas/write.c index 1af81a7df9ba..505a7e507aa2 100644 --- a/external/gpl3/binutils/dist/gas/write.c +++ b/external/gpl3/binutils/dist/gas/write.c @@ -821,10 +821,12 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED, continue; } - /* Never adjust a reloc against local symbol in a merge section - with non-zero addend. */ + /* Never adjust a reloc against local symbol in a merge section with + a non-zero addend if the addend would place the relocation otside + the section's limits. */ if ((symsec->flags & SEC_MERGE) != 0 - && (fixp->fx_offset != 0 || fixp->fx_subsy != NULL)) + && (S_GET_VALUE(sym) + fixp->fx_offset >= bfd_get_section_size(symsec) + || fixp->fx_subsy != NULL)) continue; /* Never adjust a reloc against TLS local symbol. */ diff --git a/external/gpl3/binutils/dist/ld/configure.tgt b/external/gpl3/binutils/dist/ld/configure.tgt index 384781d9f35f..facf009676df 100644 --- a/external/gpl3/binutils/dist/ld/configure.tgt +++ b/external/gpl3/binutils/dist/ld/configure.tgt @@ -362,11 +362,11 @@ mips*-sgi-irix6*) targ_emul=elf32bmipn32 mips*-sgi-irix*) targ_emul=mipsbig ;; mips*el-*-ecoff*) targ_emul=mipsidtl ;; mips*-*-ecoff*) targ_emul=mipsidt ;; -mips64*el-*-netbsd*) targ_emul=elf32ltsmipn32 - targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip" +mips64*el-*-netbsd*) targ_emul=elf64ltsmip + targ_extra_emuls="elf64btsmip elf32ltsmipn32 elf32ltsmip elf32btsmipn32 elf32btsmip" ;; -mips64*-*-netbsd*) targ_emul=elf32btsmipn32 - targ_extra_emuls="elf64ltsmip elf64btsmip elf32btsmip elf32ltsmipn32 elf32ltsmip" +mips64*-*-netbsd*) targ_emul=elf64btsmip + targ_extra_emuls="elf64ltsmip elf32btsmipn32 elf32btsmip elf32ltsmipn32 elf32ltsmip" ;; mips*el-*-netbsd*) targ_emul=elf32ltsmip targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip" diff --git a/external/gpl3/binutils/dist/ld/emulparams/elf32bmipn32-defs.sh b/external/gpl3/binutils/dist/ld/emulparams/elf32bmipn32-defs.sh index 45bfd5d7883f..4a55726af6f3 100644 --- a/external/gpl3/binutils/dist/ld/emulparams/elf32bmipn32-defs.sh +++ b/external/gpl3/binutils/dist/ld/emulparams/elf32bmipn32-defs.sh @@ -6,6 +6,7 @@ SCRIPT_NAME=elf # Handle both big- and little-ended 32-bit MIPS objects. ARCH=mips +MACHINE= OUTPUT_FORMAT="elf32-bigmips" BIG_OUTPUT_FORMAT="elf32-bigmips" LITTLE_OUTPUT_FORMAT="elf32-littlemips" diff --git a/external/gpl3/binutils/dist/opcodes/mips-opc.c b/external/gpl3/binutils/dist/opcodes/mips-opc.c index 82a01f87a445..555602868702 100644 --- a/external/gpl3/binutils/dist/opcodes/mips-opc.c +++ b/external/gpl3/binutils/dist/opcodes/mips-opc.c @@ -950,6 +950,8 @@ const struct mips_opcode mips_builtin_opcodes[] = /* mtc2 is at the bottom of the table. */ /* mthc2 is at the bottom of the table. */ /* mtc3 is at the bottom of the table. */ +{"mfcr", "t,s", 0x70000018, 0xfc00ffff, WR_t|RD_s, 0, I64 }, +{"mtcr", "t,s", 0x70000019, 0xfc00ffff, WR_t|RD_s, 0, I64 }, {"mtdr", "t,G", 0x7080003d, 0xffe007ff, COD|RD_t|WR_C0, 0, N5 }, {"mthi", "s", 0x00000011, 0xfc1fffff, RD_s|WR_HI, 0, I1 }, {"mthi", "s,7", 0x00000011, 0xfc1fe7ff, RD_s|WR_HI, 0, D32 },