From 8dbcc96d09de1da05e190da70bdd86abdf1a5a15 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Sat, 23 Sep 2017 13:00:50 +0100 Subject: [PATCH] branch-updates # DP: updates from the binutils-2.29 branch # git diff d1a6e7195b9bb0255fa77588985b969ad8aaacf5 25aad9cca7232a36abeba318f21e8d19137ea15f Gbp-Pq: Name branch-updates.diff --- bfd/ChangeLog | 22 ++++++++++++++++++++++ bfd/elf32-i386.c | 6 +++++- bfd/elf64-x86-64.c | 6 +++++- bfd/version.h | 2 +- binutils/ChangeLog | 4 ++++ binutils/readelf.c | 1 + gas/ChangeLog | 5 +++++ gas/testsuite/gas/mips/elf_mach_5900.d | 22 ++++++++++++++++++++++ gas/testsuite/gas/mips/mips.exp | 1 + gold/ChangeLog | 11 +++++++++++ gold/options.h | 3 ++- gold/powerpc.cc | 25 ++++++++++++++++++++----- 12 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 gas/testsuite/gas/mips/elf_mach_5900.d diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 417ed273a..7091d7543 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,25 @@ +2017-09-22 H.J. Lu + + PR binutils/22170 + * elf32-i386.c (elf_i386_get_synthetic_symtab): Guard against + corrupted PLT. + * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise. + +2017-09-22 H.J. Lu + + PR binutils/22163 + * elf32-i386.c (elf_i386_get_synthetic_symtab): Also return -1 + if bfd_canonicalize_dynamic_reloc returns 0. + * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise. + +2017-09-21 Nick Clifton + + * development.sh (development): Revert previous delta. + +2017-09-20 Nick Clifton + + * development.sh (development): Set to false. + 2017-09-19 Nick Clifton 2.29.1 Release diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 5c1c3ff79..ba50c93f3 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -6342,7 +6342,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd, dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf, dynsyms); - if (dynrelcount < 0) + if (dynrelcount <= 0) return -1; /* Sort the relocs by address. */ @@ -6616,6 +6616,10 @@ bad_return: size += sizeof ("+0x") - 1 + 8; n++; s++; + /* There should be only one entry in PLT for a given + symbol. Set howto to NULL after processing a PLT + entry to guard against corrupted PLT. */ + p->howto = NULL; } offset += plt_entry_size; } diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 80dd791d2..d9225addd 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -6717,7 +6717,7 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf, dynsyms); - if (dynrelcount < 0) + if (dynrelcount <= 0) return -1; /* Sort the relocs by address. */ @@ -6970,6 +6970,10 @@ bad_return: size += sizeof ("+0x") - 1 + 8 + 8 * ABI_64_P (abfd); n++; s++; + /* There should be only one entry in PLT for a given + symbol. Set howto to NULL after processing a PLT + entry to guard against corrupted PLT. */ + p->howto = NULL; } offset += plt_entry_size; } diff --git a/bfd/version.h b/bfd/version.h index 3405e424f..11151288b 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20170919 +#define BFD_VERSION_DATE 20170923 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 84d3d7c1c..ffb34fbb7 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2017-09-21 Maciej W. Rozycki + + * readelf.c (get_machine_flags) : New case. + 2017-09-15 Nick Clifton 2.29.1 Release diff --git a/binutils/readelf.c b/binutils/readelf.c index fb16df8e2..41f128ed2 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -3325,6 +3325,7 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break; case E_MIPS_MACH_5400: strcat (buf, ", 5400"); break; case E_MIPS_MACH_5500: strcat (buf, ", 5500"); break; + case E_MIPS_MACH_5900: strcat (buf, ", 5900"); break; case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break; case E_MIPS_MACH_9000: strcat (buf, ", 9000"); break; case E_MIPS_MACH_LS2E: strcat (buf, ", loongson-2e"); break; diff --git a/gas/ChangeLog b/gas/ChangeLog index 42a676f59..9aa3dbca3 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2017-09-21 Maciej W. Rozycki + + * testsuite/gas/mips/elf_mach_5900.d: New test. + * testsuite/gas/mips/mips.exp: Run it. + 2017-09-15 Nick Clifton 2.29.1 Release diff --git a/gas/testsuite/gas/mips/elf_mach_5900.d b/gas/testsuite/gas/mips/elf_mach_5900.d new file mode 100644 index 000000000..1df668e7e --- /dev/null +++ b/gas/testsuite/gas/mips/elf_mach_5900.d @@ -0,0 +1,22 @@ +#readelf: -Ah +#name: ELF R5900 markings +#as: -32 -march=r5900 +#source: empty.s + +ELF Header: +#... + Flags: +0x..92...., .*5900.* +#... + +MIPS ABI Flags Version: 0 + +ISA: MIPS3 +GPR size: 32 +CPR1 size: 32 +CPR2 size: 0 +FP ABI: .* +ISA Extension: Toshiba R5900 +ASEs: + None +FLAGS 1: .* +FLAGS 2: .* diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index c71dca435..25221ae2a 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1149,6 +1149,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "elf_ase_micromips-2" # Verify that machine markings are handled properly. + run_dump_test "elf_mach_5900" run_dump_test "elf_mach_interaptiv-mr2" run_dump_test "mips-gp32-fp32-pic" diff --git a/gold/ChangeLog b/gold/ChangeLog index 6071f8977..0fc54ddf7 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,14 @@ +2017-08-03 James Clarke + + * options.h (General_options): Set a non-NULL second help string + argument for relax to allow --no-relax. + +2017-09-20 Alan Modra + + * powerpc.cc (Target_powerpc::Branch_info::make_stub): Put + stubs for ppc32 non-branch relocs in first stub table. + (Target_powerpc::Relocate::relocate): Resolve similarly. + 2017-09-19 Alan Modra * options.h (stub-group-multi): Default to true. Add diff --git a/gold/options.h b/gold/options.h index 576b2a3c5..4a802cf41 100644 --- a/gold/options.h +++ b/gold/options.h @@ -1164,7 +1164,8 @@ class General_options N_("Generate relocatable output"), NULL); DEFINE_bool(relax, options::TWO_DASHES, '\0', false, - N_("Relax branches on certain targets"), NULL); + N_("Relax branches on certain targets"), + N_("Do not relax branches")); DEFINE_string(retain_symbols_file, options::TWO_DASHES, '\0', NULL, N_("keep only symbols listed in this file"), N_("FILE")); diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 629da4f8a..ba20ef1ad 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -3065,11 +3065,17 @@ Target_powerpc::Branch_info::make_stub( target->glink_section()->add_global_entry(gsym); else { - if (stub_table == NULL) + if (stub_table == NULL + && !(size == 32 + && gsym != NULL + && !parameters->options().output_is_position_independent() + && !is_branch_reloc(this->r_type_))) stub_table = this->object_->stub_table(this->shndx_); if (stub_table == NULL) { - // This is a ref from a data section to an ifunc symbol. + // This is a ref from a data section to an ifunc symbol, + // or a non-branch reloc for which we always want to use + // one set of stubs for resolving function addresses. stub_table = ifunc_stub_table; } gold_assert(stub_table != NULL); @@ -8052,11 +8058,20 @@ Target_powerpc::Relocate::relocate( } else { - Stub_table* stub_table - = object->stub_table(relinfo->data_shndx); + Stub_table* stub_table = NULL; + if (target->stub_tables().size() == 1) + stub_table = target->stub_tables()[0]; + if (stub_table == NULL + && !(size == 32 + && gsym != NULL + && !parameters->options().output_is_position_independent() + && !is_branch_reloc(r_type))) + stub_table = object->stub_table(relinfo->data_shndx); if (stub_table == NULL) { - // This is a ref from a data section to an ifunc symbol. + // This is a ref from a data section to an ifunc symbol, + // or a non-branch reloc for which we always want to use + // one set of stubs for resolving function addresses. if (target->stub_tables().size() != 0) stub_table = target->stub_tables()[0]; } -- 2.30.2