diff --git a/.gitignore b/.gitignore index f61b32f..9ac00a2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ build-sources /binutils-2.29.tar.xz /binutils-2.29.1.tar.xz /binutils-2.19.50.0.1-output-format.sed +/binutils-2.30.tar.xz diff --git a/binutils-2.22.52.0.1-relro-on-by-default.patch b/binutils-2.22.52.0.1-relro-on-by-default.patch deleted file mode 100644 index 8d9b6c1..0000000 --- a/binutils-2.22.52.0.1-relro-on-by-default.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- binutils-2.27.orig/ld/configure.tgt 2016-07-07 11:16:49.967963649 +0100 -+++ binutils-2.27/ld/configure.tgt 2016-07-07 11:17:02.252045673 +0100 -@@ -901,8 +901,8 @@ frv-*-* | hppa*-*-* | ia64-*-* | mips*-* - # FAIL: objcopy -shared -z relro (tbss2) - # FAIL: objcopy -shared -z relro (tbss3) - ;; --*-*-linux*) -- if test ${ac_default_ld_z_relro} = unset; then -+*) -+ if test x${ac_default_ld_z_relro} = xunset; then - ac_default_ld_z_relro=1 - fi - ;; diff --git a/binutils-2.26-lto.patch b/binutils-2.26-lto.patch index abe74e8..c030f71 100644 --- a/binutils-2.26-lto.patch +++ b/binutils-2.26-lto.patch @@ -135,10 +135,10 @@ diff -rup binutils-2.26.orig/bfd/elf.c binutils-2.26/bfd/elf.c +++ binutils-2.26/bfd/elf.c 2016-02-19 09:35:54.904106515 +0000 @@ -2387,6 +2387,7 @@ static const struct bfd_elf_special_sect { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE }, - { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".gnu.lto_"), -1, SHT_PROGBITS, SHF_EXCLUDE }, + { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { STRING_COMMA_LEN (".gnu_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE }, - { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 }, + { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 }, { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 }, { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 }, diff -rup binutils-2.26.orig/bfd/format.c binutils-2.26/bfd/format.c @@ -711,7 +711,7 @@ diff -rup binutils-2.26.orig/ld/emultempl/spuelf.em binutils-2.26/ld/emultempl/s if (is_spu_target ()) { @@ -432,7 +432,7 @@ gld${EMULATION_NAME}_finish (void) - einfo ("%P: --auto-overlay ignored with zero local store range\n"); + einfo (_("%P: --auto-overlay ignored with zero local store range\n")); } - finish_default (); @@ -2417,3 +2417,23 @@ diff -rup binutils-2.26.orig/ld/scripttempl/pe.sc binutils-2.26/ld/scripttempl/p LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation -LDEMUL_FINISH=gld${EMULATION_NAME}_finish +LDEMUL_FINISH=ppc_finish +--- binutils.orig/bfd/format.c 2018-01-22 16:04:36.855155517 +0000 ++++ binutils-2.30.0/bfd/format.c 2018-01-22 16:11:36.546253154 +0000 +@@ -47,6 +47,7 @@ SUBSECTION + #include "bfd.h" + #include "libbfd.h" + #if BFD_SUPPORTS_PLUGINS ++#include "plugin-api.h" + #include "plugin.h" + #endif + +--- binutils.orig/ld/ldlang.c 2018-01-22 16:04:37.271150658 +0000 ++++ binutils-2.30.0/ld/ldlang.c 2018-01-22 16:14:10.653453040 +0000 +@@ -8954,6 +8954,7 @@ cmdline_object_only_list_append (cmdline + archive = abfd->my_archive; + if (archive) + break; ++ /* Fall through. */ + case cmdline_is_file_enum: + cmdline_list_append (&cmdline_object_only_file_list, type, data); + return; diff --git a/binutils-2.27-aarch64-ifunc.patch b/binutils-2.27-aarch64-ifunc.patch new file mode 100644 index 0000000..562ef18 --- /dev/null +++ b/binutils-2.27-aarch64-ifunc.patch @@ -0,0 +1,11 @@ +diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.27/bfd/elfnn-aarch64.c +--- binutils.orig/bfd/elfnn-aarch64.c 2017-02-21 10:45:19.311956006 +0000 ++++ binutils-2.27/bfd/elfnn-aarch64.c 2017-02-21 11:55:07.517922655 +0000 +@@ -4947,6 +4947,7 @@ elfNN_aarch64_final_link_relocate (reloc + it here if it is defined in a non-shared object. */ + if (h != NULL + && h->type == STT_GNU_IFUNC ++ && (input_section->flags & SEC_ALLOC) + && h->def_regular) + { + asection *plt; diff --git a/binutils-2.28-dynamic-section-warning.patch b/binutils-2.28-dynamic-section-warning.patch deleted file mode 100644 index 804286c..0000000 --- a/binutils-2.28-dynamic-section-warning.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -rup binutils.orig/binutils/readelf.c binutils-2.28/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2017-03-20 17:06:41.260789454 +0000 -+++ binutils-2.28/binutils/readelf.c 2017-03-20 17:08:09.181289807 +0000 -@@ -4965,12 +4965,6 @@ process_program_headers (FILE * file) - section in the DYNAMIC segment. */ - dynamic_addr = segment->p_offset; - dynamic_size = segment->p_filesz; -- /* PR binutils/17512: Avoid corrupt dynamic section info in the segment. */ -- if (dynamic_addr + dynamic_size >= current_file_size) -- { -- error (_("the dynamic segment offset + size exceeds the size of the file\n")); -- dynamic_addr = dynamic_size = 0; -- } - - /* Try to locate the .dynamic section. If there is - a section header table, we can easily locate it. */ -@@ -5005,6 +4999,16 @@ process_program_headers (FILE * file) - warn (_("the .dynamic section is not the first section" - " in the dynamic segment.\n")); - } -+ -+ /* PR binutils/17512: Avoid corrupt dynamic section info in the -+ segment. Check this after matching against the section headers -+ so we don't warn on debuginfo file (which have NOBITS .dynamic -+ sections). */ -+ if (dynamic_addr + dynamic_size >= current_file_size) -+ { -+ error (_("the dynamic segment offset + size exceeds the size of the file\n")); -+ dynamic_addr = dynamic_size = 0; -+ } - break; - - case PT_INTERP: diff --git a/binutils-2.29-filename-in-error-messages.patch b/binutils-2.29-filename-in-error-messages.patch index 80ce912..d8ce241 100644 --- a/binutils-2.29-filename-in-error-messages.patch +++ b/binutils-2.29-filename-in-error-messages.patch @@ -1,16 +1,14 @@ ---- binutils.orig/binutils/readelf.c 2017-07-24 15:27:09.859116315 +0100 -+++ binutils-2.29/binutils/readelf.c 2017-07-24 15:30:33.557770525 +0100 -@@ -18414,39 +18414,50 @@ process_archive (char * file_name, FILE - static bfd_boolean - process_file (char * file_name) - { -+ char * name; -+ char * saved_program_name; - FILE * file; +--- binutils.orig/binutils/readelf.c 2018-01-22 15:48:10.450701702 +0000 ++++ binutils-2.30.0/binutils/readelf.c 2018-01-22 15:55:26.739588657 +0000 +@@ -19019,75 +19019,85 @@ process_file (char * file_name) + Filedata * filedata = NULL; struct stat statbuf; char armag[SARMAG]; - bfd_boolean ret = TRUE; - +- bfd_boolean ret = TRUE; ++ bfd_boolean ret = FALSE; ++ char * name; ++ char * saved_program_name; ++ + /* Overload program_name to include file_name. Doing this means + that warning/error messages will positively identify the file + concerned even when multiple instances of readelf are running. */ @@ -18,7 +16,7 @@ + sprintf (name, "%s: %s", program_name, file_name); + saved_program_name = program_name; + program_name = name; -+ + if (stat (file_name, &statbuf) < 0) { if (errno == ENOENT) @@ -41,32 +39,84 @@ + goto done; } - file = fopen (file_name, "rb"); - if (file == NULL) + filedata = calloc (1, sizeof * filedata); + if (filedata == NULL) + { + error (_("Out of memory allocating file data structure\n")); +- return FALSE; ++ goto done; + } + + filedata->file_name = file_name; + filedata->handle = fopen (file_name, "rb"); + if (filedata->handle == NULL) { - error (_("Input file '%s' is not readable.\n"), file_name); +- free (filedata); - return FALSE; + error (_("Not readable\n")); + goto done; } - if (fread (armag, SARMAG, 1, file) != 1) + if (fread (armag, SARMAG, 1, filedata->handle) != 1) { - error (_("%s: Failed to read file's magic number\n"), file_name); -+ error (_("Failed to read file's magic number\n")); - fclose (file); +- fclose (filedata->handle); +- free (filedata); - return FALSE; -+ ret = FALSE; -+ goto done; +- } +- +- filedata->file_size = (bfd_size_type) statbuf.st_size; +- +- if (memcmp (armag, ARMAG, SARMAG) == 0) +- { +- if (! process_archive (filedata, FALSE)) +- ret = FALSE; +- } +- else if (memcmp (armag, ARMAGT, SARMAG) == 0) +- { +- if ( ! process_archive (filedata, TRUE)) +- ret = FALSE; ++ error (_("Failed to read file's magic number\n")); } + else + { +- if (do_archive_index) +- error (_("File %s is not an archive so its index cannot be displayed.\n"), +- file_name); ++ filedata->file_size = (bfd_size_type) statbuf.st_size; - current_file_size = (bfd_size_type) statbuf.st_size; -@@ -18474,7 +18484,10 @@ process_file (char * file_name) +- rewind (filedata->handle); +- archive_file_size = archive_file_offset = 0; +- +- if (! process_object (filedata)) +- ret = FALSE; ++ if (memcmp (armag, ARMAG, SARMAG) == 0) ++ { ++ if (process_archive (filedata, FALSE)) ++ ret = TRUE; ++ } ++ else if (memcmp (armag, ARMAGT, SARMAG) == 0) ++ { ++ if (process_archive (filedata, TRUE)) ++ ret = TRUE; ++ } ++ else ++ { ++ if (do_archive_index) ++ error (_("Not an archive so its index cannot be displayed.\n")); ++ ++ rewind (filedata->handle); ++ archive_file_size = archive_file_offset = 0; ++ ++ if (process_object (filedata)) ++ ret = TRUE; ++ } } - fclose (file); + fclose (filedata->handle); + done: - current_file_size = 0; + free (filedata); + free (program_name); + program_name = saved_program_name; diff --git a/binutils-2.29-revert-PLT-elision.patch b/binutils-2.29-revert-PLT-elision.patch index 49bfd34..ac1eeaf 100644 --- a/binutils-2.29-revert-PLT-elision.patch +++ b/binutils-2.29-revert-PLT-elision.patch @@ -1,60 +1,3 @@ -diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.29.1/bfd/elf32-i386.c ---- binutils.orig/bfd/elf32-i386.c 2017-11-15 13:32:41.209042711 +0000 -+++ binutils-2.29.1/bfd/elf32-i386.c 2017-11-15 13:42:09.365205187 +0000 -@@ -2747,24 +2747,6 @@ elf_i386_allocate_dynrelocs (struct elf_ - if (h->type != STT_FUNC) - eh->func_pointer_refcount = 0; - -- /* We can't use the GOT PLT if pointer equality is needed since -- finish_dynamic_symbol won't clear symbol value and the dynamic -- linker won't update the GOT slot. We will get into an infinite -- loop at run-time. */ -- if (htab->plt_got != NULL -- && h->type != STT_GNU_IFUNC -- && !h->pointer_equality_needed -- && h->plt.refcount > 0 -- && h->got.refcount > 0) -- { -- /* Don't use the regular PLT if there are both GOT and GOTPLT -- reloctions. */ -- h->plt.offset = (bfd_vma) -1; -- -- /* Use the GOT PLT. */ -- eh->plt_got.refcount = 1; -- } -- - /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it - here if it is defined and referenced in a non-shared object. */ - if (h->type == STT_GNU_IFUNC -diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.29.1/bfd/elf64-x86-64.c ---- binutils.orig/bfd/elf64-x86-64.c 2017-11-15 13:32:41.142043517 +0000 -+++ binutils-2.29.1/bfd/elf64-x86-64.c 2017-11-15 13:41:45.030498045 +0000 -@@ -3184,24 +3184,6 @@ elf_x86_64_allocate_dynrelocs (struct el - eh->has_got_reloc, - eh); - -- /* We can't use the GOT PLT if pointer equality is needed since -- finish_dynamic_symbol won't clear symbol value and the dynamic -- linker won't update the GOT slot. We will get into an infinite -- loop at run-time. */ -- if (htab->plt_got != NULL -- && h->type != STT_GNU_IFUNC -- && !h->pointer_equality_needed -- && h->plt.refcount > 0 -- && h->got.refcount > 0) -- { -- /* Don't use the regular PLT if there are both GOT and GOTPLT -- reloctions. */ -- h->plt.offset = (bfd_vma) -1; -- -- /* Use the GOT PLT. */ -- eh->plt_got.refcount = 1; -- } -- - /* Clear the reference count of function pointer relocations if - symbol isn't a normal function. */ - if (h->type != STT_FUNC) - diff -rup binutils.orig/ld/testsuite/ld-i386/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d --- binutils.orig/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 13:32:39.335065263 +0000 +++ binutils-2.29.1/ld/testsuite/ld-i386/pltgot-1.d 2017-11-15 15:03:55.649727195 +0000 @@ -143,7 +86,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/plt-main-bnd.dd binutils-2.29.1/l -#... -Disassembly of section .plt.got: --[a-f0-9]+ <[a-z]+@plt>: +-[a-f0-9]+ <[a-z_]+@plt>: -[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <.*> +#... [ ]*[a-f0-9]+: 90 nop @@ -302,3 +245,23 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/tes +\[[ 0-9]+\] .plt +.* +\[[ 0-9]+\] .plt.got +.* +\[[ 0-9]+\] .text +PROGBITS +0+1000 0+1000 0+31a 00 +AX +0 +0 4096 +--- binutils.orig/bfd/elfxx-x86.c 2018-01-22 15:59:25.875788033 +0000 ++++ binutils-2.30.0/bfd/elfxx-x86.c 2018-01-22 16:00:20.789146597 +0000 +@@ -107,7 +107,7 @@ elf_x86_allocate_dynrelocs (struct elf_l + plt_entry_size = htab->plt.plt_entry_size; + + resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh); +- ++#if 0 + /* We can't use the GOT PLT if pointer equality is needed since + finish_dynamic_symbol won't clear symbol value and the dynamic + linker won't update the GOT slot. We will get into an infinite +@@ -125,7 +125,7 @@ elf_x86_allocate_dynrelocs (struct elf_l + /* Use the GOT PLT. */ + eh->plt_got.refcount = 1; + } +- ++#endif + /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it + here if it is defined and referenced in a non-shared object. */ + if (h->type == STT_GNU_IFUNC diff --git a/binutils-2.29-skip-rp14918-test-for-arm.patch b/binutils-2.29-skip-rp14918-test-for-arm.patch deleted file mode 100644 index d3efc7c..0000000 --- a/binutils-2.29-skip-rp14918-test-for-arm.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2017-07-24 15:24:18.365091235 +0100 -+++ binutils-2.29/ld/testsuite/ld-plugin/lto.exp 2017-07-24 15:25:25.567317336 +0100 -@@ -301,9 +301,6 @@ set lto_link_elf_tests [list \ - [list "PR ld/16746 (2)" \ - "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \ - {dummy.c} {} "pr16746b.exe"] \ -- [list "PR ld/14918" \ -- "-flto" "-flto" \ -- {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \ - [list "Build pr21382a.o" \ - "" "-O2 -flto" \ - {pr21382a.c} {} "" "c"] \ -@@ -312,6 +309,19 @@ set lto_link_elf_tests [list \ - {pr21382b.c} {} "pr21382.so" "c"] \ - ] - -+# PR 14918 checks that libgcc is not spuriously included in a shared link of -+# an empty program. The ARM crt1.o startup code however calls __libc_csu_init -+# in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs -+# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the -+# test fails. Hence this code to skip the test. -+if { ! [istarget "arm*-*-*"] } { -+ set lto_link_elf_tests [concat $lto_link_elf_tests [list \ -+ [list "PR ld/14918" \ -+ "-flto" "-flto" \ -+ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \ -+ ]] -+} -+ - # Check final symbols in executables. - set lto_link_symbol_tests [list \ - [list "LTO 3 symbol" \ diff --git a/binutils-2.29.1-gold-start-stop.patch b/binutils-2.29.1-gold-start-stop.patch deleted file mode 100644 index 3bb37c1..0000000 --- a/binutils-2.29.1-gold-start-stop.patch +++ /dev/null @@ -1,153 +0,0 @@ -diff -rup binutils.orig/gold/layout.cc binutils-2.29.1/gold/layout.cc ---- binutils.orig/gold/layout.cc 2017-10-18 12:00:31.990714767 +0100 -+++ binutils-2.29.1/gold/layout.cc 2017-10-18 12:00:41.351604074 +0100 -@@ -2211,10 +2211,11 @@ Layout::define_section_symbols(Symbol_ta - 0, // symsize - elfcpp::STT_NOTYPE, - elfcpp::STB_GLOBAL, -- elfcpp::STV_DEFAULT, -+ elfcpp::STV_PROTECTED, - 0, // nonvis - false, // offset_is_from_end -- true); // only_if_ref -+ true, // only_if_ref -+ true); // must_be_in_reg - - symtab->define_in_output_data(stop_name.c_str(), - NULL, // version -@@ -2224,10 +2225,11 @@ Layout::define_section_symbols(Symbol_ta - 0, // symsize - elfcpp::STT_NOTYPE, - elfcpp::STB_GLOBAL, -- elfcpp::STV_DEFAULT, -+ elfcpp::STV_PROTECTED, - 0, // nonvis - true, // offset_is_from_end -- true); // only_if_ref -+ true, // only_if_ref -+ true); // must_be_in_reg - } - } - } -Only in binutils-2.29.1/gold: layout.cc.orig -diff -rup binutils.orig/gold/symtab.cc binutils-2.29.1/gold/symtab.cc ---- binutils.orig/gold/symtab.cc 2017-10-18 12:00:31.990714767 +0100 -+++ binutils-2.29.1/gold/symtab.cc 2017-10-18 12:00:41.352604062 +0100 -@@ -1760,7 +1760,9 @@ Sized_symbol* - Symbol_table::define_special_symbol(const char** pname, const char** pversion, - bool only_if_ref, - Sized_symbol** poldsym, -- bool* resolve_oldsym, bool is_forced_local) -+ bool* resolve_oldsym, -+ bool is_forced_local, -+ bool must_be_in_reg) - { - *resolve_oldsym = false; - *poldsym = NULL; -@@ -1797,7 +1799,11 @@ Symbol_table::define_special_symbol(cons - oldsym = this->lookup(*pname, *pversion); - if (oldsym == NULL && is_default_version) - oldsym = this->lookup(*pname, NULL); -- if (oldsym == NULL || !oldsym->is_undefined()) -+ // If the symbol must be defined in a regular object, ignore -+ // definition from a dynamic object. -+ if (oldsym == NULL -+ || (!oldsym->is_undefined() -+ && (!must_be_in_reg || !oldsym->is_from_dynobj()))) - return NULL; - - *pname = oldsym->name(); -@@ -1916,7 +1922,8 @@ Symbol_table::define_in_output_data(cons - elfcpp::STV visibility, - unsigned char nonvis, - bool offset_is_from_end, -- bool only_if_ref) -+ bool only_if_ref, -+ bool must_be_in_reg) - { - if (parameters->target().get_size() == 32) - { -@@ -1925,7 +1932,8 @@ Symbol_table::define_in_output_data(cons - value, symsize, type, binding, - visibility, nonvis, - offset_is_from_end, -- only_if_ref); -+ only_if_ref, -+ must_be_in_reg); - #else - gold_unreachable(); - #endif -@@ -1937,7 +1945,8 @@ Symbol_table::define_in_output_data(cons - value, symsize, type, binding, - visibility, nonvis, - offset_is_from_end, -- only_if_ref); -+ only_if_ref, -+ must_be_in_reg); - #else - gold_unreachable(); - #endif -@@ -1962,7 +1971,8 @@ Symbol_table::do_define_in_output_data( - elfcpp::STV visibility, - unsigned char nonvis, - bool offset_is_from_end, -- bool only_if_ref) -+ bool only_if_ref, -+ bool must_be_in_reg) - { - Sized_symbol* sym; - Sized_symbol* oldsym; -@@ -1975,7 +1985,8 @@ Symbol_table::do_define_in_output_data( - sym = this->define_special_symbol(&name, &version, - only_if_ref, &oldsym, - &resolve_oldsym, -- is_forced_local); -+ is_forced_local, -+ must_be_in_reg); - #else - gold_unreachable(); - #endif -@@ -1986,7 +1997,8 @@ Symbol_table::do_define_in_output_data( - sym = this->define_special_symbol(&name, &version, - only_if_ref, &oldsym, - &resolve_oldsym, -- is_forced_local); -+ is_forced_local, -+ must_be_in_reg); - #else - gold_unreachable(); - #endif -diff -rup binutils.orig/gold/symtab.h binutils-2.29.1/gold/symtab.h ---- binutils.orig/gold/symtab.h 2017-10-18 12:00:32.002714624 +0100 -+++ binutils-2.29.1/gold/symtab.h 2017-10-18 12:00:41.352604062 +0100 -@@ -1488,7 +1488,8 @@ class Symbol_table - Output_data*, uint64_t value, uint64_t symsize, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis, -- bool offset_is_from_end, bool only_if_ref); -+ bool offset_is_from_end, bool only_if_ref, -+ bool must_be_in_reg = false); - - // Define a special symbol based on an Output_segment. It is a - // multiple definition error if this symbol is already defined. -@@ -1803,7 +1804,8 @@ class Symbol_table - Sized_symbol* - define_special_symbol(const char** pname, const char** pversion, - bool only_if_ref, Sized_symbol** poldsym, -- bool* resolve_oldsym, bool is_forced_local); -+ bool* resolve_oldsym, bool is_forced_local, -+ bool must_be_in_reg = false); - - // Define a symbol in an Output_data, sized version. - template -@@ -1814,7 +1816,8 @@ class Symbol_table - typename elfcpp::Elf_types::Elf_WXword ssize, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis, -- bool offset_is_from_end, bool only_if_ref); -+ bool offset_is_from_end, bool only_if_ref, -+ bool must_be_in_reg = false); - - // Define a symbol in an Output_segment, sized version. - template -Only in binutils-2.29.1/gold: symtab.h.orig diff --git a/binutils-2.29.1-readelf-use-dynamic.patch b/binutils-2.29.1-readelf-use-dynamic.patch deleted file mode 100644 index 625e584..0000000 --- a/binutils-2.29.1-readelf-use-dynamic.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.29.1/binutils/doc/binutils.texi ---- binutils.orig/binutils/doc/binutils.texi 2017-11-01 11:44:12.360707737 +0000 -+++ binutils-2.29.1/binutils/doc/binutils.texi 2017-11-01 11:45:38.702652255 +0000 -@@ -4661,8 +4661,13 @@ given. - @itemx --all - Equivalent to specifying @option{--file-header}, - @option{--program-headers}, @option{--sections}, @option{--symbols}, --@option{--relocs}, @option{--dynamic}, @option{--notes} and --@option{--version-info}. -+@option{--relocs}, @option{--dynamic}, @option{--notes}, -+@option{--version-info}, @option{--arch-specific}, @option{--unwind}, -+@option{--section-groups} and @option{--histogram}. -+ -+Note - this option does not enable @option{--use-dynamic} itself, so -+if that option is not present on the command line then dynamic symbols -+and dynamic relocs will not be displayed. - - @item -h - @itemx --file-header -@@ -4758,6 +4763,9 @@ When displaying symbols, this option mak - symbol hash tables in the file's dynamic section, rather than the - symbol table sections. - -+When displaying relocations, this option makes @command{readelf} -+display the dynamic relocations rather than the static relocations. -+ - @item -x - @itemx --hex-dump= - Displays the contents of the indicated section as a hexadecimal bytes. -diff -rup binutils.orig/binutils/readelf.c binutils-2.29.1/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2017-11-01 11:44:12.357707774 +0000 -+++ binutils-2.29.1/binutils/readelf.c 2017-11-01 11:45:11.901979878 +0000 -@@ -7117,7 +7117,21 @@ process_relocs (FILE * file) - } - - if (! found) -- printf (_("\nThere are no relocations in this file.\n")); -+ { -+ /* Users sometimes forget the -D option, so try to be helpful. */ -+ for (i = 0; i < ARRAY_SIZE (dynamic_relocations); i++) -+ { -+ if (dynamic_info [dynamic_relocations [i].size]) -+ { -+ printf (_("\nThere are no static relocations in this file.")); -+ printf (_("\nTo see the dynamic relocations add --use-dynamic to the command line.\n")); -+ -+ break; -+ } -+ } -+ if (i == ARRAY_SIZE (dynamic_relocations)) -+ printf (_("\nThere are no relocations in this file.\n")); -+ } - } - - return TRUE; diff --git a/binutils-2.29.1.tar.xz b/binutils-2.29.1.tar.xz deleted file mode 100644 index 71da3d4..0000000 Binary files a/binutils-2.29.1.tar.xz and /dev/null differ diff --git a/binutils-aarch64-pie.patch b/binutils-aarch64-pie.patch deleted file mode 100644 index 0860795..0000000 --- a/binutils-aarch64-pie.patch +++ /dev/null @@ -1,193 +0,0 @@ -Only in binutils-2.29.1/bfd: ChangeLog.orig -Only in binutils-2.29.1/bfd: ChangeLog.rej -diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.29.1/bfd/elf64-s390.c ---- binutils.orig/bfd/elf64-s390.c 2018-01-22 12:10:06.282231202 +0000 -+++ binutils-2.29.1/bfd/elf64-s390.c 2018-01-22 12:32:36.743617339 +0000 -@@ -1600,8 +1600,7 @@ elf_s390_adjust_dynamic_symbol (struct b - { - if (h->plt.refcount <= 0 - || SYMBOL_CALLS_LOCAL (info, h) -- || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT -- && h->root.type == bfd_link_hash_undefweak)) -+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - { - /* This case can occur if we saw a PLT32 reloc in an input - file, but the symbol was never referred to by a dynamic -@@ -1850,8 +1849,7 @@ allocate_dynrelocs (struct elf_link_hash - htab->elf.srelgot->size += sizeof (Elf64_External_Rela); - else if (tls_type == GOT_TLS_GD) - htab->elf.srelgot->size += 2 * sizeof (Elf64_External_Rela); -- else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -- || h->root.type != bfd_link_hash_undefweak) -+ else if (!UNDEFWEAK_NO_DYNAMIC_RELOC (info, h) - && (bfd_link_pic (info) - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->elf.srelgot->size += sizeof (Elf64_External_Rela); -@@ -1890,7 +1888,8 @@ allocate_dynrelocs (struct elf_link_hash - if (eh->dyn_relocs != NULL - && h->root.type == bfd_link_hash_undefweak) - { -- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) -+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT -+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - eh->dyn_relocs = NULL; - - /* Make sure undefined weak symbols are output as a dynamic -@@ -2307,6 +2306,7 @@ elf_s390_relocate_section (bfd *output_b - bfd_reloc_status_type r; - int tls_type; - asection *base_got = htab->elf.sgot; -+ bfd_boolean resolved_to_zero; - - r_type = ELF64_R_TYPE (rel->r_info); - if (r_type == (int) R_390_GNU_VTINHERIT -@@ -2402,6 +2402,9 @@ elf_s390_relocate_section (bfd *output_b - if (bfd_link_relocatable (info)) - continue; - -+ resolved_to_zero = (h != NULL -+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)); -+ - switch (r_type) - { - case R_390_GOTPLT12: -@@ -2489,8 +2492,7 @@ elf_s390_relocate_section (bfd *output_b - h) - || (bfd_link_pic (info) - && SYMBOL_REFERENCES_LOCAL (info, h)) -- || (ELF_ST_VISIBILITY (h->other) -- && h->root.type == bfd_link_hash_undefweak)) -+ || resolved_to_zero) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined -@@ -2804,7 +2806,8 @@ elf_s390_relocate_section (bfd *output_b - - if ((bfd_link_pic (info) - && (h == NULL -- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -+ && !resolved_to_zero) - || h->root.type != bfd_link_hash_undefweak) - && ((r_type != R_390_PC16 - && r_type != R_390_PC12DBL -@@ -3592,6 +3595,9 @@ elf_s390_finish_dynamic_symbol (bfd *out - else if (bfd_link_pic (info) - && SYMBOL_REFERENCES_LOCAL (info, h)) - { -+ if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) -+ return TRUE; -+ - /* If this is a static link, or it is a -Bsymbolic link and - the symbol is defined locally or was forced to be local - because of a version file, we just want to emit a -Only in binutils-2.29.1/bfd: elf64-s390.c.orig -diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.29.1/bfd/elf-bfd.h ---- binutils.orig/bfd/elf-bfd.h 2018-01-22 12:10:06.277231259 +0000 -+++ binutils-2.29.1/bfd/elf-bfd.h 2018-01-22 12:30:14.318245660 +0000 -@@ -266,6 +266,13 @@ struct elf_link_hash_entry - #define SYMBOL_CALLS_LOCAL(INFO, H) \ - _bfd_elf_symbol_refs_local_p (H, INFO, 1) - -+/* Whether an undefined weak symbol should resolve to its link-time -+ value, even in PIC or PIE objects. */ -+#define UNDEFWEAK_NO_DYNAMIC_RELOC(INFO, H) \ -+ ((H)->root.type == bfd_link_hash_undefweak \ -+ && (ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \ -+ || (INFO)->dynamic_undefined_weak == 0)) -+ - /* Common symbols that are turned into definitions don't have the - DEF_REGULAR flag set, so they might appear to be undefined. - Symbols defined in linker scripts also don't have DEF_REGULAR set. */ -diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.29.1/bfd/elfnn-aarch64.c ---- binutils.orig/bfd/elfnn-aarch64.c 2018-01-22 12:10:06.271231328 +0000 -+++ binutils-2.29.1/bfd/elfnn-aarch64.c 2018-01-22 12:35:13.030825190 +0000 -@@ -4578,7 +4578,7 @@ aarch64_can_relax_tls (bfd *input_bfd, - if (symbol_got_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (reloc_got_type)) - return TRUE; - -- if (bfd_link_pic (info)) -+ if (!bfd_link_executable (info)) - return FALSE; - - if (h && h->root.type == bfd_link_hash_undefweak) -@@ -4951,6 +4951,7 @@ elfNN_aarch64_final_link_relocate (reloc - bfd_boolean relative_reloc; - asection *base_got; - bfd_vma orig_value = value; -+ bfd_boolean resolved_to_zero; - - globals = elf_aarch64_hash_table (info); - -@@ -5176,6 +5177,9 @@ bad_ifunc_reloc: - } - } - -+ resolved_to_zero = (h != NULL -+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)); -+ - switch (bfd_r_type) - { - case BFD_RELOC_AARCH64_NONE: -@@ -5194,7 +5198,8 @@ bad_ifunc_reloc: - || globals->root.is_relocatable_executable) - && (input_section->flags & SEC_ALLOC) - && (h == NULL -- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -+ && !resolved_to_zero) - || h->root.type != bfd_link_hash_undefweak)) - /* Or we are creating an executable, we may need to keep relocations - for symbols satisfied by a dynamic library if we manage to avoid -@@ -6246,7 +6251,7 @@ elfNN_aarch64_relocate_section (bfd *out - indx = h && h->dynindx != -1 ? h->dynindx : 0; - - need_relocs = -- (bfd_link_pic (info) || indx != 0) && -+ (!bfd_link_executable (info) || indx != 0) && - (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak); -@@ -6341,7 +6346,7 @@ elfNN_aarch64_relocate_section (bfd *out - indx = h && h->dynindx != -1 ? h->dynindx : 0; - - need_relocs = -- (bfd_link_pic (info) || indx != 0) && -+ (!bfd_link_executable (info) || indx != 0) && - (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak); -@@ -8195,7 +8200,10 @@ elfNN_aarch64_allocate_dynrelocs (struct - if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) - && (bfd_link_pic (info) -- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) -+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) -+ /* Undefined weak symbol in static PIE resolves to 0 without -+ any dynamic relocations. */ -+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - { - htab->root.srelgot->size += RELOC_SIZE (htab); - } -@@ -8227,7 +8235,7 @@ elfNN_aarch64_allocate_dynrelocs (struct - indx = h && h->dynindx != -1 ? h->dynindx : 0; - if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) -- && (bfd_link_pic (info) -+ && (!bfd_link_executable (info) - || indx != 0 - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - { -@@ -8995,7 +9003,10 @@ elfNN_aarch64_finish_dynamic_symbol (bfd - } - - if (h->got.offset != (bfd_vma) - 1 -- && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL) -+ && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL -+ /* Undefined weak symbol in static PIE resolves to 0 without -+ any dynamic relocations. */ -+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) - { - Elf_Internal_Rela rela; - bfd_byte *loc; -Only in binutils-2.29.1/bfd: elfnn-aarch64.c.orig diff --git a/binutils-page-to-segment-assignment.patch b/binutils-page-to-segment-assignment.patch new file mode 100644 index 0000000..c622d7c --- /dev/null +++ b/binutils-page-to-segment-assignment.patch @@ -0,0 +1,77 @@ +diff --git a/bfd/elf.c b/bfd/elf.c +index c132098558..325bdd545a 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -4727,33 +4727,35 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) + the previous section, then we need a new segment. */ + new_segment = TRUE; + } ++ else if ((abfd->flags & D_PAGED) != 0 ++ && (((last_hdr->lma + last_size - 1) & -maxpagesize) ++ == (hdr->lma & -maxpagesize))) ++ { ++ /* If we are demand paged then we can't map two disk ++ pages onto the same memory page. */ ++ new_segment = FALSE; ++ } + /* In the next test we have to be careful when last_hdr->lma is close + to the end of the address space. If the aligned address wraps + around to the start of the address space, then there are no more + pages left in memory and it is OK to assume that the current + section can be included in the current segment. */ +- else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize +- > last_hdr->lma) +- && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) + maxpagesize +- <= hdr->lma)) ++ else if ((BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) ++ + maxpagesize > last_hdr->lma) ++ && (BFD_ALIGN (last_hdr->lma + last_size, maxpagesize) ++ + maxpagesize <= hdr->lma)) + { + /* If putting this section in this segment would force us to + skip a page in the segment, then we need a new segment. */ + new_segment = TRUE; + } + else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0 +- && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0 +- && ((abfd->flags & D_PAGED) == 0 +- || (((last_hdr->lma + last_size - 1) & -maxpagesize) +- != (hdr->lma & -maxpagesize)))) ++ && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0) + { + /* We don't want to put a loaded section after a + nonloaded (ie. bss style) section in the same segment + as that will force the non-loaded section to be loaded. +- Consider .tbss sections as loaded for this purpose. +- However, like the writable/non-writable case below, +- if they are on the same page then they must be put +- in the same segment. */ ++ Consider .tbss sections as loaded for this purpose. */ + new_segment = TRUE; + } + else if ((abfd->flags & D_PAGED) == 0) +@@ -4769,21 +4771,11 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) + { + new_segment = TRUE; + } +- else if (! writable +- && (hdr->flags & SEC_READONLY) == 0 +- && ((info != NULL +- && info->relro_end > info->relro_start) +- || (((last_hdr->lma + last_size - 1) & -maxpagesize) +- != (hdr->lma & -maxpagesize)))) ++ else if (! writable ++ && (hdr->flags & SEC_READONLY) == 0) + { + /* We don't want to put a writable section in a read only +- segment, unless they are on the same page in memory +- anyhow and there is no RELRO segment. We already +- know that the last section does not bring us past the +- current section on the page, so the only case in which +- the new section is not on the same page as the previous +- section is when the previous section ends precisely on +- a page boundary. */ ++ segment. */ + new_segment = TRUE; + } + else diff --git a/binutils-ppc64-stub-creation.patch b/binutils-ppc64-stub-creation.patch deleted file mode 100644 index 4f57bd8..0000000 --- a/binutils-ppc64-stub-creation.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- binutils.orig/bfd/elf64-ppc.c 2018-01-25 13:23:13.575860963 +0000 -+++ binutils-2.29.1/bfd/elf64-ppc.c 2018-01-25 13:24:36.564874275 +0000 -@@ -12805,6 +12805,9 @@ ppc64_elf_size_stubs (struct bfd_link_in - stub_sec->flags &= ~SEC_RELOC; - } - -+ if (htab->stub_iteration <= STUB_SHRINK_ITER -+ || htab->brlt->rawsize < htab->brlt->size) -+ htab->brlt->rawsize = htab->brlt->size; - htab->brlt->size = 0; - htab->brlt->reloc_count = 0; - htab->brlt->flags &= ~SEC_RELOC; -@@ -12858,6 +12861,9 @@ ppc64_elf_size_stubs (struct bfd_link_in - break; - - if (group == NULL -+ && (htab->brlt->rawsize == htab->brlt->size -+ || (htab->stub_iteration > STUB_SHRINK_ITER -+ && htab->brlt->rawsize > htab->brlt->size)) - && (htab->glink_eh_frame == NULL - || htab->glink_eh_frame->rawsize == htab->glink_eh_frame->size)) - break; diff --git a/binutils-readelf-other-sym-info.patch b/binutils-readelf-other-sym-info.patch index 9133b79..fa1b2f2 100644 --- a/binutils-readelf-other-sym-info.patch +++ b/binutils-readelf-other-sym-info.patch @@ -11,11 +11,11 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c table being generated, but for the moment this case is very rare. */ if (psym->st_other ^ vis) - printf (" [%s] ", get_symbol_other (psym->st_other ^ vis)); + printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis)); +#endif } - printf (" %3.3s ", get_symbol_index_type (psym->st_shndx)); + printf (" %3.3s ", get_symbol_index_type (filedata, psym->st_shndx)); @@ -11031,6 +11033,15 @@ print_dynamic_symbol (bfd_vma si, unsign print_symbol (25, GET_DYNAMIC_NAME (psym->st_name)); else @@ -26,7 +26,7 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c + + /* Check to see if any other bits in the st_other field are set. */ + if (psym->st_other ^ vis) -+ printf (" \t[%s]", get_symbol_other (psym->st_other ^ vis)); ++ printf (" \t[%s]", get_symbol_other (filedata, psym->st_other ^ vis)); + } +#endif putchar ('\n'); @@ -43,10 +43,10 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c Note - displaying this information disrupts the layout of the table being generated, but for the moment this case is very rare. */ if (psym->st_other ^ vis) - printf (" [%s] ", get_symbol_other (psym->st_other ^ vis)); + printf (" [%s] ", get_symbol_other (filedata, psym->st_other ^ vis)); +#endif } - printf (" %4s ", get_symbol_index_type (psym->st_shndx)); + printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx)); print_symbol (25, psym->st_name < strtab_size @@ -11571,7 +11573,15 @@ process_symbol_table (FILE * file) printf (sym_info == symbol_hidden ? "@%s" : "@@%s", @@ -58,7 +58,7 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.29/binutils/readelf.c + /* Check to see if any other bits in the st_other field are set. */ + if (psym->st_other ^ vis) -+ printf (" \t[%s] ", get_symbol_other (psym->st_other ^ vis)); ++ printf (" \t[%s] ", get_symbol_other (filedata, psym->st_other ^ vis)); + } +#endif putchar ('\n'); diff --git a/binutils-revert-PowerPC-speculation-barriers.patch b/binutils-revert-PowerPC-speculation-barriers.patch new file mode 100644 index 0000000..fe69cbf --- /dev/null +++ b/binutils-revert-PowerPC-speculation-barriers.patch @@ -0,0 +1,749 @@ +diff -rup binutils.orig/bfd/elf32-ppc.c binutils-2.30/bfd/elf32-ppc.c +--- binutils.orig/bfd/elf32-ppc.c 2018-02-08 10:49:07.649185371 +0000 ++++ binutils-2.30/bfd/elf32-ppc.c 2018-02-08 10:50:11.058395459 +0000 +@@ -69,7 +69,7 @@ static bfd_reloc_status_type ppc_elf_unh + /* For new-style .glink and .plt. */ + #define GLINK_PLTRESOLVE 16*4 + #define GLINK_ENTRY_SIZE(htab, h) \ +- (((!htab->params->speculate_indirect_jumps ? 6*4 : 4*4) \ ++ ((4*4 \ + + (h != NULL \ + && h == htab->tls_get_addr \ + && !htab->params->no_tls_get_addr_opt ? 8*4 : 0) \ +@@ -155,8 +155,6 @@ static const bfd_vma ppc_elf_vxworks_pic + #define BA 0x48000002 + #define BCL_20_31 0x429f0005 + #define BCTR 0x4e800420 +-#define CRSETEQ 0x4c421242 +-#define BEQCTRM 0x4dc20420 + #define BEQLR 0x4d820020 + #define CMPWI_11_0 0x2c0b0000 + #define LIS_11 0x3d600000 +@@ -2880,14 +2878,15 @@ ppc_elf_final_write_processing (bfd *abf + static bfd_boolean + is_nonpic_glink_stub (bfd *abfd, asection *glink, bfd_vma off) + { +- bfd_byte buf[3 * 4]; ++ bfd_byte buf[4 * 4]; + + if (!bfd_get_section_contents (abfd, glink, buf, off, sizeof buf)) + return FALSE; + + return ((bfd_get_32 (abfd, buf + 0) & 0xffff0000) == LIS_11 + && (bfd_get_32 (abfd, buf + 4) & 0xffff0000) == LWZ_11_11 +- && bfd_get_32 (abfd, buf + 8) == MTCTR_11); ++ && bfd_get_32 (abfd, buf + 8) == MTCTR_11 ++ && bfd_get_32 (abfd, buf + 12) == BCTR); + } + + static bfd_boolean +@@ -3366,7 +3365,7 @@ ppc_elf_link_hash_table_create (bfd *abf + { + struct ppc_elf_link_hash_table *ret; + static struct ppc_elf_params default_params +- = { PLT_OLD, 0, 1, 0, 1, 0, 0, 12, 0, 0, 0 }; ++ = { PLT_OLD, 0, 0, 1, 0, 0, 12, 0, 0, 0 }; + + ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table)); + if (ret == NULL) +@@ -7171,8 +7170,6 @@ ppc_elf_relax_section (bfd *abfd, + size = 4 * ARRAY_SIZE (stub_entry); + insn_offset = 0; + } +- if (!htab->params->speculate_indirect_jumps) +- size += 8; + stub_rtype = R_PPC_RELAX; + if (tsec == htab->elf.splt + || tsec == htab->glink) +@@ -7454,26 +7451,6 @@ elf_finish_pointer_linker_section (bfd * + #define PPC_HI(v) (((v) >> 16) & 0xffff) + #define PPC_HA(v) PPC_HI ((v) + 0x8000) + +-static inline bfd_byte * +-output_bctr (struct ppc_elf_link_hash_table *htab, bfd *obfd, bfd_byte *p) +-{ +- if (!htab->params->speculate_indirect_jumps) +- { +- bfd_put_32 (obfd, CRSETEQ, p); +- p += 4; +- bfd_put_32 (obfd, BEQCTRM, p); +- p += 4; +- bfd_put_32 (obfd, B, p); +- p += 4; +- } +- else +- { +- bfd_put_32 (obfd, BCTR, p); +- p += 4; +- } +- return p; +-} +- + static void + write_glink_stub (struct elf_link_hash_entry *h, struct plt_entry *ent, + asection *plt_sec, unsigned char *p, +@@ -7541,7 +7518,8 @@ write_glink_stub (struct elf_link_hash_e + p += 4; + bfd_put_32 (output_bfd, MTCTR_11, p); + p += 4; +- p = output_bctr (htab, output_bfd, p); ++ bfd_put_32 (output_bfd, BCTR, p); ++ p += 4; + while (p < end) + { + bfd_put_32 (output_bfd, htab->params->ppc476_workaround ? BA : NOP, p); +@@ -8979,7 +8957,6 @@ ppc_elf_relocate_section (bfd *output_bf + stub = stub_entry; + size = ARRAY_SIZE (stub_entry); + } +- --size; + + relocation += addend; + if (bfd_link_relocatable (info)) +@@ -9004,7 +8981,6 @@ ppc_elf_relocate_section (bfd *output_bf + bfd_put_32 (input_bfd, insn, contents + insn_offset); + insn_offset += 4; + } +- output_bctr (htab, input_bfd, contents + insn_offset); + + /* Rewrite the reloc and convert one of the trailing nop + relocs to describe this relocation. */ +@@ -10713,7 +10689,8 @@ ppc_elf_finish_dynamic_sections (bfd *ou + p += 4; + bfd_put_32 (output_bfd, ADD_11_0_11, p); + p += 4; +- p = output_bctr (htab, output_bfd, p); ++ bfd_put_32 (output_bfd, BCTR, p); ++ p += 4; + while (p < endp) + { + bfd_put_32 (output_bfd, +diff -rup binutils.orig/bfd/elf32-ppc.h binutils-2.30/bfd/elf32-ppc.h +--- binutils.orig/bfd/elf32-ppc.h 2018-02-08 10:49:07.644185433 +0000 ++++ binutils-2.30/bfd/elf32-ppc.h 2018-02-08 10:50:11.058395459 +0000 +@@ -35,9 +35,6 @@ struct ppc_elf_params + /* Set if individual PLT call stubs should be aligned. */ + int plt_stub_align; + +- /* Clear if PLT call stubs should use a speculative execution barrier. */ +- int speculate_indirect_jumps; +- + /* Whether to emit symbols for stubs. */ + int emit_stub_syms; + +diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c +--- binutils.orig/bfd/elf64-ppc.c 2018-02-08 10:49:07.645185421 +0000 ++++ binutils-2.30/bfd/elf64-ppc.c 2018-02-08 10:50:11.060395434 +0000 +@@ -161,10 +161,6 @@ static bfd_vma opd_entry_value + #define LD_R11_0R11 0xe96b0000 /* ld %r11,xxx+16@l(%r11) */ + #define BCTR 0x4e800420 /* bctr */ + +-#define CRSETEQ 0x4c421242 /* crset 4*%cr0+%eq */ +-#define BEQCTRM 0x4dc20420 /* beqctr- */ +-#define BEQCTRLM 0x4dc20421 /* beqctrl- */ +- + #define ADDI_R11_R11 0x396b0000 /* addi %r11,%r11,off@l */ + #define ADDIS_R2_R2 0x3c420000 /* addis %r2,%r2,off@ha */ + #define ADDI_R2_R2 0x38420000 /* addi %r2,%r2,off@l */ +@@ -193,8 +189,7 @@ static bfd_vma opd_entry_value + + /* __glink_PLTresolve stub instructions. We enter with the index in R0. */ + #define GLINK_PLTRESOLVE_SIZE(htab) \ +- (8u + (htab->opd_abi ? 11 * 4 : 14 * 4) \ +- + (!htab->params->speculate_indirect_jumps ? 2 * 4 : 0)) ++ (8u + (htab->opd_abi ? 11 * 4 : 14 * 4)) + /* 0: */ + /* .quad plt0-1f */ + /* __glink: */ +@@ -9886,8 +9881,6 @@ size_global_entry_stubs (struct elf_link + unsigned int align_power; + + stub_size = 16; +- if (!htab->params->speculate_indirect_jumps) +- stub_size += 8; + stub_off = s->size; + if (htab->params->plt_stub_align >= 0) + align_power = htab->params->plt_stub_align; +@@ -10453,8 +10446,6 @@ plt_stub_size (struct ppc_link_hash_tabl + size += 4; + if (PPC_HA (off) != 0) + size += 4; +- if (!htab->params->speculate_indirect_jumps) +- size += 8; + if (htab->opd_abi) + { + size += 4; +@@ -10476,11 +10467,7 @@ plt_stub_size (struct ppc_link_hash_tabl + size += 7 * 4; + if (ALWAYS_EMIT_R2SAVE + || stub_entry->stub_type == ppc_stub_plt_call_r2save) +- { +- size += 6 * 4; +- if (!htab->params->speculate_indirect_jumps) +- size -= 4; +- } ++ size += 6 * 4; + } + return size; + } +@@ -10515,26 +10502,6 @@ plt_stub_pad (struct ppc_link_hash_table + return 0; + } + +-static inline bfd_byte * +-output_bctr (struct ppc_link_hash_table *htab, bfd *obfd, bfd_byte *p) +-{ +- if (!htab->params->speculate_indirect_jumps) +- { +- bfd_put_32 (obfd, CRSETEQ, p); +- p += 4; +- bfd_put_32 (obfd, BEQCTRM, p); +- p += 4; +- bfd_put_32 (obfd, B_DOT, p); +- p += 4; +- } +- else +- { +- bfd_put_32 (obfd, BCTR, p); +- p += 4; +- } +- return p; +-} +- + /* Build a .plt call stub. */ + + static inline bfd_byte * +@@ -10555,7 +10522,6 @@ build_plt_stub (struct ppc_link_hash_tab + if (!ALWAYS_USE_FAKE_DEP + && plt_load_toc + && plt_thread_safe +- && htab->params->speculate_indirect_jumps + && !((stub_entry->h == htab->tls_get_addr_fd + || stub_entry->h == htab->tls_get_addr) + && htab->params->tls_get_addr_opt)) +@@ -10710,7 +10676,7 @@ build_plt_stub (struct ppc_link_hash_tab + bfd_put_32 (obfd, B_DOT | (cmp_branch_off & 0x3fffffc), p), p += 4; + } + else +- p = output_bctr (htab, obfd, p); ++ bfd_put_32 (obfd, BCTR, p), p += 4; + return p; + } + +@@ -10754,13 +10720,7 @@ build_tls_get_addr_stub (struct ppc_link + if (r != NULL) + r[0].r_offset += 2 * 4; + p = build_plt_stub (htab, stub_entry, p, offset, r); +- if (!htab->params->speculate_indirect_jumps) +- { +- p -= 4; +- bfd_put_32 (obfd, BEQCTRLM, p - 4); +- } +- else +- bfd_put_32 (obfd, BCTRL, p - 4); ++ bfd_put_32 (obfd, BCTRL, p - 4); + + bfd_put_32 (obfd, LD_R2_0R1 + STK_TOC (htab), p), p += 4; + bfd_put_32 (obfd, LD_R11_0R1 + STK_LINKER (htab), p), p += 4; +@@ -11113,7 +11073,8 @@ ppc_build_one_stub (struct bfd_hash_entr + p += 4; + bfd_put_32 (htab->params->stub_bfd, MTCTR_R12, p); + p += 4; +- p = output_bctr (htab, htab->params->stub_bfd, p); ++ bfd_put_32 (htab->params->stub_bfd, BCTR, p); ++ p += 4; + break; + + case ppc_stub_plt_call: +@@ -11446,8 +11407,6 @@ ppc_size_one_stub (struct bfd_hash_entry + if (PPC_LO (r2off) != 0) + size += 4; + } +- if (!htab->params->speculate_indirect_jumps) +- size += 8; + } + else if (info->emitrelocations) + { +@@ -13089,7 +13048,7 @@ build_global_entry_stubs (struct elf_lin + p += 4; + bfd_put_32 (s->owner, MTCTR_R12, p); + p += 4; +- output_bctr (htab, s->owner, p); ++ bfd_put_32 (s->owner, BCTR, p); + break; + } + return TRUE; +@@ -13218,7 +13177,8 @@ ppc64_elf_build_stubs (struct bfd_link_i + bfd_put_32 (htab->glink->owner, LD_R11_0R11 | 8, p); + p += 4; + } +- p = output_bctr (htab, htab->glink->owner, p); ++ bfd_put_32 (htab->glink->owner, BCTR, p); ++ p += 4; + BFD_ASSERT (p == htab->glink->contents + GLINK_PLTRESOLVE_SIZE (htab)); + + /* Build the .glink lazy link call stubs. */ +diff -rup binutils.orig/bfd/elf64-ppc.h binutils-2.30/bfd/elf64-ppc.h +--- binutils.orig/bfd/elf64-ppc.h 2018-02-08 10:49:07.637185520 +0000 ++++ binutils-2.30/bfd/elf64-ppc.h 2018-02-08 10:50:11.060395434 +0000 +@@ -51,9 +51,6 @@ struct ppc64_elf_params + /* Set if PLT call stubs for localentry:0 functions should omit r2 save. */ + int plt_localentry0; + +- /* Clear if PLT call stubs should use a speculative execution barrier. */ +- int speculate_indirect_jumps; +- + /* Whether to canonicalize .opd so that there are no overlapping + .opd entries. */ + int non_overlapping_opd; +diff -rup binutils.orig/gold/options.h binutils-2.30/gold/options.h +--- binutils.orig/gold/options.h 2018-02-08 10:49:07.354189045 +0000 ++++ binutils-2.30/gold/options.h 2018-02-08 10:50:11.060395434 +0000 +@@ -1108,10 +1108,6 @@ class General_options + N_("(PowerPC64 only) Optimize calls to ELFv2 localentry:0 functions"), + N_("(PowerPC64 only) Don't optimize ELFv2 calls")); + +- DEFINE_bool(speculate_indirect_jumps, options::TWO_DASHES, '\0', true, +- N_("(PowerPC only) PLT call stubs without speculation barrier"), +- N_("(PowerPC only) PLT call stubs with speculation barrier")); +- + DEFINE_bool(plt_static_chain, options::TWO_DASHES, '\0', false, + N_("(PowerPC64 only) PLT call stubs should load r11"), + N_("(PowerPC64 only) PLT call stubs should not load r11")); +diff -rup binutils.orig/gold/powerpc.cc binutils-2.30/gold/powerpc.cc +--- binutils.orig/gold/powerpc.cc 2018-02-08 10:49:07.355189033 +0000 ++++ binutils-2.30/gold/powerpc.cc 2018-02-08 10:50:11.061395422 +0000 +@@ -3781,8 +3781,6 @@ static const uint32_t b = 0x48000000; + static const uint32_t bcl_20_31 = 0x429f0005; + static const uint32_t bctr = 0x4e800420; + static const uint32_t bctrl = 0x4e800421; +-static const uint32_t beqctrm = 0x4dc20420; +-static const uint32_t beqctrlm = 0x4dc20421; + static const uint32_t beqlr = 0x4d820020; + static const uint32_t blr = 0x4e800020; + static const uint32_t bnectr_p4 = 0x4ce20420; +@@ -3792,7 +3790,6 @@ static const uint32_t cmpdi_11_0 = 0x2c2 + static const uint32_t cmpwi_11_0 = 0x2c0b0000; + static const uint32_t cror_15_15_15 = 0x4def7b82; + static const uint32_t cror_31_31_31 = 0x4ffffb82; +-static const uint32_t crseteq = 0x4c421242; + static const uint32_t ld_0_1 = 0xe8010000; + static const uint32_t ld_0_12 = 0xe80c0000; + static const uint32_t ld_2_1 = 0xe8410000; +@@ -4168,24 +4165,6 @@ write_insn(unsigned char* p, uint32_t v) + elfcpp::Swap<32, big_endian>::writeval(p, v); + } + +-template +-static unsigned char* +-output_bctr(unsigned char* p) +-{ +- if (!parameters->options().speculate_indirect_jumps()) +- { +- write_insn(p, crseteq); +- p += 4; +- write_insn(p, beqctrm); +- p += 4; +- write_insn(p, b); +- } +- else +- write_insn(p, bctr); +- p += 4; +- return p; +-} +- + template + static inline unsigned int + param_plt_align() +@@ -4454,7 +4433,6 @@ class Stub_table : public Output_relaxed + { + const Symbol* gsym = p->first.sym_; + return (4 * 4 +- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0) + + (this->targ_->is_tls_get_addr_opt(gsym) ? 8 * 4 : 0)); + } + +@@ -4470,8 +4448,6 @@ class Stub_table : public Output_relaxed + got_addr += ppcobj->toc_base_offset(); + Address off = plt_addr - got_addr; + unsigned int bytes = 4 * 4 + 4 * (ha(off) != 0); +- if (!parameters->options().speculate_indirect_jumps()) +- bytes += 2 * 4; + const Symbol* gsym = p->first.sym_; + if (this->targ_->is_tls_get_addr_opt(gsym)) + bytes += 13 * 4; +@@ -4502,8 +4478,6 @@ class Stub_table : public Output_relaxed + if (p->first.dest_ - loc + (1 << 25) < 2 << 25) + return 4; + unsigned int bytes = 16; +- if (!parameters->options().speculate_indirect_jumps()) +- bytes += 8; + if (size == 32 && parameters->options().output_is_position_independent()) + bytes += 16; + return bytes; +@@ -4955,8 +4929,7 @@ class Output_data_glink : public Output_ + { + if (size == 64) + return (8 +- + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4) +- + (!parameters->options().speculate_indirect_jumps() ? 2 * 4 : 0)); ++ + (this->targ_->abiversion() < 2 ? 11 * 4 : 14 * 4)); + return 16 * 4; + } + +@@ -5033,8 +5006,7 @@ Output_data_glink::add + std::pair p + = this->global_entry_stubs_.insert(std::make_pair(gsym, off)); + if (p.second) +- this->ge_size_ +- = off + 16 + (!parameters->options().speculate_indirect_jumps() ? 8 : 0); ++ this->ge_size_ = off + 16; + } + + template +@@ -5223,10 +5195,7 @@ Stub_table::do_write(O + = plt_load_toc && this->targ_->plt_thread_safe(); + bool use_fake_dep = false; + Address cmp_branch_off = 0; +- if (thread_safe +- && !parameters->options().speculate_indirect_jumps()) +- use_fake_dep = true; +- else if (thread_safe) ++ if (thread_safe) + { + unsigned int pltindex + = ((pltoff - this->targ_->first_plt_entry_offset()) +@@ -5274,7 +5243,7 @@ Stub_table::do_write(O + + this->targ_->stk_linker())); + p += 4; + } +- use_fake_dep |= thread_safe; ++ use_fake_dep = thread_safe; + } + if (ha(off) != 0) + { +@@ -5365,14 +5334,7 @@ Stub_table::do_write(O + if (!cs->second.localentry0_ + && this->targ_->is_tls_get_addr_opt(gsym)) + { +- if (!parameters->options().speculate_indirect_jumps()) +- { +- write_insn(p, crseteq); +- p += 4; +- write_insn(p, beqctrlm); +- } +- else +- write_insn(p, bctrl); ++ write_insn(p, bctrl); + p += 4; + write_insn(p, ld_2_1 + this->targ_->stk_toc()); + p += 4; +@@ -5391,7 +5353,7 @@ Stub_table::do_write(O + write_insn(p, b | (cmp_branch_off & 0x3fffffc)); + } + else +- output_bctr(p); ++ write_insn(p, bctr); + } + } + +@@ -5426,7 +5388,7 @@ Stub_table::do_write(O + write_insn(p, ld_12_12 + l(brltoff)), p += 4; + } + write_insn(p, mtctr_12), p += 4; +- output_bctr(p); ++ write_insn(p, bctr); + } + } + } +@@ -5522,7 +5484,7 @@ Stub_table::do_write(O + p += 4; + write_insn(p, mtctr_11); + p += 4; +- output_bctr(p); ++ write_insn(p, bctr); + } + } + +@@ -5563,7 +5525,7 @@ Stub_table::do_write(O + p += 4; + write_insn(p, mtctr_12); + p += 4; +- output_bctr(p); ++ write_insn(p, bctr); + } + } + if (this->need_save_res_) +@@ -5630,7 +5592,7 @@ Output_data_glink::do_ + write_insn(p, mtctr_12), p += 4; + write_insn(p, ld_11_11 + 8), p += 4; + } +- p = output_bctr(p); ++ write_insn(p, bctr), p += 4; + gold_assert(p == oview + this->pltresolve_size()); + + // Write lazy link call stubs. +@@ -5686,7 +5648,7 @@ Output_data_glink::do_ + write_insn(p, addis_12_12 + ha(off)), p += 4; + write_insn(p, ld_12_12 + l(off)), p += 4; + write_insn(p, mtctr_12), p += 4; +- output_bctr(p); ++ write_insn(p, bctr); + } + } + else +@@ -5778,7 +5740,8 @@ Output_data_glink::do_ + write_insn(p, add_11_0_11); + } + p += 4; +- p = output_bctr(p); ++ write_insn(p, bctr); ++ p += 4; + while (p < end_p) + { + write_insn(p, nop); +diff -rup binutils.orig/ld/emultempl/ppc32elf.em binutils-2.30/ld/emultempl/ppc32elf.em +--- binutils.orig/ld/emultempl/ppc32elf.em 2018-02-08 10:49:07.192191063 +0000 ++++ binutils-2.30/ld/emultempl/ppc32elf.em 2018-02-08 10:50:11.062395410 +0000 +@@ -38,7 +38,7 @@ static int notlsopt = 0; + /* Choose the correct place for .got. */ + static int old_got = 0; + +-static struct ppc_elf_params params = { PLT_UNSET, 0, 1, -1, ++static struct ppc_elf_params params = { PLT_UNSET, 0, -1, + 0, 0, 0, 0, 0, 0, 0 }; + + static void +@@ -246,8 +246,6 @@ enum ppc32_opt + OPTION_NO_TLS_GET_ADDR_OPT, + OPTION_NEW_PLT, + OPTION_OLD_PLT, +- OPTION_SPECULATE_INDIRECT_JUMPS, +- OPTION_NO_SPECULATE_INDIRECT_JUMPS, + OPTION_PLT_ALIGN, + OPTION_NO_PLT_ALIGN, + OPTION_OLD_GOT, +@@ -269,8 +267,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the + PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}' + { "secure-plt", no_argument, NULL, OPTION_NEW_PLT }, + { "bss-plt", no_argument, NULL, OPTION_OLD_PLT }, +- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS }, +- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS }, + { "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN }, + { "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN }, + { "sdata-got", no_argument, NULL, OPTION_OLD_GOT },' +@@ -304,12 +300,6 @@ if test -z "$VXWORKS_BASE_EM_FILE" ; the + --bss-plt Force old-style BSS PLT.\n" + )); + fprintf (file, _("\ +- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n" +- )); +- fprintf (file, _("\ +- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n" +- )); +- fprintf (file, _("\ + --plt-align Align PLT call stubs to fit cache lines.\n" + )); + fprintf (file, _("\ +@@ -360,14 +350,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI + params.plt_style = PLT_OLD; + break; + +- case OPTION_SPECULATE_INDIRECT_JUMPS: +- params.speculate_indirect_jumps = 1; +- break; +- +- case OPTION_NO_SPECULATE_INDIRECT_JUMPS: +- params.speculate_indirect_jumps = 0; +- break; +- + case OPTION_PLT_ALIGN: + if (optarg != NULL) + { +diff -rup binutils.orig/ld/emultempl/ppc64elf.em binutils-2.30/ld/emultempl/ppc64elf.em +--- binutils.orig/ld/emultempl/ppc64elf.em 2018-02-08 10:49:07.192191063 +0000 ++++ binutils-2.30/ld/emultempl/ppc64elf.em 2018-02-08 10:50:11.062395410 +0000 +@@ -38,7 +38,7 @@ static struct ppc64_elf_params params = + &ppc_layout_sections_again, + 1, -1, 0, + ${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 5, +- -1, 1, 0, -1, -1, 0}; ++ -1, 0, -1, -1, 0}; + + /* Fake input file for stubs. */ + static lang_input_statement_type *stub_file; +@@ -692,8 +692,6 @@ enum ppc64_opt + OPTION_NO_PLT_STATIC_CHAIN, + OPTION_PLT_THREAD_SAFE, + OPTION_NO_PLT_THREAD_SAFE, +- OPTION_SPECULATE_INDIRECT_JUMPS, +- OPTION_NO_SPECULATE_INDIRECT_JUMPS, + OPTION_PLT_ALIGN, + OPTION_NO_PLT_ALIGN, + OPTION_PLT_LOCALENTRY, +@@ -721,8 +719,6 @@ PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST + { "no-plt-static-chain", no_argument, NULL, OPTION_NO_PLT_STATIC_CHAIN }, + { "plt-thread-safe", no_argument, NULL, OPTION_PLT_THREAD_SAFE }, + { "no-plt-thread-safe", no_argument, NULL, OPTION_NO_PLT_THREAD_SAFE }, +- { "speculate-indirect-jumps", no_argument, NULL, OPTION_SPECULATE_INDIRECT_JUMPS }, +- { "no-speculate-indirect-jumps", no_argument, NULL, OPTION_NO_SPECULATE_INDIRECT_JUMPS }, + { "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN }, + { "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN }, + { "plt-localentry", optional_argument, NULL, OPTION_PLT_LOCALENTRY }, +@@ -764,13 +760,7 @@ PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_ + --plt-thread-safe PLT call stubs with load-load barrier.\n" + )); + fprintf (file, _("\ +- --no-plt-thread-safe PLT call stubs without load-load barrier.\n" +- )); +- fprintf (file, _("\ +- --speculate-indirect-jumps PLT call stubs without speculation barrier.\n" +- )); +- fprintf (file, _("\ +- --no-speculate-indirect-jumps PLT call stubs with speculation barrier.\n" ++ --no-plt-thread-safe PLT call stubs without barrier.\n" + )); + fprintf (file, _("\ + --plt-align [=] Align PLT call stubs to fit cache lines.\n" +@@ -860,14 +850,6 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LI + params.plt_thread_safe = 0; + break; + +- case OPTION_SPECULATE_INDIRECT_JUMPS: +- params.speculate_indirect_jumps = 1; +- break; +- +- case OPTION_NO_SPECULATE_INDIRECT_JUMPS: +- params.speculate_indirect_jumps = 0; +- break; +- + case OPTION_PLT_ALIGN: + if (optarg != NULL) + { +diff -rup binutils.orig/ld/ld.texinfo binutils-2.30/ld/ld.texinfo +--- binutils.orig/ld/ld.texinfo 2018-02-08 10:49:07.203190926 +0000 ++++ binutils-2.30/ld/ld.texinfo 2018-02-08 10:50:11.063395397 +0000 +@@ -7646,15 +7646,6 @@ looks for calls to commonly used functio + seen, adds the necessary barriers. Use these options to change the + default behaviour. + +-@cindex PowerPC64 PLT call stub speculative execution barrier +-@kindex --speculate-indirect-jumps +-@kindex --no-speculate-indirect-jumps +-@item --speculate-indirect-jumps +-@itemx --no-speculate-indirect-jumps +-Use these options to control whether all indirect branch instructions +-emitted by @code{ld}, such as those in the PLT, have a speculative +-execution barrier to mitigate Spectre variant 2 attacks. +- + @cindex PowerPC64 ELFv2 PLT localentry optimization + @kindex --plt-localentry + @kindex --no-plt-localentry +diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d +--- binutils.orig/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:49:07.261190203 +0000 ++++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2exe.d 2018-02-08 10:50:11.063395397 +0000 +@@ -1,6 +1,6 @@ + #source: elfv2.s + #as: -a64 +-#ld: -melf64ppc --speculate-indirect-jumps --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1 ++#ld: -melf64ppc --defsym f2=0x1234 --defsym f3=0x10008888 --defsym f4=0x1200000 --defsym _start=f1 + #objdump: -dr + + .* +diff -rup binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d +--- binutils.orig/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:49:07.264190166 +0000 ++++ binutils-2.30/ld/testsuite/ld-powerpc/elfv2so.d 2018-02-08 10:50:11.063395397 +0000 +@@ -1,6 +1,6 @@ + #source: elfv2.s + #as: -a64 +-#ld: -melf64ppc -shared --speculate-indirect-jumps ++#ld: -melf64ppc -shared + #objdump: -dr + + .* +diff -rup binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp +--- binutils.orig/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:49:07.261190203 +0000 ++++ binutils-2.30/ld/testsuite/ld-powerpc/powerpc.exp 2018-02-08 10:50:11.063395397 +0000 +@@ -121,11 +121,11 @@ set ppcelftests { + "tls32"} + {"TLS32 helper shared library" "-shared -melf32ppc tmpdir/tlslib32.o" "" "" {} + {} "libtlslib32.so"} +- {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {} ++ {"TLS32 dynamic exec" "-melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o tmpdir/libtlslib32.so" "" "" {} + {{readelf -WSsrl tlsexe32.r} {objdump -dr tlsexe32.d} + {objdump -sj.got tlsexe32.g} {objdump -sj.tdata tlsexe32.t}} + "tlsexe32"} +- {"TLS32 shared" "-shared -melf32ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {} ++ {"TLS32 shared" "-shared -melf32ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls32.o" "" "" {} + {{readelf -WSsrl tlsso32.r} {objdump -dr tlsso32.d} + {objdump -sj.got tlsso32.g} {objdump -sj.tdata tlsso32.t}} + "tls32.so"} +@@ -147,7 +147,7 @@ set ppcelftests { + {"TLS32 DLL" "-shared -melf32ppc --version-script tlsdll.ver" "" + "-a32" {tlsdll_32.s} + {} "tlsdll32.so"} +- {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align --speculate-indirect-jumps tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s} ++ {"TLS32 opt 5" "-melf32ppc -shared --gc-sections --secure-plt --no-plt-align tmpdir/tlsdll32.so" "" "-a32" {tlsopt5_32.s} + {{objdump -dr tlsopt5_32.d}} + "tlsopt5_32"} + {"Shared library with global symbol" "-shared -melf32ppc" "" "-a32" {sdalib.s} +@@ -174,15 +174,15 @@ set ppc64elftests { + {} "libtlslib.so"} + {"TLS helper old shared lib" "-shared -melf64ppc" "" "-a64" {oldtlslib.s} + {} "liboldlib.so"} +- {"TLS dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {} ++ {"TLS dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/libtlslib.so" "" "" {} + {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d} + {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}} + "tlsexe"} +- {"TLS dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {} ++ {"TLS dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o tmpdir/liboldlib.so" "" "" {} + {{readelf -WSsrl tlsexe.r} {objdump -dr tlsexe.d} + {objdump -sj.got tlsexe.g} {objdump -sj.tdata tlsexe.t}} + "tlsexeold"} +- {"TLS shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {} ++ {"TLS shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tls.o" "" "" {} + {{readelf -WSsrl tlsso.r} {objdump -dr tlsso.d} + {objdump -sj.got tlsso.g} {objdump -sj.tdata tlsso.t}} + "tls.so"} +@@ -190,17 +190,17 @@ set ppc64elftests { + {{objdump -dr tlstoc.d} {objdump -sj.got tlstoc.g} + {objdump -sj.tdata tlstoc.t}} + "tlstoc"} +- {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" "" ++ {"TLSTOC dynamic exec" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/libtlslib.so" "" + "" {} + {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d} + {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}} + "tlsexetoc"} +- {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" "" ++ {"TLSTOC dynamic old" "-melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o tmpdir/liboldlib.so" "" + "" {} + {{readelf -WSsrl tlsexetoc.r} {objdump -dr tlsexetoc.d} + {objdump -sj.got tlsexetoc.g} {objdump -sj.tdata tlsexetoc.t}} + "tlsexetocold"} +- {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {} ++ {"TLSTOC shared" "-shared -melf64ppc --no-plt-align --no-ld-generated-unwind-info --hash-style=sysv tmpdir/tlstoc.o" "" "" {} + {{readelf -WSsrl tlstocso.r} {objdump -dr tlstocso.d} + {objdump -sj.got tlstocso.g} {objdump -sj.tdata tlstocso.t}} + "tlstoc.so"} +@@ -221,7 +221,7 @@ set ppc64elftests { + "tlsopt4"} + {"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s} + {} "tlsdll.so"} +- {"TLS opt 5" "-melf64ppc --no-plt-align --speculate-indirect-jumps -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s} ++ {"TLS opt 5" "-melf64ppc --no-plt-align -shared --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s} + {{objdump -dr tlsopt5.d} {readelf -wf tlsopt5.wf}} + "tlsopt5"} + {"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s} +diff -rup binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d +--- binutils.orig/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:49:07.262190191 +0000 ++++ binutils-2.30/ld/testsuite/ld-powerpc/relbrlt.d 2018-02-08 10:50:11.063395397 +0000 +@@ -1,6 +1,6 @@ + #source: relbrlt.s + #as: -a64 +-#ld: -melf64ppc --no-plt-align --speculate-indirect-jumps --no-ld-generated-unwind-info --emit-relocs ++#ld: -melf64ppc --no-plt-align --no-ld-generated-unwind-info --emit-relocs + #objdump: -Dr + + .* diff --git a/binutils-skip-dwo-search-if-not-needed.patch b/binutils-skip-dwo-search-if-not-needed.patch new file mode 100644 index 0000000..4369b78 --- /dev/null +++ b/binutils-skip-dwo-search-if-not-needed.patch @@ -0,0 +1,13 @@ +--- binutils.orig/binutils/dwarf.c 2018-02-08 10:49:07.154191536 +0000 ++++ binutils-2.30/binutils/dwarf.c 2018-02-08 12:53:32.649380368 +0000 +@@ -9851,6 +9851,10 @@ load_dwo_file (const char * main_filenam + void * + load_separate_debug_file (void * file, const char * filename) + { ++ /* Skip this operation if we are not interested in debug links. */ ++ if (! do_follow_links && ! do_debug_links) ++ return NULL; ++ + /* See if there is a dwo link. */ + if (load_debug_section (str, file) + && load_debug_section (abbrev, file) diff --git a/binutils-strip-delete-relocs.patch b/binutils-strip-delete-relocs.patch deleted file mode 100644 index 798d192..0000000 --- a/binutils-strip-delete-relocs.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff -rup binutils.orig/bfd/elf64-sparc.c binutils-2.29.1/bfd/elf64-sparc.c ---- binutils.orig/bfd/elf64-sparc.c 2017-12-07 17:23:06.764174312 +0000 -+++ binutils-2.29.1/bfd/elf64-sparc.c 2017-12-07 17:23:20.540009839 +0000 -@@ -287,6 +287,7 @@ elf64_sparc_set_reloc (bfd *abfd ATTRIBU - unsigned int count) - { - asect->orelocation = location; -+ asect->reloc_count = count / 2; - canon_reloc_count (asect) = count; - } - -Only in binutils-2.29.1/bfd: elf64-sparc.c.orig -diff -rup binutils.orig/bfd/elfcode.h binutils-2.29.1/bfd/elfcode.h ---- binutils.orig/bfd/elfcode.h 2017-12-07 17:23:06.722174814 +0000 -+++ binutils-2.29.1/bfd/elfcode.h 2017-12-07 17:23:20.541009827 +0000 -@@ -958,6 +958,12 @@ elf_write_relocs (bfd *abfd, asection *s - return; - } - -+ if (ptr->howto == NULL) -+ { -+ *failedp = TRUE; -+ return; -+ } -+ - src_rela.r_offset = ptr->address + addr_offset; - src_rela.r_info = ELF_R_INFO (n, ptr->howto->type); - src_rela.r_addend = ptr->addend; -diff -rup binutils.orig/binutils/objcopy.c binutils-2.29.1/binutils/objcopy.c ---- binutils.orig/binutils/objcopy.c 2017-12-07 17:23:06.769174253 +0000 -+++ binutils-2.29.1/binutils/objcopy.c 2017-12-07 17:23:20.542009815 +0000 -@@ -3785,14 +3785,24 @@ copy_relocations_in_section (bfd *ibfd, - } - else - { -- relpp = (arelent **) xmalloc (relsize); -- relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp); -- if (relcount < 0) -+ if (isection->orelocation != NULL) - { -- status = 1; -- bfd_nonfatal_message (NULL, ibfd, isection, -- _("relocation count is negative")); -- return; -+ /* Some other function has already set up the output relocs -+ for us, so scan those instead of the default relocs. */ -+ relcount = isection->reloc_count; -+ relpp = isection->orelocation; -+ } -+ else -+ { -+ relpp = (arelent **) xmalloc (relsize); -+ relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp); -+ if (relcount < 0) -+ { -+ status = 1; -+ bfd_nonfatal_message (NULL, ibfd, isection, -+ _("relocation count is negative")); -+ return; -+ } - } - - if (strip_symbols == STRIP_ALL) -@@ -3815,7 +3825,8 @@ copy_relocations_in_section (bfd *ibfd, - temp_relpp [temp_relcount++] = relpp [i]; - } - relcount = temp_relcount; -- free (relpp); -+ if (isection->orelocation == NULL) -+ free (relpp); - relpp = temp_relpp; - } - diff --git a/binutils-support-v3-build-notes.patch b/binutils-support-v3-build-notes.patch deleted file mode 100644 index a6668f3..0000000 --- a/binutils-support-v3-build-notes.patch +++ /dev/null @@ -1,1337 +0,0 @@ -diff -rup binutils.orig/binutils/objcopy.c binutils-2.29.1/binutils/objcopy.c ---- binutils.orig/binutils/objcopy.c 2018-01-03 16:06:45.005657092 +0000 -+++ binutils-2.29.1/binutils/objcopy.c 2018-01-03 16:06:57.927502748 +0000 -@@ -1905,84 +1905,229 @@ num_bytes (unsigned long val) - return count; - } - -+typedef struct objcopy_internal_note -+{ -+ Elf_Internal_Note note; -+ bfd_vma start; -+ bfd_vma end; -+ bfd_boolean modified; -+} objcopy_internal_note; -+ -+/* Returns TRUE if a gap does, or could, exist between the address range -+ covered by PNOTE1 and PNOTE2. */ -+ -+static bfd_boolean -+gap_exists (objcopy_internal_note * pnote1, -+ objcopy_internal_note * pnote2) -+{ -+ /* Without range end notes, we assume that a gap might exist. */ -+ if (pnote1->end == 0 || pnote2->end == 0) -+ return TRUE; -+ -+ /* FIXME: Alignment of 16 bytes taken from x86_64 binaries. -+ Really we should extract the alignment of the section covered by the notes. */ -+ return BFD_ALIGN (pnote1->end, 16) < pnote2->start; -+} -+ -+static bfd_boolean -+is_open_note (objcopy_internal_note * pnote) -+{ -+ return (pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_OPEN); -+} -+ -+static bfd_boolean -+is_func_note (objcopy_internal_note * pnote) -+{ -+ return (pnote->note.type == NT_GNU_BUILD_ATTRIBUTE_FUNC); -+} -+ -+static bfd_boolean -+is_64bit (bfd * abfd) -+{ -+ /* Should never happen, but let's be paranoid. */ -+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) -+ return FALSE; -+ -+ return elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64; -+} -+ - /* Merge the notes on SEC, removing redundant entries. - Returns the new, smaller size of the section upon success. */ - - static bfd_size_type - merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte * contents) - { -- Elf_Internal_Note * pnotes_end; -- Elf_Internal_Note * pnotes; -- Elf_Internal_Note * pnote; -+ objcopy_internal_note * pnotes_end; -+ objcopy_internal_note * pnotes = NULL; -+ objcopy_internal_note * pnote; - bfd_size_type remain = size; - unsigned version_1_seen = 0; - unsigned version_2_seen = 0; -+ unsigned version_3_seen = 0; - bfd_boolean duplicate_found = FALSE; - const char * err = NULL; - bfd_byte * in = contents; - int attribute_type_byte; - int val_start; -+ unsigned long previous_func_start = 0; -+ unsigned long previous_open_start = 0; -+ unsigned long previous_func_end = 0; -+ unsigned long previous_open_end = 0; -+ long relsize; -+ - -- /* Make a copy of the notes. -+ relsize = bfd_get_reloc_upper_bound (abfd, sec); -+ if (relsize > 0) -+ { -+ arelent ** relpp; -+ long relcount; -+ -+ /* If there are relocs associated with this section then we -+ cannot safely merge it. */ -+ relpp = (arelent **) xmalloc (relsize); -+ relcount = bfd_canonicalize_reloc (abfd, sec, relpp, isympp); -+ free (relpp); -+ if (relcount != 0) -+ goto done; -+ } -+ -+ /* Make a copy of the notes and convert to our internal format. - Minimum size of a note is 12 bytes. */ -- pnote = pnotes = (Elf_Internal_Note *) xcalloc ((size / 12), sizeof (Elf_Internal_Note)); -+ pnote = pnotes = (objcopy_internal_note *) xcalloc ((size / 12), sizeof (* pnote)); - while (remain >= 12) - { -- pnote->namesz = (bfd_get_32 (abfd, in ) + 3) & ~3; -- pnote->descsz = (bfd_get_32 (abfd, in + 4) + 3) & ~3; -- pnote->type = bfd_get_32 (abfd, in + 8); -+ bfd_vma start, end; - -- if (pnote->type != NT_GNU_BUILD_ATTRIBUTE_OPEN -- && pnote->type != NT_GNU_BUILD_ATTRIBUTE_FUNC) -+ pnote->note.namesz = (bfd_get_32 (abfd, in ) + 3) & ~3; -+ pnote->note.descsz = (bfd_get_32 (abfd, in + 4) + 3) & ~3; -+ pnote->note.type = bfd_get_32 (abfd, in + 8); -+ -+ if (pnote->note.type != NT_GNU_BUILD_ATTRIBUTE_OPEN -+ && pnote->note.type != NT_GNU_BUILD_ATTRIBUTE_FUNC) - { - err = _("corrupt GNU build attribute note: wrong note type"); - goto done; - } - -- if (pnote->namesz + pnote->descsz + 12 > remain) -+ if (pnote->note.namesz + pnote->note.descsz + 12 > remain) - { - err = _("corrupt GNU build attribute note: note too big"); - goto done; - } - -- if (pnote->namesz < 2) -+ if (pnote->note.namesz < 2) - { - err = _("corrupt GNU build attribute note: name too small"); - goto done; - } - -- if (pnote->descsz != 0 -- && pnote->descsz != 4 -- && pnote->descsz != 8) -+ pnote->note.namedata = (char *)(in + 12); -+ pnote->note.descdata = (char *)(in + 12 + pnote->note.namesz); -+ -+ remain -= 12 + pnote->note.namesz + pnote->note.descsz; -+ in += 12 + pnote->note.namesz + pnote->note.descsz; -+ -+ if (pnote->note.namesz > 2 -+ && pnote->note.namedata[0] == '$' -+ && pnote->note.namedata[1] == GNU_BUILD_ATTRIBUTE_VERSION -+ && pnote->note.namedata[2] == '1') -+ ++ version_1_seen; -+ else if (pnote->note.namesz > 4 -+ && pnote->note.namedata[0] == 'G' -+ && pnote->note.namedata[1] == 'A' -+ && pnote->note.namedata[2] == '$' -+ && pnote->note.namedata[3] == GNU_BUILD_ATTRIBUTE_VERSION) - { -+ if (pnote->note.namedata[4] == '2') -+ ++ version_2_seen; -+ else if (pnote->note.namedata[4] == '3') -+ ++ version_3_seen; -+ else -+ { -+ err = _("corrupt GNU build attribute note: unsupported version"); -+ goto done; -+ } -+ } -+ -+ switch (pnote->note.descsz) -+ { -+ case 0: -+ start = end = 0; -+ break; -+ -+ case 4: -+ start = bfd_get_32 (abfd, pnote->note.descdata); -+ /* FIXME: For version 1 and 2 notes we should try to -+ calculate the end address by finding a symbol whose -+ value is START, and then adding in its size. -+ -+ For now though, since v1 and v2 was not intended to -+ handle gaps, we chose an artificially large end -+ address. */ -+ end = 0x7ffffffffffffffUL; -+ break; -+ -+ case 8: -+ if (! is_64bit (abfd)) -+ { -+ start = bfd_get_32 (abfd, pnote->note.descdata); -+ end = bfd_get_32 (abfd, pnote->note.descdata + 4); -+ } -+ else -+ { -+ start = bfd_get_64 (abfd, pnote->note.descdata); -+ /* FIXME: For version 1 and 2 notes we should try to -+ calculate the end address by finding a symbol whose -+ value is START, and then adding in its size. -+ -+ For now though, since v1 and v2 was not intended to -+ handle gaps, we chose an artificially large end -+ address. */ -+ end = 0x7ffffffffffffffUL; -+ } -+ break; -+ -+ case 16: -+ start = bfd_get_64 (abfd, pnote->note.descdata); -+ end = bfd_get_64 (abfd, pnote->note.descdata + 8); -+ break; -+ -+ default: - err = _("corrupt GNU build attribute note: bad description size"); - goto done; - } - -- pnote->namedata = (char *)(in + 12); -- pnote->descdata = (char *)(in + 12 + pnote->namesz); -+ if (is_open_note (pnote)) -+ { -+ if (start) -+ previous_open_start = start; -+ -+ pnote->start = previous_open_start; - -- remain -= 12 + pnote->namesz + pnote->descsz; -- in += 12 + pnote->namesz + pnote->descsz; -+ if (end) -+ previous_open_end = end; - -- if (pnote->namedata[pnote->namesz - 1] != 0) -+ pnote->end = previous_open_end; -+ } -+ else -+ { -+ if (start) -+ previous_func_start = start; -+ -+ pnote->start = previous_func_start; -+ -+ if (end) -+ previous_func_end = end; -+ -+ pnote->end = previous_func_end; -+ } -+ -+ if (pnote->note.namedata[pnote->note.namesz - 1] != 0) - { - err = _("corrupt GNU build attribute note: name not NUL terminated"); - goto done; - } -- -- if (pnote->namesz > 2 -- && pnote->namedata[0] == '$' -- && pnote->namedata[1] == GNU_BUILD_ATTRIBUTE_VERSION -- && pnote->namedata[2] == '1') -- ++ version_1_seen; -- else if (pnote->namesz > 4 -- && pnote->namedata[0] == 'G' -- && pnote->namedata[1] == 'A' -- && pnote->namedata[2] == '$' -- && pnote->namedata[3] == GNU_BUILD_ATTRIBUTE_VERSION -- && pnote->namedata[4] == '2') -- ++ version_2_seen; -+ - pnote ++; - } - -@@ -1995,27 +2140,29 @@ merge_gnu_build_notes (bfd * abfd, asect - goto done; - } - -- if (version_1_seen == 0 && version_2_seen == 0) -+ if (version_1_seen == 0 && version_2_seen == 0 && version_3_seen == 0) - { - err = _("bad GNU build attribute notes: no known versions detected"); - goto done; - } - -- if (version_1_seen > 0 && version_2_seen > 0) -+ if ((version_1_seen > 0 && version_2_seen > 0) -+ || (version_1_seen > 0 && version_3_seen > 0) -+ || (version_2_seen > 0 && version_3_seen > 0)) - { - err = _("bad GNU build attribute notes: multiple different versions"); - goto done; - } - - /* Merging is only needed if there is more than one version note... */ -- if (version_1_seen == 1 || version_2_seen == 1) -+ if (version_1_seen == 1 || version_2_seen == 1 || version_3_seen == 1) - goto done; - - attribute_type_byte = version_1_seen ? 1 : 3; - val_start = attribute_type_byte + 1; - - /* The first note should be the first version note. */ -- if (pnotes[0].namedata[attribute_type_byte] != GNU_BUILD_ATTRIBUTE_VERSION) -+ if (pnotes[0].note.namedata[attribute_type_byte] != GNU_BUILD_ATTRIBUTE_VERSION) - { - err = _("bad GNU build attribute notes: first note not version note"); - goto done; -@@ -2026,7 +2173,9 @@ merge_gnu_build_notes (bfd * abfd, asect - 2. Preserve any NT_GNU_BUILD_ATTRIBUTE_FUNC notes. - 3. Eliminate any NT_GNU_BUILD_ATTRIBUTE_OPEN notes that have the same - full name field as the immediately preceeding note with the same type -- of name. -+ of name and whose address ranges coincide. -+ IE - it there are gaps in the coverage of the notes, then these gaps -+ must be preserved. - 4. Combine the numeric value of any NT_GNU_BUILD_ATTRIBUTE_OPEN notes - of type GNU_BUILD_ATTRIBUTE_STACK_SIZE. - 5. If an NT_GNU_BUILD_ATTRIBUTE_OPEN note is going to be preserved and -@@ -2036,103 +2185,134 @@ merge_gnu_build_notes (bfd * abfd, asect - address to which it refers. */ - for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++) - { -- Elf_Internal_Note * back; -- Elf_Internal_Note * prev_open = NULL; -+ int note_type; -+ objcopy_internal_note * back; -+ objcopy_internal_note * prev_open_with_range = NULL; - -- if (pnote->type == NT_GNU_BUILD_ATTRIBUTE_FUNC) -+ /* Rule 2 - preserve function notes. */ -+ if (! is_open_note (pnote)) - continue; - -- /* Scan for duplicates. Clear the type field of any found - but do not -- delete them just yet. */ -+ note_type = pnote->note.namedata[attribute_type_byte]; -+ -+ /* Scan backwards from pnote, looking for duplicates. -+ Clear the type field of any found - but do not delete them just yet. */ - for (back = pnote - 1; back >= pnotes; back --) - { -- if (back->descsz > 0 -- && back->type != NT_GNU_BUILD_ATTRIBUTE_FUNC -- && prev_open == NULL) -- prev_open = back; -+ int back_type = back->note.namedata[attribute_type_byte]; -+ -+ /* If this is the first open note with an address -+ range that we have encountered then record it. */ -+ if (prev_open_with_range == NULL -+ && back->note.descsz > 0 -+ && ! is_func_note (back)) -+ prev_open_with_range = back; -+ -+ if (! is_open_note (back)) -+ continue; -+ -+ /* If the two notes are different then keep on searching. */ -+ if (back_type != note_type) -+ continue; - -- if (back->type == pnote->type -- && back->namedata[attribute_type_byte] == pnote->namedata[attribute_type_byte]) -+ /* Rule 4 - combine stack size notes. */ -+ if (back_type == GNU_BUILD_ATTRIBUTE_STACK_SIZE) - { -- if (back->namedata[attribute_type_byte] == GNU_BUILD_ATTRIBUTE_STACK_SIZE) -+ unsigned char * name; -+ unsigned long note_val; -+ unsigned long back_val; -+ unsigned int shift; -+ unsigned int bytes; -+ unsigned long byte; -+ -+ for (shift = 0, note_val = 0, -+ bytes = pnote->note.namesz - val_start, -+ name = (unsigned char *) pnote->note.namedata + val_start; -+ bytes--;) - { -- unsigned char * name; -- unsigned long note_val; -- unsigned long back_val; -- unsigned int shift; -- unsigned int bytes; -- unsigned long byte; -- -- for (shift = 0, note_val = 0, -- bytes = pnote->namesz - val_start, -- name = (unsigned char *) pnote->namedata + val_start; -- bytes--;) -- { -- byte = (* name ++) & 0xff; -- note_val |= byte << shift; -- shift += 8; -- } -- -- for (shift = 0, back_val = 0, -- bytes = back->namesz - val_start, -- name = (unsigned char *) back->namedata + val_start; -- bytes--;) -- { -- byte = (* name ++) & 0xff; -- back_val |= byte << shift; -- shift += 8; -- } -- -- back_val += note_val; -- if (num_bytes (back_val) >= back->namesz - val_start) -- { -- /* We have a problem - the new value requires more bytes of -- storage in the name field than are available. Currently -- we have no way of fixing this, so we just preserve both -- notes. */ -- continue; -- } -- -- /* Write the new val into back. */ -- name = (unsigned char *) back->namedata + val_start; -- while (name < (unsigned char *) back->namedata + back->namesz) -- { -- byte = back_val & 0xff; -- * name ++ = byte; -- if (back_val == 0) -- break; -- back_val >>= 8; -- } -- -- duplicate_found = TRUE; -- pnote->type = 0; -- break; -+ byte = (* name ++) & 0xff; -+ note_val |= byte << shift; -+ shift += 8; - } -- -- if (back->namesz == pnote->namesz -- && memcmp (back->namedata, pnote->namedata, back->namesz) == 0) -+ -+ for (shift = 0, back_val = 0, -+ bytes = back->note.namesz - val_start, -+ name = (unsigned char *) back->note.namedata + val_start; -+ bytes--;) - { -- duplicate_found = TRUE; -- pnote->type = 0; -- break; -+ byte = (* name ++) & 0xff; -+ back_val |= byte << shift; -+ shift += 8; - } - -- /* If we have found an attribute match then stop searching backwards. */ -- if (! ISPRINT (back->namedata[attribute_type_byte]) -- /* Names are NUL terminated, so this is safe. */ -- || strcmp (back->namedata + val_start, pnote->namedata + val_start) == 0) -+ back_val += note_val; -+ if (num_bytes (back_val) >= back->note.namesz - val_start) - { -- /* Since we are keeping this note we must check to see if its -- description refers back to an earlier OPEN version note. If so -- then we must make sure that version note is also preserved. */ -- if (pnote->descsz == 0 -- && prev_open != NULL -- && prev_open->type == 0) -- prev_open->type = NT_GNU_BUILD_ATTRIBUTE_FUNC; -+ /* We have a problem - the new value requires more bytes of -+ storage in the name field than are available. Currently -+ we have no way of fixing this, so we just preserve both -+ notes. */ -+ continue; -+ } - -- break; -+ /* Write the new val into back. */ -+ name = (unsigned char *) back->note.namedata + val_start; -+ while (name < (unsigned char *) back->note.namedata -+ + back->note.namesz) -+ { -+ byte = back_val & 0xff; -+ * name ++ = byte; -+ if (back_val == 0) -+ break; -+ back_val >>= 8; - } -+ -+ duplicate_found = TRUE; -+ pnote->note.type = 0; -+ break; -+ } -+ -+ /* Rule 3 - combine identical open notes. */ -+ if (back->note.namesz == pnote->note.namesz -+ && memcmp (back->note.namedata, -+ pnote->note.namedata, back->note.namesz) == 0 -+ && ! gap_exists (back, pnote)) -+ { -+ duplicate_found = TRUE; -+ pnote->note.type = 0; -+ -+ if (pnote->end > back->end) -+ back->end = pnote->end; -+ -+ if (version_3_seen) -+ back->modified = TRUE; -+ break; - } -+ -+ /* Rule 5 - Since we are keeping this note we must check to see -+ if its description refers back to an earlier OPEN version -+ note that has been scheduled for deletion. If so then we -+ must make sure that version note is also preserved. */ -+ if (version_3_seen) -+ { -+ /* As of version 3 we can just -+ move the range into the note. */ -+ pnote->modified = TRUE; -+ pnote->note.type = NT_GNU_BUILD_ATTRIBUTE_FUNC; -+ back->modified = TRUE; -+ back->note.type = NT_GNU_BUILD_ATTRIBUTE_FUNC; -+ } -+ else -+ { -+ if (pnote->note.descsz == 0 -+ && prev_open_with_range != NULL -+ && prev_open_with_range->note.type == 0) -+ prev_open_with_range->note.type = NT_GNU_BUILD_ATTRIBUTE_OPEN; -+ } -+ -+ /* We have found a similar attribute but the details do not match. -+ Stop searching backwards. */ -+ break; - } - } - -@@ -2142,22 +2322,8 @@ merge_gnu_build_notes (bfd * abfd, asect - bfd_byte * old; - bfd_byte * new; - bfd_size_type new_size; -- arelent ** relpp = NULL; -- long relsize; -- long relcount = 0; -- -- relsize = bfd_get_reloc_upper_bound (abfd, sec); -- if (relsize > 0) -- { -- /* If there are relocs associated with this section then we may -- have to adjust them as well, as we remove notes. */ -- relpp = (arelent **) xmalloc (relsize); -- relcount = bfd_canonicalize_reloc (abfd, sec, relpp, isympp); -- if (relcount < 0) -- /* Do not bother complaining here - copy_relocations_in_section -- will do that for us. */ -- relcount = 0; -- } -+ bfd_vma prev_start = 0; -+ bfd_vma prev_end = 0; - - /* Eliminate the duplicates. */ - new = new_contents = xmalloc (size); -@@ -2165,36 +2331,52 @@ merge_gnu_build_notes (bfd * abfd, asect - pnote < pnotes_end; - pnote ++) - { -- bfd_size_type note_size = 12 + pnote->namesz + pnote->descsz; -+ bfd_size_type note_size = 12 + pnote->note.namesz + pnote->note.descsz; - -- if (pnote->type == 0) -+ if (pnote->note.type != 0) - { -- if (relcount > 0) -+ if (pnote->modified) - { -- arelent ** rel; -- -- /* If there is a reloc at the current offset, delete it. -- Adjust the location of any relocs above the current -- location downwards by the size of the note being deleted. -- FIXME: We could optimize this loop by retaining a pointer to -- the last reloc below the current note. */ -- for (rel = relpp; rel < relpp + relcount; rel ++) -+ /* If the note has been modified then we must copy it by -+ hand, potentially adding in a new description field. */ -+ if (pnote->start == prev_start && pnote->end == prev_end) - { -- if ((* rel)->howto == NULL) -- continue; -- if ((* rel)->address < (bfd_vma) (new - new_contents)) -- continue; -- if ((* rel)->address >= (bfd_vma) ((new + note_size) - new_contents)) -- (* rel)->address -= note_size; -+ bfd_put_32 (abfd, pnote->note.namesz, new); -+ bfd_put_32 (abfd, 0, new + 4); -+ bfd_put_32 (abfd, pnote->note.type, new + 8); -+ new += 12; -+ memcpy (new, pnote->note.namedata, pnote->note.namesz); -+ new += pnote->note.namesz; -+ } -+ else -+ { -+ bfd_put_32 (abfd, pnote->note.namesz, new); -+ bfd_put_32 (abfd, is_64bit (abfd) ? 16 : 8, new + 4); -+ bfd_put_32 (abfd, pnote->note.type, new + 8); -+ new += 12; -+ memcpy (new, pnote->note.namedata, pnote->note.namesz); -+ new += pnote->note.namesz; -+ if (is_64bit (abfd)) -+ { -+ bfd_put_64 (abfd, pnote->start, new); -+ bfd_put_64 (abfd, pnote->end, new + 8); -+ new += 16; -+ } - else -- (* rel)->howto = NULL; -+ { -+ bfd_put_32 (abfd, pnote->start, new); -+ bfd_put_32 (abfd, pnote->end, new + 4); -+ new += 8; -+ } - } - } -- } -- else -- { -- memcpy (new, old, note_size); -- new += note_size; -+ else -+ { -+ memcpy (new, old, note_size); -+ new += note_size; -+ } -+ prev_start = pnote->start; -+ prev_end = pnote->end; - } - - old += note_size; -@@ -2204,24 +2386,6 @@ merge_gnu_build_notes (bfd * abfd, asect - memcpy (contents, new_contents, new_size); - size = new_size; - free (new_contents); -- -- if (relcount > 0) -- { -- arelent **rel = relpp; -- -- while (rel < relpp + relcount) -- if ((*rel)->howto != NULL) -- rel++; -- else -- { -- /* Delete eliminated relocs. -- FIXME: There are better ways to do this. */ -- memmove (rel, rel + 1, -- ((relcount - (rel - relpp)) - 1) * sizeof (*rel)); -- relcount--; -- } -- bfd_set_reloc (abfd, sec, relpp, relcount); -- } - } - - done: -diff -rup binutils.orig/binutils/readelf.c binutils-2.29.1/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2018-01-03 16:06:45.005657092 +0000 -+++ binutils-2.29.1/binutils/readelf.c 2018-01-03 16:28:24.417115970 +0000 -@@ -16247,9 +16247,9 @@ get_note_type (unsigned e_type) - case NT_ARCH: - return _("NT_ARCH (architecture)"); - case NT_GNU_BUILD_ATTRIBUTE_OPEN: -- return _("NT_GNU_BUILD_ATTRIBUTE_OPEN"); -+ return _("OPEN"); - case NT_GNU_BUILD_ATTRIBUTE_FUNC: -- return _("NT_GNU_BUILD_ATTRIBUTE_FUNC"); -+ return _("func"); - default: - break; - } -@@ -17064,13 +17064,16 @@ print_ia64_vms_note (Elf_Internal_Note * - return TRUE; - } - --/* Print the name of the symbol associated with a build attribute -- that is attached to address OFFSET. */ -- --static bfd_boolean --print_symbol_for_build_attribute (FILE * file, -- unsigned long offset, -- bfd_boolean is_open_attr) -+/* Find the symbol associated with a build attribute that is attached -+ to address OFFSET. If PNAME is non-NULL then store the name of -+ the symbol (if found) in the provided pointer, Returns NULL if a -+ symbol could not be found. */ -+ -+static Elf_Internal_Sym * -+get_symbol_for_build_attribute (FILE * file, -+ unsigned long offset, -+ bfd_boolean is_open_attr, -+ const char ** pname) - { - static FILE * saved_file = NULL; - static char * strtab; -@@ -17109,10 +17112,7 @@ print_symbol_for_build_attribute (FILE * - } - - if (symtab == NULL || strtab == NULL) -- { -- printf ("\n"); -- return FALSE; -- } -+ return NULL; - - /* Find a symbol whose value matches offset. */ - for (sym = symtab; sym < symtab + nsyms; sym ++) -@@ -17132,14 +17132,15 @@ print_symbol_for_build_attribute (FILE * - FUNC symbols entirely. */ - switch (ELF_ST_TYPE (sym->st_info)) - { -- case STT_FILE: -- saved_sym = sym; -- /* We can stop searching now. */ -- sym = symtab + nsyms; -- continue; -- - case STT_OBJECT: -+ case STT_FILE: - saved_sym = sym; -+ if (sym->st_size) -+ { -+ /* If the symbol has a size associated -+ with it then we can stop searching. */ -+ sym = symtab + nsyms; -+ } - continue; - - case STT_FUNC: -@@ -17177,55 +17178,118 @@ print_symbol_for_build_attribute (FILE * - } - } - -- printf (" (%s: %s)\n", -- is_open_attr ? _("file") : _("func"), -- saved_sym ? strtab + saved_sym->st_name : _(")")); -- return TRUE; -+ if (saved_sym && pname) -+ * pname = strtab + saved_sym->st_name; -+ -+ return saved_sym; - } - - static bfd_boolean - print_gnu_build_attribute_description (Elf_Internal_Note * pnote, - FILE * file) - { -- static unsigned long global_offset = 0; -- unsigned long offset; -- unsigned int desc_size = is_32bit_elf ? 4 : 8; -- bfd_boolean is_open_attr = pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN; -- -- if (pnote->descsz == 0) -- { -+ static unsigned long global_offset = 0; -+ static unsigned long global_end = 0; -+ static unsigned long func_offset = 0; -+ static unsigned long func_end = 0; -+ -+ Elf_Internal_Sym * sym; -+ const char * name; -+ unsigned long start; -+ unsigned long end; -+ bfd_boolean is_open_attr = pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN; -+ -+ switch (pnote->descsz) -+ { -+ case 0: -+ /* A zero-length description means that the range of -+ the previous note of the same type should be used. */ - if (is_open_attr) - { -- printf (_(" Applies from offset %#lx\n"), global_offset); -- return TRUE; -+ if (global_end > global_offset) -+ printf (_(" Applies to region from %#lx to %#lx\n"), -+ global_offset, global_end); -+ else -+ printf (_(" Applies to region from %#lx\n"), global_offset); - } - else - { -- printf (_(" Applies to func at %#lx"), global_offset); -- return print_symbol_for_build_attribute (file, global_offset, is_open_attr); -+ if (func_end > func_offset) -+ printf (_(" Applies to region from %#lx to %#lx\n"), func_offset, func_end); -+ else -+ printf (_(" Applies to region from %#lx\n"), func_offset); - } -- } -+ return TRUE; - -- if (pnote->descsz != desc_size) -- { -+ case 4: -+ start = byte_get ((unsigned char *) pnote->descdata, 4); -+ end = 0; -+ break; -+ -+ case 8: -+ if (is_32bit_elf) -+ { -+ /* FIXME: We should check that version 3+ notes are being used here... */ -+ start = byte_get ((unsigned char *) pnote->descdata, 4); -+ end = byte_get ((unsigned char *) pnote->descdata + 4, 4); -+ } -+ else -+ { -+ start = byte_get ((unsigned char *) pnote->descdata, 8); -+ end = 0; -+ } -+ break; -+ -+ case 16: -+ start = byte_get ((unsigned char *) pnote->descdata, 8); -+ end = byte_get ((unsigned char *) pnote->descdata + 8, 8); -+ break; -+ -+ default: - error (_(" \n"), pnote->descsz); - printf (_(" ")); - return FALSE; - } - -- offset = byte_get ((unsigned char *) pnote->descdata, desc_size); -+ name = NULL; -+ sym = get_symbol_for_build_attribute (file, start, is_open_attr, & name); -+ -+ if (end == 0 && sym != NULL && sym->st_size > 0) -+ end = start + sym->st_size; - - if (is_open_attr) - { -- printf (_(" Applies from offset %#lx"), offset); -- global_offset = offset; -+ /* FIXME: Need to properly allow for section alignment. 16 is just the alignment used on x86_64. */ -+ if (global_end > 0 && start > BFD_ALIGN (global_end, 16)) -+ warn (_("Gap in build notes detected from %#lx to %#lx\n"), -+ global_end + 1, start - 1); -+ -+ printf (_(" Applies to region from %#lx"), start); -+ global_offset = start; -+ -+ if (end) -+ { -+ printf (_(" to %#lx"), end); -+ global_end = end; -+ } - } - else - { -- printf (_(" Applies to func at %#lx"), offset); -+ printf (_(" Applies to region from %#lx"), start); -+ func_offset = start; -+ -+ if (end) -+ { -+ printf (_(" to %#lx"), end); -+ func_end = end; -+ } - } - -- return print_symbol_for_build_attribute (file, offset, is_open_attr); -+ if (sym && name) -+ printf (_(" (%s)"), name); -+ -+ printf ("\n"); -+ return TRUE; - } - - static bfd_boolean -@@ -17248,11 +17312,21 @@ print_gnu_build_attribute_name (Elf_Inte - return FALSE; - } - -- left = 20; -+ if (do_wide) -+ left = 28; -+ else -+ left = 20; - - /* Version 2 of the spec adds a "GA" prefix to the name field. */ - if (name[0] == 'G' && name[1] == 'A') - { -+ if (pnote->namesz < 4) -+ { -+ error (_("corrupt name field in GNU build attribute note: size = %ld\n"), pnote->namesz); -+ print_symbol (-20, _(" ")); -+ return FALSE; -+ } -+ - printf ("GA"); - name += 2; - left -= 2; -diff -rup binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r.d binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r.d ---- binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r.d 2018-01-03 16:06:45.013656996 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r.d 2018-01-03 16:06:57.927502748 +0000 -@@ -5,7 +5,5 @@ - #as: -32 - #source: ../note-2-32.s - --Relocation section '\.rel\.gnu\.build\.attributes' at offset .* contains 2 entries: -- Offset Info Type Sym\.Value Sym\. Name --00000010 ......02 R_MIPS_32 00000100 note1\.s --0000006c ......02 R_MIPS_32 00000104 note2\.s -+There are no relocations in this file. -+#... -diff -rup binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d ---- binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d 2018-01-03 16:06:45.014656984 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d 2018-01-03 16:06:57.927502748 +0000 -@@ -5,7 +5,5 @@ - #as: -n32 -mips3 - #source: ../note-2-32.s - --Relocation section '\.rela\.gnu\.build\.attributes' at offset .* contains 2 entries: -- Offset Info Type Sym\.Value Sym\. Name \+ Addend --00000010 ......02 R_MIPS_32 00000100 note1\.s \+ 0 --0000006c ......02 R_MIPS_32 00000104 note2\.s \+ 0 -+There are no relocations in this file. -+#... -diff -rup binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d ---- binutils.orig/binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d 2018-01-03 16:06:45.014656984 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d 2018-01-03 16:06:57.927502748 +0000 -@@ -5,11 +5,5 @@ - #as: -64 -mips3 - #source: ../note-2-64.s - --Relocation section '\.rela\.gnu\.build\.attributes' at offset .* contains 2 entries: -- Offset Info Type Sym\. Value Sym\. Name \+ Addend --000000000010 ....00000012 R_MIPS_64 0000000000000100 note1\.s \+ 0 -- Type2: R_MIPS_NONE -- Type3: R_MIPS_NONE --000000000070 ....00000012 R_MIPS_64 0000000000000104 note2\.s \+ 0 -- Type2: R_MIPS_NONE -- Type3: R_MIPS_NONE -+There are no relocations in this file. -+#... -diff -rup binutils.orig/binutils/testsuite/binutils-all/note-2-32.d binutils-2.29.1/binutils/testsuite/binutils-all/note-2-32.d ---- binutils.orig/binutils/testsuite/binutils-all/note-2-32.d 2018-01-03 16:06:45.013656996 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-2-32.d 2018-01-03 16:06:57.927502748 +0000 -@@ -6,12 +6,12 @@ - - #... - Owner Data size Description --[ ]+\$1[ ]+0x00000004[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note1.s\) --[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\+true[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\*static[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\*0x0[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\$1[ ]+0x00000004[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x10. \(file: note2.s\) --[ ]+!false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x10. --[ ]+\*pic[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_FUNC[ ]+Applies to func at 0x10. \(func: func1\) -+[ ]+\$1[ ]+0x00000004[ ]+OPEN[ ]+Applies to region from 0x100 \(note1.s\) -+[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\+true[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\*0x0[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\$1[ ]+0x00000004[ ]+OPEN[ ]+Applies to region from 0x104 \(note2.s\) -+[ ]+!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x104 -+[ ]+\*pic[ ]+0x00000004[ ]+func[ ]+Applies to region from 0x104 \(func1\) - #... -diff -rup binutils.orig/binutils/testsuite/binutils-all/note-2-32.s binutils-2.29.1/binutils/testsuite/binutils-all/note-2-32.s ---- binutils.orig/binutils/testsuite/binutils-all/note-2-32.s 2018-01-03 16:06:45.010657032 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-2-32.s 2018-01-03 16:06:57.927502748 +0000 -@@ -2,7 +2,7 @@ - .org 0x100 - .global note1.s - note1.s: -- .word 0 -+ .dc.l 0 - - .pushsection .gnu.build.attributes, "0x100000", %note - .balign 4 -@@ -10,7 +10,7 @@ note1.s: - .dc.l 4 - .dc.l 0x100 - .asciz "$1" -- .dc.l note1.s -+ .dc.l 0x100 - - .dc.l 12 - .dc.l 0 -@@ -39,14 +39,14 @@ note1.s: - note2.s: - .type func1, STT_FUNC - func1: -- .word 0x100 -+ .dc.l 0x100 - - .pushsection .gnu.build.attributes, "0x100000", %note - .dc.l 4 - .dc.l 4 - .dc.l 0x100 - .asciz "$1" -- .dc.l note2.s -+ .dc.l 0x104 - - .dc.l 12 - .dc.l 0 -@@ -60,26 +60,28 @@ func1: - .dc.b 0 - - .dc.l 4 -- .dc.l 0 -+ .dc.l 4 - .dc.l 0x101 - .dc.b 0x2a, 0x7, 1, 0 -- -+ .dc.l 0x104 -+ - .dc.l 4 - .dc.l 0 - .dc.l 0x100 - .dc.b 0x2a, 0x6, 0, 0 - .popsection - -+ - .global note3.s - note3.s: -- .word 0x100 -+ .dc.l 0x100 - - .pushsection .gnu.build.attributes, "0x100000", %note - .dc.l 4 - .dc.l 4 - .dc.l 0x100 - .asciz "$1" -- .dc.l note3.s -+ .dc.l 0x108 - - .dc.l 12 - .dc.l 0 -diff -rup binutils.orig/binutils/testsuite/binutils-all/note-2-64.d binutils-2.29.1/binutils/testsuite/binutils-all/note-2-64.d ---- binutils.orig/binutils/testsuite/binutils-all/note-2-64.d 2018-01-03 16:06:45.010657032 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-2-64.d 2018-01-03 16:06:57.927502748 +0000 -@@ -6,12 +6,12 @@ - - #... - Owner Data size Description --[ ]+\$1[ ]+0x00000008[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 \(file: note1.s\) --[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\+true[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\*static[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\*0x0[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x100 --[ ]+\$1[ ]+0x00000008[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x10. \(file: note2.s\) --[ ]+!false[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_OPEN[ ]+Applies from offset 0x10. --[ ]+\*pic[ ]+0x00000000[ ]+NT_GNU_BUILD_ATTRIBUTE_FUNC[ ]+Applies to func at 0x10. \(func: func1\) -+[ ]+\$1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 \(note1.s\) -+[ ]+\$gcc 7.0.1[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\+true[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\*static[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\*0x0[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 -+[ ]+\$1[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x104 \(note2.s\) -+[ ]+!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x104 -+[ ]+\*pic[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x104 \(func1\) - #... -diff -rup binutils.orig/binutils/testsuite/binutils-all/note-2-64.s binutils-2.29.1/binutils/testsuite/binutils-all/note-2-64.s ---- binutils.orig/binutils/testsuite/binutils-all/note-2-64.s 2018-01-03 16:06:45.014656984 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-2-64.s 2018-01-03 16:06:57.927502748 +0000 -@@ -2,7 +2,7 @@ - .org 0x100 - .global note1.s - note1.s: -- .word 0 -+ .dc.l 0 - - .pushsection .gnu.build.attributes, "0x100000", %note - .balign 4 -@@ -10,7 +10,7 @@ note1.s: - .dc.l 8 - .dc.l 0x100 - .asciz "$1" -- .8byte note1.s -+ .8byte 0x100 - - .dc.l 12 - .dc.l 0 -@@ -40,14 +40,14 @@ note2.s: - .global func1 - .type func1, STT_FUNC - func1: -- .word 0x100 -+ .dc.l 0x100 - - .pushsection .gnu.build.attributes, "0x100000", %note - .dc.l 4 - .dc.l 8 - .dc.l 0x100 - .asciz "$1" -- .8byte note2.s -+ .8byte 0x104 - - .dc.l 12 - .dc.l 0 -@@ -61,9 +61,10 @@ func1: - .dc.b 0 - - .dc.l 4 -- .dc.l 0 -+ .dc.l 8 - .dc.l 0x101 - .dc.b 0x2a, 0x7, 1, 0 -+ .8byte 0x104 - - .dc.l 4 - .dc.l 0 -@@ -74,14 +75,14 @@ func1: - - .global note3.s - note3.s: -- .word 0x100 -+ .dc.l 0x100 - - .pushsection .gnu.build.attributes, "0x100000", %note - .dc.l 4 - .dc.l 8 - .dc.l 0x100 - .asciz "$1" -- .8byte note3.s -+ .8byte 0x108 - - .dc.l 12 - .dc.l 0 -diff -rup binutils.orig/binutils/testsuite/binutils-all/objcopy.exp binutils-2.29.1/binutils/testsuite/binutils-all/objcopy.exp ---- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2018-01-03 16:06:45.013656996 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/objcopy.exp 2018-01-03 16:21:05.682365371 +0000 -@@ -1056,8 +1056,10 @@ if [is_elf_format] { - run_dump_test "note-1" - if [is_elf64 tmpdir/bintest.o] { - run_dump_test "note-2-64" -+ run_dump_test "note-4-64" - } else { - run_dump_test "note-2-32" -+ run_dump_test "note-4-32" - } - } - - ---- /dev/null 2018-01-03 08:45:19.457895336 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-4-32.s 2018-01-03 16:36:13.314505682 +0000 -@@ -0,0 +1,74 @@ -+ .text -+ .org 0x100 -+note_4.s: -+ .dc.l 0 -+ .dc.l 0 -+ -+ .type bar, STT_FUNC -+bar: -+ .dc.l 0 -+bar_end: -+ .dc.l 0 -+note_4.s_end: -+ -+ .pushsection .gnu.build.attributes, "", %note -+ .balign 4 -+ -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 0x100 -+ .asciz "GA$3p3" -+ .dc.l note_4.s -+ .dc.l note_4.s_end -+ -+ .dc.l 23 -+ .dc.l 0 -+ .dc.l 0x100 -+ .asciz "GA$gcc 7.2.1 20170915" -+ .dc.b 0 -+ -+ .dc.l 10 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 6 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 13 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 6 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 5 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x21, 0x8, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 13 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 6 -+ .dc.l 8 -+ .dc.l 0x101 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0x3, 0 -+ .dc.b 0, 0 -+ .dc.l bar -+ .dc.l bar_end -+ -+ .popsection ---- /dev/null 2018-01-03 08:45:19.457895336 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-4-32.d 2018-01-03 16:36:13.313505694 +0000 -@@ -0,0 +1,19 @@ -+#PROG: objcopy -+#readelf: --notes --wide -+#objcopy: --merge-notes -+#name: v3 gnu build attribute notes (32-bit) -+#source: note-4-32.s -+ -+#... -+Displaying notes found in: .gnu.build.attributes -+[ ]+Owner[ ]+Data size[ ]+Description -+[ ]+GA\$3p3[ ]+0x00000008[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 \(note_4.s\) -+[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x110 -+[ ]+GA\*strong[ ]+0x00000008[ ]+func[ ]+Applies to region from 0x108 to 0x10c.* -+#... ---- /dev/null 2018-01-03 08:45:19.457895336 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-4-64.s 2018-01-03 16:36:07.041580738 +0000 -@@ -0,0 +1,78 @@ -+ .text -+ .org 0x100 -+note_4.s: -+ .dc.l 0 -+ .dc.l 0 -+ .dc.l 0 -+ .dc.l 0 -+ -+ .type bar, @function -+bar: -+ .dc.l 0 -+ .dc.l 0 -+ .dc.l 0 -+bar_end: -+ .dc.l 0 -+note_4.s_end: -+ -+ .pushsection .gnu.build.attributes, "", %note -+ .balign 4 -+ -+ .dc.l 8 -+ .dc.l 16 -+ .dc.l 0x100 -+ .asciz "GA$3p3" -+ .8byte note_4.s -+ .8byte note_4.s_end -+ -+ .dc.l 23 -+ .dc.l 0 -+ .dc.l 0x100 -+ .asciz "GA$gcc 7.2.1 20170915" -+ .dc.b 0 -+ -+ .dc.l 10 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x47, 0x4f, 0x57, 0, 0, 0x7, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 6 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 13 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x46, 0x4f, 0x52, 0x54, 0x49, 0x46, 0x59, 0, 0xff, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 6 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x7, 0x2, 0 -+ .dc.b 0, 0 -+ -+ .dc.l 5 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x21, 0x8, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 13 -+ .dc.l 0 -+ .dc.l 0x100 -+ .dc.b 0x47, 0x41, 0x2a, 0x6, 0xf2, 0x3, 0x38, 0xee, 0xce, 0xfa, 0x5e, 0x3c, 0 -+ .dc.b 0, 0, 0 -+ -+ .dc.l 6 -+ .dc.l 16 -+ .dc.l 0x101 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0x3, 0 -+ .dc.b 0, 0 -+ .8byte bar -+ .8byte bar_end -+ -+ .popsection ---- /dev/null 2018-01-03 08:45:19.457895336 +0000 -+++ binutils-2.29.1/binutils/testsuite/binutils-all/note-4-64.d 2018-01-03 16:36:07.041580738 +0000 -@@ -0,0 +1,19 @@ -+#PROG: objcopy -+#readelf: --notes --wide -+#objcopy: --merge-notes -+#name: v3 gnu build attribute notes (64-bit) -+#source: note-4-64.s -+ -+#... -+Displaying notes found in: .gnu.build.attributes -+[ ]+Owner[ ]+Data size[ ]+Description -+[ ]+GA\$3p3[ ]+0x00000010[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 \(note_4.s\) -+[ ]+GA\$gcc 7.2.1 20170915[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*GOW:0x700[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*off[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*FORTIFY:0xff[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*PIC[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\!false[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*0x[0-9a-f]+[ ]+0x00000000[ ]+OPEN[ ]+Applies to region from 0x100 to 0x120 -+[ ]+GA\*strong[ ]+0x00000010[ ]+func[ ]+Applies to region from 0x110 to 0x11c.* -+#... diff --git a/binutils-z-undefs.patch b/binutils-z-undefs.patch deleted file mode 100644 index fe0f6f0..0000000 --- a/binutils-z-undefs.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.29.1/ld/emultempl/elf32.em ---- binutils.orig/ld/emultempl/elf32.em 2018-01-16 11:34:58.040749108 +0000 -+++ binutils-2.29.1/ld/emultempl/elf32.em 2018-01-16 11:35:35.697303875 +0000 -@@ -2666,6 +2666,8 @@ fragment < 2.30-5 +- Fix assignment of pages to segments. (PR 22758) +- Inject RPM_LD_FLAGS into the build. (#1541027) +- Fix slowdown in readelf when examining files with lots of debug information. (PR 22802) +- Remove support for PowerPC speculation barrier insertion. +- Rebase on 2.30 +- Retire binutils-2.22.52.0.1-relro-on-by-default.patch +- Retire binutils-2.28-dynamic-section-warning.patch +- Retire binutils-2.29-skip-rp14918-test-for-arm.patch +- Retire binutils-2.29.1-gold-start-stop.patch +- Retire binutils-2.29.1-readelf-use-dynamic.patch +- Retire binutils-aarch64-pie.patch +- Retire binutils-coverity.patch +- Retire binutils-ppc64-stub-creation.patch +- Retire binutils-strip-delete-relocs.patch +- Retire binutils-support-v3-build-notes.patch +- Retire binutils-z-undefs.patch + * Mon Feb 12 2018 Nick Clifton 2.29.1-19 - Remove comment that explained how to disable annobin. (#1541027) diff --git a/sources b/sources index eaf10c6..dc81fad 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (binutils-2.29.1.tar.xz) = d748d22306477d60d921078804d21943248c23fca0707aac9b016a352c01c75ca69e82624ae37fb0bbd03af3b17088a94f60dfe1a86a7ff82e18ece3c24f0fd0 +SHA512 (binutils-2.30.tar.xz) = e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839 SHA512 (binutils-2.19.50.0.1-output-format.sed) = 2f8686b0c8af13c98cda056824c2820416f6e2d003f70b78ccf5314525b9ee3684d421dfa83e638a2d42d06ea4d4bdaf5226b64d6ec26f7ff59c44ffb2a23dd2