diff --git a/binutils-2.22.52.0.1-export-demangle.h.patch b/binutils-2.22.52.0.1-export-demangle.h.patch deleted file mode 100644 index 84f82cd..0000000 --- a/binutils-2.22.52.0.1-export-demangle.h.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/bfd/Makefile.am 2012-03-06 14:00:33.229957572 +0000 -+++ b/bfd/Makefile.am 2012-04-27 16:46:05.410974817 +0100 -@@ -18,7 +18,7 @@ - bfdlibdir = @bfdlibdir@ - bfdincludedir = @bfdincludedir@ - bfdlib_LTLIBRARIES = libbfd.la --bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h -+bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h - else !INSTALL_LIBBFD - # Empty these so that the respective installation directories will not be created. - bfdlibdir = ---- binutils-2.26.orig/bfd/Makefile.in 2016-01-25 10:23:35.054721634 +0000 -+++ binutils-2.26/bfd/Makefile.in 2016-01-25 10:25:59.292607840 +0000 -@@ -350,6 +350,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel - @INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2) - @INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \ - @INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ -+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/demangle.h \ - @INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2) - @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@ - @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la diff --git a/binutils-2.26-lto.patch b/binutils-2.26-lto.patch deleted file mode 100644 index c030f71..0000000 --- a/binutils-2.26-lto.patch +++ /dev/null @@ -1,2439 +0,0 @@ -diff -rup binutils-2.26.orig/bfd/bfd.c binutils-2.26/bfd/bfd.c ---- binutils-2.26.orig/bfd/bfd.c 2016-02-19 09:35:36.231000625 +0000 -+++ binutils-2.26/bfd/bfd.c 2016-02-19 09:35:54.901106498 +0000 -@@ -57,6 +57,14 @@ CODE_FRAGMENT - . bfd_byte data[1]; - . }; - . -+.enum bfd_lto_object_type -+. { -+. lto_non_object, -+. lto_non_ir_object, -+. lto_ir_object, -+. lto_mixed_object -+. }; -+. - .struct bfd - .{ - . {* The filename the application opened the BFD with. *} -@@ -227,6 +235,9 @@ CODE_FRAGMENT - . {* Set if this is a plugin output file. *} - . unsigned int lto_output : 1; - . -+. {* LTO object type. *} -+. ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2; -+. - . {* Set to dummy BFD created when claimed by a compiler plug-in - . library. *} - . bfd *plugin_dummy_bfd; -@@ -252,6 +263,9 @@ CODE_FRAGMENT - . {* The last section on the section list. *} - . struct bfd_section *section_last; - . -+. {* The object-only section on the section list. *} -+. struct bfd_section *object_only_section; -+. - . {* The number of sections. *} - . unsigned int section_count; - . -@@ -2270,3 +2284,36 @@ bfd_convert_section_contents (bfd *ibfd, - *ptr_size = size; - return TRUE; - } -+ -+/* -+FUNCTION -+ bfd_group_signature -+ -+SYNOPSIS -+ asymbol *bfd_group_signature (asection *group, asymbol **isympp); -+ -+DESCRIPTION -+ Return a pointer to the symbol used as a signature for GROUP. -+*/ -+ -+asymbol * -+bfd_group_signature (asection *group, asymbol **isympp) -+{ -+ bfd *abfd = group->owner; -+ Elf_Internal_Shdr *ghdr; -+ -+ if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) -+ return NULL; -+ -+ ghdr = &elf_section_data (group)->this_hdr; -+ if (ghdr->sh_link < elf_numsections (abfd)) -+ { -+ const struct elf_backend_data *bed = get_elf_backend_data (abfd); -+ Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link]; -+ -+ if (symhdr->sh_type == SHT_SYMTAB -+ && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym) -+ return isympp[ghdr->sh_info - 1]; -+ } -+ return NULL; -+} -diff -rup binutils-2.26.orig/bfd/bfd-in2.h binutils-2.26/bfd/bfd-in2.h ---- binutils-2.26.orig/bfd/bfd-in2.h 2016-02-19 09:35:36.280000903 +0000 -+++ binutils-2.26/bfd/bfd-in2.h 2016-02-19 09:35:54.900106492 +0000 -@@ -1654,6 +1657,9 @@ extern asection _bfd_std_section[4]; - #define BFD_COM_SECTION_NAME "*COM*" - #define BFD_IND_SECTION_NAME "*IND*" - -+/* GNU object-only section name. */ -+#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only" -+ - /* Pointer to the common section. */ - #define bfd_com_section_ptr (&_bfd_std_section[0]) - /* Pointer to the undefined section. */ -@@ -6511,6 +6517,14 @@ struct bfd_build_id - bfd_byte data[1]; - }; - -+enum bfd_lto_object_type -+ { -+ lto_non_object, -+ lto_non_ir_object, -+ lto_ir_object, -+ lto_mixed_object -+ }; -+ - struct bfd - { - /* The filename the application opened the BFD with. */ -@@ -6681,6 +6695,9 @@ struct bfd - /* Set if this is a plugin output file. */ - unsigned int lto_output : 1; - -+ /* LTO object type. */ -+ ENUM_BITFIELD (bfd_lto_object_type) lto_type : 2; -+ - /* Set to dummy BFD created when claimed by a compiler plug-in - library. */ - bfd *plugin_dummy_bfd; -@@ -6706,6 +6723,9 @@ struct bfd - /* The last section on the section list. */ - struct bfd_section *section_last; - -+ /* The object-only section on the section list. */ -+ struct bfd_section *object_only_section; -+ - /* The number of sections. */ - unsigned int section_count; - -@@ -7026,6 +7046,8 @@ bfd_boolean bfd_convert_section_contents - (bfd *ibfd, asection *isec, bfd *obfd, - bfd_byte **ptr, bfd_size_type *ptr_size); - -+asymbol *bfd_group_signature (asection *group, asymbol **isympp); -+ - /* Extracted from archive.c. */ - symindex bfd_get_next_mapent - (bfd *abfd, symindex previous, carsym **sym); -diff -rup binutils-2.26.orig/bfd/elf.c binutils-2.26/bfd/elf.c ---- binutils-2.26.orig/bfd/elf.c 2016-02-19 09:35:36.280000903 +0000 -+++ 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_object_only"), 0, SHT_GNU_OBJECT_ONLY, SHF_EXCLUDE }, - { 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 ---- binutils-2.26.orig/bfd/format.c 2016-02-19 09:35:36.265000818 +0000 -+++ binutils-2.26/bfd/format.c 2016-02-19 09:36:21.420256880 +0000 -@@ -46,6 +46,9 @@ SUBSECTION - #include "sysdep.h" - #include "bfd.h" - #include "libbfd.h" -+#if BFD_SUPPORTS_PLUGINS -+#include "plugin.h" -+#endif - - /* IMPORT from targets.c. */ - extern const size_t _bfd_target_vector_entries; -@@ -179,6 +182,33 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE - preserve->marker = NULL; - } - -+/* Set lto_type in ABFD. */ -+ -+static void -+bfd_set_lto_type (bfd *abfd) -+{ -+ if (abfd->format == bfd_object -+ && abfd->lto_type == lto_non_object -+ && (abfd->flags & (DYNAMIC | EXEC_P)) == 0) -+ { -+ asection *sec; -+ enum bfd_lto_object_type type = lto_non_ir_object; -+ for (sec = abfd->sections; sec != NULL; sec = sec->next) -+ { -+ if (strcmp (sec->name, GNU_OBJECT_ONLY_SECTION_NAME) == 0) -+ { -+ type = lto_mixed_object; -+ abfd->object_only_section = sec; -+ break; -+ } -+ else if (type != lto_ir_object -+ && strncmp (sec->name, ".gnu.lto_", 9) == 0) -+ type = lto_ir_object; -+ } -+ abfd->lto_type = type; -+ } -+} -+ - /* - FUNCTION - bfd_check_format_matches -@@ -221,7 +251,10 @@ bfd_check_format_matches (bfd *abfd, bfd - } - - if (abfd->format != bfd_unknown) -- return abfd->format == format; -+ { -+ bfd_set_lto_type (abfd); -+ return abfd->format == format; -+ } - - if (matching != NULL || *bfd_associated_vector != NULL) - { -@@ -285,6 +318,13 @@ bfd_check_format_matches (bfd *abfd, bfd - || (*target)->match_priority > best_match) - continue; - -+#if BFD_SUPPORTS_PLUGINS -+ /* If the plugin target is explicitly specified when a BFD file -+ is opened, don't check it twice. */ -+ if (bfd_plugin_specified_p () && bfd_plugin_target_p (*target)) -+ continue; -+#endif -+ - /* If we already tried a match, the bfd is modified and may - have sections attached, which will confuse the next - _bfd_check_format call. */ -@@ -449,6 +489,8 @@ bfd_check_format_matches (bfd *abfd, bfd - if (matching_vector) - free (matching_vector); - -+ bfd_set_lto_type (abfd); -+ - /* File position has moved, BTW. */ - return TRUE; - } -diff -rup binutils-2.26.orig/bfd/plugin.c binutils-2.26/bfd/plugin.c ---- binutils-2.26.orig/bfd/plugin.c 2016-02-19 09:35:36.271000852 +0000 -+++ binutils-2.26/bfd/plugin.c 2016-02-19 09:35:54.905106520 +0000 -@@ -130,6 +130,146 @@ register_claim_file (ld_plugin_claim_fil - return LDPS_OK; - } - -+static asection bfd_plugin_fake_text_section -+ = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, 0, ".text", 0); -+static asection bfd_plugin_fake_common_section -+ = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, SEC_IS_COMMON, 0, -+ NULL, 0); -+ -+/* Get symbols from object only section. */ -+ -+static void -+bfd_plugin_get_symbols_in_object_only (bfd *abfd) -+{ -+ struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data; -+ const char *object_only_file; -+ bfd *nbfd; -+ long storage; -+ long object_only_nsyms, added_nsyms, i; -+ asymbol **object_only_syms, **added_syms; -+ -+ plugin_data->object_only_syms = NULL; -+ plugin_data->object_only_nsyms = 0; -+ -+ if (abfd->sections == NULL && abfd->my_archive == NULL) -+ { -+ nbfd = bfd_openr (abfd->filename, NULL); -+ if (nbfd == NULL) -+ { -+ (*_bfd_error_handler) -+ (_("%s: failed to open to extract object only section: %s"), -+ abfd->filename, bfd_errmsg (bfd_get_error ())); -+ goto error_return; -+ } -+ else if (!bfd_check_format (nbfd, bfd_object)) -+ { -+ /* There is no object only section if it isn't a bfd_object -+ file. */ -+error_return: -+ bfd_close (nbfd); -+ return; -+ } -+ } -+ else -+ { -+ if (!bfd_check_format (abfd, bfd_object)) -+ { -+ (*_bfd_error_handler) -+ (_("%B: invalid file to extract object only section: %s"), -+ abfd, bfd_errmsg (bfd_get_error ())); -+ return; -+ } -+ nbfd = abfd; -+ } -+ -+ if (nbfd->lto_type == lto_mixed_object -+ && (nbfd->flags & HAS_SYMS) != 0) -+ { -+ object_only_file = bfd_extract_object_only_section (nbfd); -+ if (object_only_file == NULL) -+ (*_bfd_error_handler) -+ (_("%B: failed to extract object only section: %s"), -+ abfd, bfd_errmsg (bfd_get_error ())); -+ } -+ else -+ object_only_file = NULL; -+ -+ /* Close the new bfd we just opened. */ -+ if (nbfd != abfd) -+ bfd_close (nbfd); -+ -+ /* Return if there is no object only section or there is no -+ symbol in object only section. */ -+ if (!object_only_file) -+ return; -+ -+ /* Open the file containing object only section. */ -+ nbfd = bfd_openr (object_only_file, NULL); -+ if (!bfd_check_format (nbfd, bfd_object)) -+ { -+ (*_bfd_error_handler) -+ (_("%B: failed to open object only section: %s"), -+ abfd, bfd_errmsg (bfd_get_error ())); -+ goto quit; -+ } -+ -+ storage = bfd_get_symtab_upper_bound (nbfd); -+ if (storage <= 0) -+ { -+ if (storage < 0) -+ (*_bfd_error_handler) -+ (_("%B: failed to get symbol table in object only section: %s"), -+ abfd, bfd_errmsg (bfd_get_error ())); -+ -+ goto quit; -+ } -+ -+ object_only_syms = (asymbol **) bfd_malloc (storage); -+ object_only_nsyms = bfd_canonicalize_symtab (nbfd, object_only_syms); -+ -+ /* FIXME: We waste some spaces if not all symbols are copied. */ -+ added_syms = (asymbol **) bfd_alloc (abfd, storage); -+ added_nsyms = 0; -+ -+ /* Copy only global symbols from object only section. */ -+ for (i = 0; i < object_only_nsyms; i++) -+ { -+ asection *sec = object_only_syms[i]->section; -+ flagword flags = object_only_syms[i]->flags; -+ asymbol *s; -+ -+ if (bfd_is_com_section (sec)) -+ sec = &bfd_plugin_fake_common_section; -+ else if (bfd_is_und_section (sec)) -+ ; -+ else if ((flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0) -+ sec = &bfd_plugin_fake_text_section; -+ else -+ continue; -+ -+ s = bfd_alloc (abfd, sizeof (asymbol)); -+ BFD_ASSERT (s); -+ added_syms[added_nsyms++] = s; -+ -+ s->section = sec; -+ s->the_bfd = abfd; -+ s->name = xstrdup (object_only_syms[i]->name); -+ s->value = 0; -+ s->flags = flags; -+ s->udata.p = NULL; -+ } -+ -+ plugin_data->object_only_syms = added_syms; -+ plugin_data->object_only_nsyms = added_nsyms; -+ -+ free (object_only_syms); -+ -+quit: -+ /* Close and remove the object only section file. */ -+ bfd_close (nbfd); -+ unlink (object_only_file); -+} -+ - static enum ld_plugin_status - add_symbols (void * handle, - int nsyms, -@@ -142,10 +282,13 @@ add_symbols (void * handle, - plugin_data->nsyms = nsyms; - plugin_data->syms = syms; - -- if (nsyms != 0) -+ abfd->tdata.plugin_data = plugin_data; -+ -+ bfd_plugin_get_symbols_in_object_only (abfd); -+ -+ if ((nsyms + plugin_data->object_only_nsyms) != 0) - abfd->flags |= HAS_SYMS; - -- abfd->tdata.plugin_data = plugin_data; - return LDPS_OK; - } - -@@ -440,7 +583,8 @@ static long - bfd_plugin_get_symtab_upper_bound (bfd *abfd) - { - struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data; -- long nsyms = plugin_data->nsyms; -+ /* Add symbols from object only section. */ -+ long nsyms = plugin_data->nsyms + plugin_data->object_only_nsyms; - - BFD_ASSERT (nsyms >= 0); - -@@ -474,12 +618,7 @@ bfd_plugin_canonicalize_symtab (bfd *abf - struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data; - long nsyms = plugin_data->nsyms; - const struct ld_plugin_symbol *syms = plugin_data->syms; -- static asection fake_section; -- static asection fake_common_section; -- int i; -- -- fake_section.name = ".text"; -- fake_common_section.flags = SEC_IS_COMMON; -+ int i, j; - - for (i = 0; i < nsyms; i++) - { -@@ -492,10 +631,11 @@ bfd_plugin_canonicalize_symtab (bfd *abf - s->name = syms[i].name; - s->value = 0; - s->flags = convert_flags (&syms[i]); -+ s->udata.p = NULL; - switch (syms[i].def) - { - case LDPK_COMMON: -- s->section = &fake_common_section; -+ s->section = &bfd_plugin_fake_common_section; - break; - case LDPK_UNDEF: - case LDPK_WEAKUNDEF: -@@ -503,15 +643,18 @@ bfd_plugin_canonicalize_symtab (bfd *abf - break; - case LDPK_DEF: - case LDPK_WEAKDEF: -- s->section = &fake_section; -+ s->section = &bfd_plugin_fake_text_section; - break; - default: - BFD_ASSERT (0); - } -- -- s->udata.p = (void *) &syms[i]; - } - -+ /* Copy symbols from object only section. */ -+ nsyms += plugin_data->object_only_nsyms; -+ for (j = 0; j < plugin_data->object_only_nsyms; j++, i++) -+ alocation[i] = plugin_data->object_only_syms[j]; -+ - return nsyms; - } - -diff -rup binutils-2.26.orig/bfd/plugin.h binutils-2.26/bfd/plugin.h ---- binutils-2.26.orig/bfd/plugin.h 2016-02-19 09:35:36.271000852 +0000 -+++ binutils-2.26/bfd/plugin.h 2016-02-19 09:35:54.906106526 +0000 -@@ -33,6 +33,8 @@ typedef struct plugin_data_struct - { - int nsyms; - const struct ld_plugin_symbol *syms; -+ int object_only_nsyms; -+ asymbol **object_only_syms; - } - plugin_data_struct; - -diff -rup binutils-2.26.orig/bfd/section.c binutils-2.26/bfd/section.c ---- binutils-2.26.orig/bfd/section.c 2016-02-19 09:35:36.276000881 +0000 -+++ binutils-2.26/bfd/section.c 2016-02-19 09:35:54.906106526 +0000 -@@ -588,6 +588,9 @@ CODE_FRAGMENT - .#define BFD_COM_SECTION_NAME "*COM*" - .#define BFD_IND_SECTION_NAME "*IND*" - . -+.{* GNU object-only section name. *} -+.#define GNU_OBJECT_ONLY_SECTION_NAME ".gnu_object_only" -+. - .{* Pointer to the common section. *} - .#define bfd_com_section_ptr (&_bfd_std_section[0]) - .{* Pointer to the undefined section. *} -diff -rup binutils-2.26.orig/binutils/readelf.c binutils-2.26/binutils/readelf.c ---- binutils-2.26.orig/binutils/readelf.c 2016-02-19 09:35:36.295000988 +0000 -+++ binutils-2.26/binutils/readelf.c 2016-02-19 09:35:54.911106554 +0000 -@@ -3900,6 +3900,7 @@ get_section_type_name (unsigned int sh_t - case 0x7ffffffd: return "AUXILIARY"; - case 0x7fffffff: return "FILTER"; - case SHT_GNU_LIBLIST: return "GNU_LIBLIST"; -+ case SHT_GNU_OBJECT_ONLY: return "GNU_OBJECT_ONLY"; - - default: - if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC)) -diff -rup binutils-2.26.orig/gas/testsuite/gas/elf/section9.d binutils-2.26/gas/testsuite/gas/elf/section9.d ---- binutils-2.26.orig/gas/testsuite/gas/elf/section9.d 2016-02-19 09:35:36.397001567 +0000 -+++ binutils-2.26/gas/testsuite/gas/elf/section9.d 2016-02-19 09:35:54.912106560 +0000 -@@ -4,4 +4,5 @@ - #... - [ ]*\[.*\][ ]+\.gnu\.lto_main[ ]+PROGBITS.*[ ]+E[ ]+.* - [ ]*\[.*\][ ]+\.gnu\.lto_\.pureconst[ ]+PROGBITS.*[ ]+E[ ]+.* -+[ ]*\[.*\][ ]+\.gnu_object_only[ ]+GNU_OBJECT_ONLY.*[ ]+E[ ]+.* - #pass -diff -rup binutils-2.26.orig/gas/testsuite/gas/elf/section9.s binutils-2.26/gas/testsuite/gas/elf/section9.s ---- binutils-2.26.orig/gas/testsuite/gas/elf/section9.s 2016-02-19 09:35:36.397001567 +0000 -+++ binutils-2.26/gas/testsuite/gas/elf/section9.s 2016-02-19 09:35:54.912106560 +0000 -@@ -2,3 +2,5 @@ - .byte 0,0,0,0 - .section .gnu.lto_.pureconst,"",%progbits - .byte 0,0,0,0 -+ .section .gnu_object_only -+ .byte 0,0,0,0 -diff -rup binutils-2.26.orig/include/bfdlink.h binutils-2.26/include/bfdlink.h ---- binutils-2.26.orig/include/bfdlink.h 2016-02-19 09:35:36.672003126 +0000 -+++ binutils-2.26/include/bfdlink.h 2016-02-19 09:35:54.913106566 +0000 -@@ -400,6 +400,12 @@ struct bfd_link_info - /* TRUE if ok to have multiple definition. */ - unsigned int allow_multiple_definition: 1; - -+ /* TRUE if .gnu_object_only section should be created. */ -+ unsigned int emit_gnu_object_only: 1; -+ -+ /* TRUE if .gnu_object_only section is being created. */ -+ unsigned int emitting_gnu_object_only: 1; -+ - /* TRUE if ok to have version with no definition. */ - unsigned int allow_undefined_version: 1; - -diff -rup binutils-2.26.orig/include/elf/common.h binutils-2.26/include/elf/common.h ---- binutils-2.26.orig/include/elf/common.h 2016-02-19 09:35:36.675003143 +0000 -+++ binutils-2.26/include/elf/common.h 2016-02-19 09:35:54.913106566 +0000 -@@ -478,6 +478,7 @@ - #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */ - #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ - #define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */ -+#define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */ - - /* The next three section types are defined by Solaris, and are named - SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU* -diff -rup binutils-2.26.orig/ld/emultempl/aarch64elf.em binutils-2.26/ld/emultempl/aarch64elf.em ---- binutils-2.26.orig/ld/emultempl/aarch64elf.em 2016-02-19 09:35:36.698003274 +0000 -+++ binutils-2.26/ld/emultempl/aarch64elf.em 2016-02-19 09:35:54.914106571 +0000 -@@ -271,7 +271,7 @@ gld${EMULATION_NAME}_after_allocation (v - } - - static void --gld${EMULATION_NAME}_finish (void) -+aarch64_finish (void) - { - if (!bfd_link_relocatable (&link_info)) - { -@@ -283,7 +283,7 @@ gld${EMULATION_NAME}_finish (void) - } - } - -- finish_default (); -+ gld${EMULATION_NAME}_finish (); - } - - /* This is a convenient point to tell BFD about target specific flags. -@@ -435,4 +435,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS= - LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse - - # Call the extra arm-elf function --LDEMUL_FINISH=gld${EMULATION_NAME}_finish -+LDEMUL_FINISH=aarch64_finish -diff -rup binutils-2.26.orig/ld/emultempl/alphaelf.em binutils-2.26/ld/emultempl/alphaelf.em ---- binutils-2.26.orig/ld/emultempl/alphaelf.em 2016-02-19 09:35:36.698003274 +0000 -+++ binutils-2.26/ld/emultempl/alphaelf.em 2016-02-19 09:35:54.914106571 +0000 -@@ -104,7 +104,7 @@ alpha_finish (void) - if (limit_32bit) - elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT; - -- finish_default (); -+ gld${EMULATION_NAME}_finish (); - } - EOF - -diff -rup binutils-2.26.orig/ld/emultempl/avrelf.em binutils-2.26/ld/emultempl/avrelf.em ---- binutils-2.26.orig/ld/emultempl/avrelf.em 2016-02-19 09:35:36.698003274 +0000 -+++ binutils-2.26/ld/emultempl/avrelf.em 2016-02-19 09:35:54.915106577 +0000 -@@ -209,7 +209,7 @@ avr_finish (void) - elf_elfheader (abfd)->e_flags &= ~EF_AVR_LINKRELAX_PREPARED; - } - -- finish_default (); -+ gld${EMULATION_NAME}_finish (); - } - EOF - -diff -rup binutils-2.26.orig/ld/emultempl/elf32.em binutils-2.26/ld/emultempl/elf32.em ---- binutils-2.26.orig/ld/emultempl/elf32.em 2016-02-19 09:35:36.700003285 +0000 -+++ binutils-2.26/ld/emultempl/elf32.em 2016-02-19 09:35:54.915106577 +0000 -@@ -66,6 +66,7 @@ static void gld${EMULATION_NAME}_before_ - static void gld${EMULATION_NAME}_after_allocation (void); - static lang_output_section_statement_type *gld${EMULATION_NAME}_place_orphan - (asection *, const char *, int); -+static void gld${EMULATION_NAME}_finish (void); - EOF - - if [ "x${USE_LIBPATH}" = xyes ] ; then -@@ -1795,6 +1796,8 @@ output_rel_find (asection *sec, int isdy - in->owner, in); - } - -+static int orphan_init_done = 0; -+ - /* Place an orphan section. We use this to put random SHF_ALLOC - sections in the right segment. */ - -@@ -1803,7 +1806,7 @@ gld${EMULATION_NAME}_place_orphan (asect - const char *secname, - int constraint) - { -- static struct orphan_save hold[] = -+ static struct orphan_save orig_hold[] = - { - { ".text", - SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE, -@@ -1833,6 +1836,7 @@ gld${EMULATION_NAME}_place_orphan (asect - SEC_HAS_CONTENTS, - 0, 0, 0, 0 }, - }; -+ static struct orphan_save hold[ARRAY_SIZE (orig_hold)]; - enum orphan_save_index - { - orphan_text = 0, -@@ -1845,7 +1849,6 @@ gld${EMULATION_NAME}_place_orphan (asect - orphan_sdata, - orphan_nonalloc - }; -- static int orphan_init_done = 0; - struct orphan_save *place; - lang_output_section_statement_type *after; - lang_output_section_statement_type *os; -@@ -1924,15 +1927,22 @@ gld${EMULATION_NAME}_place_orphan (asect - - if (!orphan_init_done) - { -- struct orphan_save *ho; -+ struct orphan_save *ho, *horig; - - for (ho = hold; ho < hold + sizeof (hold) / sizeof (hold[0]); ++ho) -+ for (ho = hold, horig = orig_hold; -+ ho < hold + ARRAY_SIZE (hold); -+ ++ho, ++horig) -+ { -+ *ho = *horig; -+ if (ho->name != NULL) - if (ho->name != NULL) - { - ho->os = lang_output_section_find (ho->name); - if (ho->os != NULL && ho->os->flags == 0) - ho->os->flags = ho->flags; - } -+ } - orphan_init_done = 1; - } - -@@ -2017,6 +2027,27 @@ gld${EMULATION_NAME}_place_orphan (asect - EOF - fi - -+fragment <my_archive; -+ if (archive) -+ break; -+ case cmdline_is_file_enum: -+ cmdline_list_append (&cmdline_object_only_file_list, type, data); -+ return; -+ } -+ -+ /* Put archive member on cmdline_object_only_archive_list and sort -+ the list by archive name and archive member origin. */ -+ new_opt = (cmdline_union_type *) stat_alloc (sizeof (*new_opt)); -+ new_opt->header.type = cmdline_is_bfd_enum; -+ new_opt->header.next = NULL; -+ new_opt->abfd.abfd = (bfd *) data; -+ -+ c = cmdline_object_only_archive_list.head; -+ if (c == NULL) -+ { -+ cmdline_object_only_archive_list.head = new_opt; -+ cmdline_object_only_archive_list.tail = &new_opt->header.next; -+ return; -+ } -+ -+ prev = NULL; -+ origin = abfd->origin; -+ for (; c != NULL; c = next) -+ { -+ if (c->header.type != cmdline_is_bfd_enum) -+ abort (); -+ -+ next = c->header.next; -+ -+ obfd = c->abfd.abfd; -+ oarchive = abfd->my_archive; -+ -+ if (strcmp (archive->filename, oarchive->filename) == 0) -+ { -+ bfd_boolean after; -+ -+ if (origin < obfd->origin) -+ { -+ /* Insert it before the current. */ -+ new_opt->header.next = c; -+ if (prev) -+ *prev = new_opt; -+ else -+ cmdline_object_only_archive_list.head = new_opt; -+ return; -+ } -+ -+ after = TRUE; -+ -+ /* Check origin. */ -+ while (next) -+ { -+ if (next->header.type != cmdline_is_bfd_enum) -+ abort (); -+ -+ nbfd = next->abfd.abfd; -+ norigin = nbfd->origin; -+ if (origin > norigin) -+ { -+ /* Insert it after NEXT. */ -+ break; -+ } -+ -+ narchive = nbfd->my_archive; -+ if (strcmp (archive->filename, narchive->filename) != 0) -+ { -+ /* Insert it befor NEXT. */ -+ after = FALSE; -+ break; -+ } -+ -+ c = next; -+ next = next->header.next; -+ } -+ -+ if (after && next) -+ { -+ c = next; -+ next = next->header.next; -+ } -+ -+ if (*cmdline_object_only_archive_list.tail == c->header.next) -+ cmdline_object_only_archive_list.tail -+ = &new_opt->header.next; -+ -+ prev = &c->header.next; -+ new_opt->header.next = next; -+ *prev = new_opt; -+ return; -+ } -+ -+ prev = &c->header.next; -+ } -+ -+ *cmdline_object_only_archive_list.tail = new_opt; -+ cmdline_object_only_archive_list.tail = &new_opt->header.next; -+} -+ -+/* Get object-only input files. */ -+ -+static void -+cmdline_get_object_only_input_files (void) -+{ -+ cmdline_union_type *c, *next; -+ bfd *abfd, *archive; -+ bfd *nbfd, *narchive; -+ -+ /* Add files first. */ -+ for (c = cmdline_object_only_file_list.head; -+ c != NULL; c = c->header.next) -+ switch (c->header.type) -+ { -+ default: -+ abort (); -+ case cmdline_is_file_enum: -+ lang_add_input_file (c->file.filename, -+ lang_input_file_is_file_enum, NULL); -+ break; -+ case cmdline_is_bfd_enum: -+ abfd = c->abfd.abfd; -+ if (abfd->my_archive) -+ abort (); -+ lang_add_input_file (abfd->filename, -+ lang_input_file_is_file_enum, NULL); -+ break; -+ } -+ -+ /* Add archive members next. */ -+ for (c = cmdline_object_only_archive_list.head; c != NULL; c = next) -+ { -+ if (c->header.type != cmdline_is_bfd_enum) -+ abort (); -+ -+ next = c->header.next; -+ -+ abfd = c->abfd.abfd; -+ archive = abfd->my_archive; -+ -+ /* Add the first archive of the archive member group. */ -+ lang_add_input_file (archive->filename, -+ lang_input_file_is_file_enum, NULL); -+ -+ /* Skip the rest members in the archive member group. */ -+ do -+ { -+ if (!next) -+ break; -+ -+ if (next->header.type != cmdline_is_bfd_enum) -+ abort (); -+ -+ next = next->header.next; -+ if (!next) -+ break; -+ nbfd = next->abfd.abfd; -+ narchive = nbfd->my_archive; -+ } -+ while (strcmp (archive->filename, narchive->filename) == 0); -+ } -+} -+ -+struct cmdline_arg -+{ -+ bfd *obfd; -+ asymbol **isympp; -+ int status; -+}; -+ -+/* Create a section in OBFD with the same -+ name and attributes as ISECTION in IBFD. */ -+ -+static void -+setup_section (bfd *ibfd, sec_ptr isection, void *p) -+{ -+ struct cmdline_arg *arg = (struct cmdline_arg *) p; -+ bfd *obfd = arg->obfd; -+ asymbol **isympp = arg->isympp; -+ const char *name = isection->name; -+ sec_ptr osection; -+ const char *err; -+ -+ /* Skip the object-only section. */ -+ if (ibfd->object_only_section == isection) -+ return; -+ -+ /* If we have already failed earlier on, do not keep on generating -+ complaints now. */ -+ if (arg->status) -+ return; -+ -+ osection = bfd_make_section_anyway_with_flags (obfd, name, -+ isection->flags); -+ -+ if (osection == NULL) -+ { -+ err = _("failed to create output section"); -+ goto loser; -+ } -+ -+ osection->size = isection->size; -+ osection->vma = isection->vma; -+ osection->lma = isection->lma; -+ osection->alignment_power = isection->alignment_power; -+ -+ /* Copy merge entity size. */ -+ osection->entsize = isection->entsize; -+ -+ /* This used to be mangle_section; we do here to avoid using -+ bfd_get_section_by_name since some formats allow multiple -+ sections with the same name. */ -+ isection->output_section = osection; -+ isection->output_offset = 0; -+ -+ if ((isection->flags & SEC_GROUP) != 0) -+ { -+ asymbol *gsym = bfd_group_signature (isection, isympp); -+ -+ if (gsym != NULL) -+ { -+ gsym->flags |= BSF_KEEP; -+ if (ibfd->xvec->flavour == bfd_target_elf_flavour) -+ elf_group_id (isection) = gsym; -+ } -+ } -+ -+ /* Allow the BFD backend to copy any private data it understands -+ from the input section to the output section. */ -+ if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection)) -+ { -+ err = _("failed to copy private data"); -+ goto loser; -+ } -+ -+ /* All went well. */ -+ return; -+ -+loser: -+ arg->status = 1; -+ einfo (_("%P%F: setup_section: %s: %s\n"), err, name); -+} -+ -+/* Copy the data of input section ISECTION of IBFD -+ to an output section with the same name in OBFD. -+ If stripping then don't copy any relocation info. */ -+ -+static void -+copy_section (bfd *ibfd, sec_ptr isection, void *p) -+{ -+ struct cmdline_arg *arg = (struct cmdline_arg *) p; -+ bfd *obfd = arg->obfd; -+ asymbol **isympp = arg->isympp; -+ arelent **relpp; -+ long relcount; -+ sec_ptr osection; -+ bfd_size_type size; -+ long relsize; -+ flagword flags; -+ const char *err; -+ -+ /* Skip the object-only section. */ -+ if (ibfd->object_only_section == isection) -+ return; -+ -+ /* If we have already failed earlier on, do not keep on generating -+ complaints now. */ -+ if (arg->status) -+ return; -+ -+ flags = bfd_get_section_flags (ibfd, isection); -+ if ((flags & SEC_GROUP) != 0) -+ return; -+ -+ osection = isection->output_section; -+ size = bfd_get_section_size (isection); -+ -+ if (size == 0 || osection == 0) -+ return; -+ -+ relsize = bfd_get_reloc_upper_bound (ibfd, isection); -+ -+ if (relsize < 0) -+ { -+ /* Do not complain if the target does not support relocations. */ -+ if (relsize == -1 -+ && bfd_get_error () == bfd_error_invalid_operation) -+ relsize = 0; -+ else -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ } -+ -+ if (relsize == 0) -+ bfd_set_reloc (obfd, osection, NULL, 0); -+ else -+ { -+ relpp = (arelent **) xmalloc (relsize); -+ relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp); -+ if (relcount < 0) -+ { -+ err = _("relocation count is negative"); -+ goto loser; -+ } -+ -+ bfd_set_reloc (obfd, osection, -+ relcount == 0 ? NULL : relpp, relcount); -+ if (relcount == 0) -+ free (relpp); -+ } -+ -+ if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS) -+ { -+ bfd_byte *memhunk = NULL; -+ -+ if (!bfd_get_full_section_contents (ibfd, isection, &memhunk)) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size)) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ free (memhunk); -+ } -+ -+ /* All went well. */ -+ return; -+ -+loser: -+ einfo (_("%P%F: copy_section: %s: %s\n"), err, isection->name); -+} -+/* Open the temporary bfd created in the same directory as PATH. */ -+ -+static bfd * -+cmdline_fopen_temp (const char *path, const char *target, -+ const char *mode) -+{ -+#define template "ldXXXXXX" -+ const char *slash = strrchr (path, '/'); -+ char *tmpname; -+ size_t len; -+ int fd; -+ -+#ifdef HAVE_DOS_BASED_FILE_SYSTEM -+ { -+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */ -+ char *bslash = strrchr (path, '\\'); -+ -+ if (slash == NULL || (bslash != NULL && bslash > slash)) -+ slash = bslash; -+ if (slash == NULL && path[0] != '\0' && path[1] == ':') -+ slash = path + 1; -+ } -+#endif -+ -+ if (slash != (char *) NULL) -+ { -+ len = slash - path; -+ tmpname = (char *) xmalloc (len + sizeof (template) + 2); -+ memcpy (tmpname, path, len); -+ -+#ifdef HAVE_DOS_BASED_FILE_SYSTEM -+ /* If tmpname is "X:", appending a slash will make it a root -+ directory on drive X, which is NOT the same as the current -+ directory on drive X. */ -+ if (len == 2 && tmpname[1] == ':') -+ tmpname[len++] = '.'; -+#endif -+ tmpname[len++] = '/'; -+ } -+ else -+ { -+ tmpname = (char *) xmalloc (sizeof (template)); -+ len = 0; -+ } -+ -+ memcpy (tmpname + len, template, sizeof (template)); -+#undef template -+ -+#ifdef HAVE_MKSTEMP -+ fd = mkstemp (tmpname); -+#else -+ tmpname = mktemp (tmpname); -+ if (tmpname == NULL) -+ return NULL; -+ fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600); -+#endif -+ if (fd == -1) -+ return NULL; -+ return bfd_fopen (tmpname, target, mode, fd); -+} -+ -+/* Add the object-only section. */ -+ -+static void -+cmdline_add_object_only_section (bfd_byte *contents, size_t size) -+{ -+ bfd_vma start; -+ flagword flags; -+ enum bfd_architecture iarch; -+ unsigned int imach; -+ long symcount; -+ long symsize; -+ asymbol **isympp = NULL; -+ asymbol **osympp = NULL; -+ bfd *obfd = NULL, *ibfd; -+ const char *err; -+ struct arg -+ { -+ bfd *obfd; -+ asymbol **isympp; -+ int status; -+ } arg; -+ char **matching; -+ char *ofilename = NULL; -+ asection *sec; -+ -+ ibfd = bfd_openr (output_filename, output_target); -+ if (!ibfd) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ if (!bfd_check_format_matches (ibfd, bfd_object, &matching)) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ obfd = cmdline_fopen_temp (output_filename, output_target, "w"); -+ if (!obfd) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ /* To be used after bfd_close (). */ -+ ofilename = xstrdup (bfd_get_filename (obfd)); -+ -+ if (!bfd_set_format (obfd, bfd_object)) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ /* Copy the start address, flags and architecture of input file to -+ output file. */ -+ flags = bfd_get_file_flags (ibfd); -+ start = bfd_get_start_address (ibfd); -+ iarch = bfd_get_arch (ibfd); -+ imach = bfd_get_mach (ibfd); -+ if (!bfd_set_start_address (obfd, start) -+ || !bfd_set_file_flags (obfd, flags) -+ || !bfd_set_arch_mach (obfd, iarch, imach)) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ symsize = bfd_get_symtab_upper_bound (ibfd); -+ if (symsize < 0) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ isympp = (asymbol **) xmalloc (symsize); -+ symcount = bfd_canonicalize_symtab (ibfd, isympp); -+ if (symcount < 0) -+ { -+ err = bfd_errmsg (bfd_get_error ()); -+ goto loser; -+ } -+ -+ arg.obfd = obfd; -+ arg.isympp = isympp; -+ arg.status = 0; -+ -+ /* BFD mandates that all output sections be created and sizes set before -+ any output is done. Thus, we traverse all sections multiple times. */ -+ bfd_map_over_sections (ibfd, setup_section, &arg); -+ -+ if (arg.status) -+ { -+ err = _("error setting up sections"); -+ goto loser; -+ } -+ -+ /* Allow the BFD backend to copy any private data it understands -+ from the input section to the output section. */ -+ if (! bfd_copy_private_header_data (ibfd, obfd)) -+ { -+ err = _("error copying private header data"); -+ goto loser; -+ } -+ -+ /* Create the object-only section. */ -+ sec = bfd_make_section_with_flags (obfd, -+ GNU_OBJECT_ONLY_SECTION_NAME, -+ (SEC_HAS_CONTENTS -+ | SEC_READONLY -+ | SEC_DATA -+ | SEC_LINKER_CREATED)); -+ if (sec == NULL) -+ { -+ err = _("can't create object-only section"); -+ goto loser; -+ } -+ -+ if (! bfd_set_section_size (obfd, sec, size)) -+ { -+ err = _("can't set object-only section size"); -+ goto loser; -+ } -+ -+ if (ibfd->object_only_section) -+ { -+ /* Filter out the object-only section symbol. */ -+ long src_count = 0, dst_count = 0; -+ asymbol **from, **to; -+ -+ osympp = (asymbol **) xmalloc (symcount * sizeof (asymbol *)); -+ from = isympp; -+ to = osympp; -+ for (; src_count < symcount; src_count++) -+ { -+ asymbol *sym = from[src_count]; -+ if (bfd_get_section (sym) != ibfd->object_only_section) -+ to[dst_count++] = sym; -+ } -+ to[dst_count] = NULL; -+ symcount = dst_count; -+ bfd_set_symtab (obfd, osympp, symcount); -+ } -+ else -+ bfd_set_symtab (obfd, isympp, symcount); -+ -+ /* This has to happen after the symbol table has been set. */ -+ bfd_map_over_sections (ibfd, copy_section, &arg); -+ -+ if (arg.status) -+ { -+ err = _("error copying sections"); -+ goto loser; -+ } -+ -+ /* Copy the object-only section to the output. */ -+ if (! bfd_set_section_contents (obfd, sec, contents, 0, size)) -+ { -+ err = _("error adding object-only section"); -+ goto loser; -+ } -+ -+ /* Allow the BFD backend to copy any private data it understands -+ from the input BFD to the output BFD. This is done last to -+ permit the routine to look at the filtered symbol table, which is -+ important for the ECOFF code at least. */ -+ if (! bfd_copy_private_bfd_data (ibfd, obfd)) -+ { -+ err = _("error copying private BFD data"); -+ goto loser; -+ } -+ -+ if (!bfd_close (obfd)) -+ { -+ unlink (ofilename); -+ einfo (_("%P%F: failed to finish output with object-only section\n")); -+ } -+ -+ /* Must be freed after bfd_close (). */ -+ free (isympp); -+ if (osympp) -+ free (osympp); -+ -+ if (rename (ofilename, output_filename)) -+ { -+ unlink (ofilename); -+ einfo (_("%P%F: failed to rename output with object-only section\n")); -+ } -+ -+ free (ofilename); -+ return; -+ -+loser: -+ if (isympp) -+ free (isympp); -+ if (osympp) -+ free (osympp); -+ if (obfd) -+ bfd_close (obfd); -+ if (ofilename) -+ { -+ unlink (ofilename); -+ free (ofilename); -+ } -+ einfo (_("%P%F: failed to add object-only section: %s\n"), err); -+} -+ -+/* Emit the final output with object-only section. */ -+ -+void -+cmdline_emit_object_only_section (void) -+{ -+ const char *saved_output_filename = output_filename; -+ int fd; -+ size_t size, off; -+ bfd_byte *contents; -+ struct stat st; -+ -+ /* Get a temporary object-only file. */ -+ output_filename = make_temp_file (".obj-only.o"); -+ -+ had_output_filename = FALSE; -+ link_info.input_bfds = NULL; -+ link_info.input_bfds_tail = &link_info.input_bfds; -+ -+ lang_init (TRUE); -+ ldexp_init (TRUE); -+ -+ ld_parse_linker_script (); -+ -+ /* Set up the object-only output. */ -+ lang_final (); -+ -+ /* Open the object-only file for output. */ -+ lang_for_each_statement (ldlang_open_output); -+ -+ ldemul_create_output_section_statements (); -+ -+ if (!bfd_section_already_linked_table_init ()) -+ einfo (_("%P%F: Failed to create hash table\n")); -+ -+ /* Call cmdline_on_object_only_archive_list_p to check which member -+ should be loaded. */ -+ input_flags.whole_archive = TRUE; -+ -+ /* Set it to avoid adding more to cmdline lists. */ -+ link_info.emitting_gnu_object_only = TRUE; -+ -+ /* Get object-only input files. */ -+ cmdline_get_object_only_input_files (); -+ -+ /* Open object-only input files. */ -+ open_input_bfds (statement_list.head, FALSE); -+ -+ ldemul_after_open (); -+ -+ bfd_section_already_linked_table_free (); -+ -+ /* Make sure that we're not mixing architectures. We call this -+ after all the input files have been opened, but before we do any -+ other processing, so that any operations merge_private_bfd_data -+ does on the output file will be known during the rest of the -+ link. */ -+ lang_check (); -+ -+ /* Size up the common data. */ -+ lang_common (); -+ -+ /* Update wild statements. */ -+ update_wild_statements (statement_list.head); -+ -+ /* Run through the contours of the script and attach input sections -+ to the correct output sections. */ -+ map_input_to_output_sections (statement_list.head, NULL, NULL); -+ -+ /* Find any sections not attached explicitly and handle them. */ -+ lang_place_orphans (); -+ -+ /* Do anything special before sizing sections. This is where ELF -+ and other back-ends size dynamic sections. */ -+ ldemul_before_allocation (); -+ -+ /* Size up the sections. */ -+ lang_size_sections (NULL, ! RELAXATION_ENABLED); -+ -+ /* See if anything special should be done now we know how big -+ everything is. This is where relaxation is done. */ -+ ldemul_after_allocation (); -+ -+ ldemul_finish (); -+ -+ /* Make sure that the section addresses make sense. */ -+ if (command_line.check_section_addresses) -+ lang_check_section_addresses (); -+ -+ lang_end (); -+ -+ ldwrite (); -+ -+ ldexp_finish (TRUE); -+ lang_finish (); -+ -+ if (! bfd_close (link_info.output_bfd)) -+ einfo (_("%P%F:%s: final close failed on object-only output: %E\n"), -+ output_filename); -+ -+ /* Read in the object-only file. */ -+ fd = open (output_filename, O_RDONLY | O_BINARY); -+ if (fd < 0) -+ { -+ bfd_set_error (bfd_error_system_call); -+ einfo (_("%P%F:%s: cannot open object-only output: %E"), -+ output_filename); -+ } -+ -+ /* Get the object-only file size. */ -+ if (fstat (fd, &st) != 0) -+ { -+ bfd_set_error (bfd_error_system_call); -+ einfo (_("%P%F:%s: cannot stat object-only output: %E"), -+ output_filename); -+ } -+ -+ size = st.st_size; -+ off = 0; -+ contents = (bfd_byte *) xmalloc (size); -+ while (off != size) -+ { -+ ssize_t got; -+ -+ got = read (fd, contents + off, size - off); -+ if (got < 0) -+ { -+ bfd_set_error (bfd_error_system_call); -+ einfo (_("%P%F:%s: read failed on object-only output: %E"), -+ output_filename); -+ } -+ -+ off += got; -+ } -+ -+ close (fd); -+ -+ /* Remove the temporary object-only file. */ -+ unlink (output_filename); -+ -+ output_filename = saved_output_filename; -+ -+ cmdline_add_object_only_section (contents, size); -+ -+ free (contents); -+} -+ -+/* Extract the object-only section. */ -+ -+static const char * -+cmdline_extract_object_only_section (bfd *abfd) -+{ -+ const char *name = bfd_extract_object_only_section (abfd); -+ -+ if (name == NULL) -+ einfo (_("%P%F: cannot extract object-only section from %B: %E"), -+ abfd); -+ -+ /* It should be removed after it is done. */ -+ cmdline_list_append (&cmdline_temp_object_only_list, -+ cmdline_is_file_enum, (void *) name); -+ -+ return name; -+} -+ -+/* Check and handle the object-only section. */ -+ -+void -+cmdline_check_object_only_section (bfd *abfd, bfd_boolean lto) -+{ -+ const char *filename; -+ -+ if (link_info.emitting_gnu_object_only -+ || abfd->format != bfd_object) -+ return; -+ -+ if (lto) -+ { -+ /* For LTO link, we only need to extract object-only section -+ from the mixed object, add it to input, and put it on LTO -+ claimed output. */ -+ switch (abfd->lto_type) -+ { -+ default: -+ abort (); -+ case lto_mixed_object: -+ filename = cmdline_extract_object_only_section (abfd); -+ lang_add_input_file (filename, -+ lang_input_file_is_file_enum, NULL); -+ break; -+ case lto_non_ir_object: -+ case lto_ir_object: -+ break; -+ } -+ } -+ else if (bfd_link_relocatable (&link_info)) -+ { -+ /* For non-LTO relocatable link, we need to append non-IR object -+ file and the object file in object-only section to the object -+ only list. */ -+ switch (abfd->lto_type) -+ { -+ default: -+ abort (); -+ case lto_mixed_object: -+ filename = cmdline_extract_object_only_section (abfd); -+ cmdline_object_only_list_append (cmdline_is_file_enum, -+ (void *) filename); -+ break; -+ case lto_non_ir_object: -+ cmdline_object_only_list_append (cmdline_is_bfd_enum, abfd); -+ break; -+ case lto_ir_object: -+ break; -+ } -+ } -+} -+ -+/* Remove temporary object-only files. */ -+ -+void -+cmdline_remove_object_only_files (void) -+{ -+ cmdline_union_type *c; -+ -+#ifdef ENABLE_PLUGINS -+ if (plugin_save_temps) -+ return; -+#endif -+ -+ c = cmdline_temp_object_only_list.head; -+ for (; c != NULL; c = c->header.next) -+ switch (c->header.type) -+ { -+ default: -+ abort (); -+ case cmdline_is_file_enum: -+ unlink (c->file.filename); -+ break; -+ } -+} -diff -rup binutils-2.26.orig/ld/ldlang.h binutils-2.26/ld/ldlang.h ---- binutils-2.26.orig/ld/ldlang.h 2016-02-19 09:35:36.701003291 +0000 -+++ binutils-2.26/ld/ldlang.h 2016-02-19 09:35:54.921106611 +0000 -@@ -517,7 +517,7 @@ extern struct asneeded_minfo **asneeded_ - extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *); - - extern void lang_init -- (void); -+ (bfd_boolean); - extern void lang_finish - (void); - extern lang_memory_region_type * lang_memory_region_lookup -@@ -693,7 +693,48 @@ lang_ld_feature (char *); - extern void - lang_print_memory_usage (void); - - extern void - lang_add_gc_name (const char *); - -+typedef enum -+{ -+ cmdline_is_file_enum, -+ cmdline_is_bfd_enum -+} cmdline_enum_type; -+ -+typedef struct cmdline_header_struct -+{ -+ union cmdline_union *next; -+ cmdline_enum_type type; -+} cmdline_header_type; -+ -+typedef struct cmdline_file_struct -+{ -+ cmdline_header_type header; -+ const char *filename; -+} cmdline_file_type; -+ -+typedef struct cmdline_bfd_struct -+{ -+ cmdline_header_type header; -+ bfd *abfd; -+} cmdline_bfd_type; -+ -+typedef union cmdline_union -+{ -+ cmdline_header_type header; -+ cmdline_file_type file; -+ cmdline_bfd_type abfd; -+} cmdline_union_type; -+ -+typedef struct cmdline_list -+{ -+ cmdline_union_type *head; -+ cmdline_union_type **tail; -+} cmdline_list_type; -+ -+extern void cmdline_emit_object_only_section (void); -+extern void cmdline_check_object_only_section (bfd *, bfd_boolean); -+extern void cmdline_remove_object_only_files (void); -+ - #endif -diff -rup binutils-2.26.orig/ld/ldlex.h binutils-2.26/ld/ldlex.h ---- binutils-2.26.orig/ld/ldlex.h 2016-02-19 09:35:36.701003291 +0000 -+++ binutils-2.26/ld/ldlex.h 2016-02-19 09:35:54.921106611 +0000 -@@ -134,6 +134,7 @@ enum option_values - #ifdef ENABLE_PLUGINS - OPTION_PLUGIN, - OPTION_PLUGIN_OPT, -+ OPTION_PLUGIN_SAVE_TEMPS, - #endif /* ENABLE_PLUGINS */ - OPTION_DEFAULT_SCRIPT, - OPTION_PRINT_OUTPUT_FORMAT, -diff -rup binutils-2.26.orig/ld/ldmain.c binutils-2.26/ld/ldmain.c ---- binutils-2.26.orig/ld/ldmain.c 2016-02-19 09:35:36.701003291 +0000 -+++ binutils-2.26/ld/ldmain.c 2016-02-19 09:35:54.922106617 +0000 -@@ -219,6 +219,9 @@ main (int argc, char **argv) - - xatexit (ld_cleanup); - -+ /* Remove temporary object-only files. */ -+ xatexit (cmdline_remove_object_only_files); -+ - /* Set up the sysroot directory. */ - ld_sysroot = get_sysroot (argc, argv); - if (*ld_sysroot) -@@ -291,8 +294,8 @@ main (int argc, char **argv) - default_target = ldemul_choose_target (argc, argv); - config.maxpagesize = bfd_emul_get_maxpagesize (default_target); - config.commonpagesize = bfd_emul_get_commonpagesize (default_target); -- lang_init (); -- ldexp_init (); -+ lang_init (FALSE); -+ ldexp_init (FALSE); - ldemul_before_parse (); - lang_has_input_file = FALSE; - parse_args (argc, argv); -@@ -307,34 +310,7 @@ main (int argc, char **argv) - - ldemul_set_symbols (); - -- /* If we have not already opened and parsed a linker script, -- try the default script from command line first. */ -- if (saved_script_handle == NULL -- && command_line.default_script != NULL) -- { -- ldfile_open_command_file (command_line.default_script); -- parser_input = input_script; -- yyparse (); -- } -- -- /* If we have not already opened and parsed a linker script -- read the emulation's appropriate default script. */ -- if (saved_script_handle == NULL) -- { -- int isfile; -- char *s = ldemul_get_script (&isfile); -- -- if (isfile) -- ldfile_open_default_command_file (s); -- else -- { -- lex_string = s; -- lex_redirect (s, _("built in linker script"), 1); -- } -- parser_input = input_script; -- yyparse (); -- lex_string = NULL; -- } -+ ld_parse_linker_script (); - - if (verbose) - { -@@ -445,7 +421,7 @@ main (int argc, char **argv) - fprintf (stderr, "lookup = %p val %lx\n", h, h ? h->u.def.value : 1); - } - #endif -- ldexp_finish (); -+ ldexp_finish (FALSE); - lang_finish (); - - /* Even if we're producing relocatable output, some non-fatal errors should -@@ -465,6 +441,8 @@ main (int argc, char **argv) - if (!bfd_close (link_info.output_bfd)) - einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd); - -+ link_info.output_bfd = NULL; -+ - /* If the --force-exe-suffix is enabled, and we're making an - executable file and it doesn't end in .exe, copy it to one - which does. */ -@@ -512,6 +490,9 @@ main (int argc, char **argv) - } - } - -+ if (link_info.emit_gnu_object_only) -+ cmdline_emit_object_only_section (); -+ - END_PROGRESS (program_name); - - if (config.stats) -@@ -805,7 +786,9 @@ add_archive_element (struct bfd_link_inf - *subsbfd = input->the_bfd; - } - } -+ else - #endif /* ENABLE_PLUGINS */ -+ cmdline_check_object_only_section (input->the_bfd, FALSE); - - ldlang_add_file (input); - -@@ -1484,3 +1467,38 @@ notice (struct bfd_link_info *info, - - return TRUE; - } -+ -+/* Parse the linker script. */ -+ -+void -+ld_parse_linker_script () -+{ -+ /* If we have not already opened and parsed a linker script, -+ try the default script from command line first. */ -+ if (saved_script_handle == NULL -+ && command_line.default_script != NULL) -+ { -+ ldfile_open_command_file (command_line.default_script); -+ parser_input = input_script; -+ yyparse (); -+ } -+ -+ /* If we have not already opened and parsed a linker script -+ read the emulation's appropriate default script. */ -+ if (saved_script_handle == NULL) -+ { -+ int isfile; -+ char *s = ldemul_get_script (&isfile); -+ -+ if (isfile) -+ ldfile_open_default_command_file (s); -+ else -+ { -+ lex_string = s; -+ lex_redirect (s, _("built in linker script"), 1); -+ } -+ parser_input = input_script; -+ yyparse (); -+ lex_string = NULL; -+ } -+} -diff -rup binutils-2.26.orig/ld/ldmain.h binutils-2.26/ld/ldmain.h ---- binutils-2.26.orig/ld/ldmain.h 2016-02-19 09:35:36.701003291 +0000 -+++ binutils-2.26/ld/ldmain.h 2016-02-19 09:35:54.922106617 +0000 -@@ -59,4 +59,6 @@ extern void add_wrap (const char *); - extern void add_ignoresym (struct bfd_link_info *, const char *); - extern void add_keepsyms_file (const char *); - -+extern void ld_parse_linker_script (void); -+ - #endif -diff -rup binutils-2.26.orig/ld/lexsup.c binutils-2.26/ld/lexsup.c ---- binutils-2.26.orig/ld/lexsup.c 2016-02-19 09:35:36.700003285 +0000 -+++ binutils-2.26/ld/lexsup.c 2016-02-19 09:35:54.923106623 +0000 -@@ -169,6 +169,9 @@ static const struct ld_option ld_options - '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH }, - { {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT}, - '\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH }, -+ { {"plugin-save-temps", no_argument, NULL, OPTION_PLUGIN_SAVE_TEMPS}, -+ '\0', NULL, N_("Store plugin intermediate files permanently"), -+ ONE_DASH }, - { {"flto", optional_argument, NULL, OPTION_IGNORE}, - '\0', NULL, N_("Ignored for GCC LTO option compatibility"), - ONE_DASH }, -@@ -1020,6 +1023,9 @@ parse_args (unsigned argc, char **argv) - if (plugin_opt_plugin_arg (optarg)) - einfo (_("%P%F: bad -plugin-opt option\n")); - break; -+ case OPTION_PLUGIN_SAVE_TEMPS: -+ plugin_save_temps = TRUE; -+ break; - #endif /* ENABLE_PLUGINS */ - case 'q': - link_info.emitrelocations = TRUE; -diff -rup binutils-2.26.orig/ld/plugin.c binutils-2.26/ld/plugin.c ---- binutils-2.26.orig/ld/plugin.c 2016-02-19 09:35:36.702003296 +0000 -+++ binutils-2.26/ld/plugin.c 2016-02-19 09:35:54.923106623 +0000 -@@ -57,6 +57,9 @@ extern int errno; - /* Report plugin symbols. */ - bfd_boolean report_plugin_symbols; - -+/* Store plugin intermediate files permanently. */ -+bfd_boolean plugin_save_temps; -+ - /* The suffix to append to the name of the real (claimed) object file - when generating a dummy BFD to hold the IR symbols sent from the - plugin. For cosmetic use only; appears in maps, crefs etc. */ -@@ -1182,6 +1185,9 @@ plugin_maybe_claim (lang_input_statement - { - bfd *abfd = entry->the_bfd->plugin_dummy_bfd; - -+ /* Check object only section. */ -+ cmdline_check_object_only_section (entry->the_bfd, TRUE); -+ - /* Discard the real file's BFD and substitute the dummy one. */ - - /* We can't call bfd_close on archives. BFD archive handling -@@ -1227,14 +1233,17 @@ plugin_call_cleanup (void) - { - if (curplug->cleanup_handler && !curplug->cleanup_done) - { -- enum ld_plugin_status rv; -- curplug->cleanup_done = TRUE; -- called_plugin = curplug; -- rv = (*curplug->cleanup_handler) (); -- called_plugin = NULL; -- if (rv != LDPS_OK) -- info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"), -- curplug->name, rv); -+ if (!plugin_save_temps) -+ { -+ enum ld_plugin_status rv; -+ curplug->cleanup_done = TRUE; -+ called_plugin = curplug; -+ rv = (*curplug->cleanup_handler) (); -+ called_plugin = NULL; -+ if (rv != LDPS_OK) -+ info_msg (_("%P: %s: error in plugin cleanup: %d (ignored)\n"), -+ curplug->name, rv); -+ } - dlclose (curplug->dlhandle); - } - curplug = curplug->next; -diff -rup binutils-2.26.orig/ld/plugin.h binutils-2.26/ld/plugin.h ---- binutils-2.26.orig/ld/plugin.h 2016-02-19 09:35:36.702003296 +0000 -+++ binutils-2.26/ld/plugin.h 2016-02-19 09:35:54.924106628 +0000 -@@ -24,6 +24,9 @@ - /* Report plugin symbols. */ - extern bfd_boolean report_plugin_symbols; - -+/* Store plugin intermediate files permanently. */ -+extern bfd_boolean plugin_save_temps; -+ - /* Set at all symbols read time, to avoid recursively offering the plugin - its own newly-added input files and libs to claim. */ - extern bfd_boolean no_more_claiming; -diff -rup binutils-2.26.orig/ld/scripttempl/armbpabi.sc binutils-2.26/ld/scripttempl/armbpabi.sc ---- binutils-2.26.orig/ld/scripttempl/armbpabi.sc 2016-02-19 09:35:36.704003308 +0000 -+++ binutils-2.26/ld/scripttempl/armbpabi.sc 2016-02-19 09:35:54.924106628 +0000 -@@ -36,7 +36,7 @@ INTERP=".interp 0 : { *(.interp) } - PLT=".plt ${RELOCATING-0} : { *(.plt) }" - RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" - DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }" - if test -z "${NO_SMALL_DATA}"; then - SBSS=".sbss ${RELOCATING-0} : - { -diff -rup binutils-2.26.orig/ld/scripttempl/elf32sh-symbian.sc binutils-2.26/ld/scripttempl/elf32sh-symbian.sc ---- binutils-2.26.orig/ld/scripttempl/elf32sh-symbian.sc 2016-02-19 09:35:36.705003313 +0000 -+++ binutils-2.26/ld/scripttempl/elf32sh-symbian.sc 2016-02-19 09:35:54.925106634 +0000 -@@ -88,7 +88,7 @@ fi - PLT=".plt : { *(.plt) } :dynamic :dyn" - DYNAMIC=".dynamic : { *(.dynamic) } :dynamic :dyn" - RODATA=".rodata ALIGN(4) : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.directive) *(.gnu.lto_*) *(.gnu_object_only) }" - test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) } :dynamic :dyn" - INIT_ARRAY=".init_array ${RELOCATING-0} : - { -diff -rup binutils-2.26.orig/ld/scripttempl/elf64hppa.sc binutils-2.26/ld/scripttempl/elf64hppa.sc ---- binutils-2.26.orig/ld/scripttempl/elf64hppa.sc 2016-02-19 09:35:36.705003313 +0000 -+++ binutils-2.26/ld/scripttempl/elf64hppa.sc 2016-02-19 09:35:54.925106634 +0000 -@@ -132,7 +132,7 @@ fi - DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" - RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" - DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }" - if test -z "${NO_SMALL_DATA}"; then - SBSS=".sbss ${RELOCATING-0} : - { -diff -rup binutils-2.26.orig/ld/scripttempl/elf.sc binutils-2.26/ld/scripttempl/elf.sc ---- binutils-2.26.orig/ld/scripttempl/elf.sc 2016-02-19 09:35:36.705003313 +0000 -+++ binutils-2.26/ld/scripttempl/elf.sc 2016-02-19 09:35:54.924106628 +0000 -@@ -170,7 +170,7 @@ RELA_IPLT=".rela.iplt ${RELOCATING-0} - DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" - RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }" - DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }" - if test -z "${NO_SMALL_DATA}"; then - SBSS=".${SBSS_NAME} ${RELOCATING-0} : - { -diff -rup binutils-2.26.orig/ld/scripttempl/elfxtensa.sc binutils-2.26/ld/scripttempl/elfxtensa.sc ---- binutils-2.26.orig/ld/scripttempl/elfxtensa.sc 2016-02-19 09:35:36.705003313 +0000 -+++ binutils-2.26/ld/scripttempl/elfxtensa.sc 2016-02-19 09:35:54.925106634 +0000 -@@ -145,7 +145,7 @@ fi - DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" - RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" - DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }" - INIT_LIT=".init.literal 0 : { *(.init.literal) }" - INIT=".init 0 : { *(.init) }" - FINI_LIT=".fini.literal 0 : { *(.fini.literal) }" -diff -rup binutils-2.26.orig/ld/scripttempl/mep.sc binutils-2.26/ld/scripttempl/mep.sc ---- binutils-2.26.orig/ld/scripttempl/mep.sc 2016-02-19 09:35:36.706003319 +0000 -+++ binutils-2.26/ld/scripttempl/mep.sc 2016-02-19 09:35:54.926106640 +0000 -@@ -119,7 +119,7 @@ fi - DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" - RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" - DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }" --DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" -+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.gnu_object_only) }" - if test -z "${NO_SMALL_DATA}"; then - SBSS=".sbss ${RELOCATING-0} : - { -diff -rup binutils-2.26.orig/ld/scripttempl/pep.sc binutils-2.26/ld/scripttempl/pep.sc ---- binutils-2.26.orig/ld/scripttempl/pep.sc 2016-02-19 09:35:36.706003319 +0000 -+++ binutils-2.26/ld/scripttempl/pep.sc 2016-02-19 09:35:54.926106640 +0000 -@@ -178,6 +178,7 @@ SECTIONS - *(.drectve) - ${RELOCATING+ *(.note.GNU-stack)} - ${RELOCATING+ *(.gnu.lto_*)} -+ ${RELOCATING+ *(.gnu_object_only)} - } - - .idata ${RELOCATING+BLOCK(__section_alignment__)} : -diff -rup binutils-2.26.orig/ld/scripttempl/pe.sc binutils-2.26/ld/scripttempl/pe.sc ---- binutils-2.26.orig/ld/scripttempl/pe.sc 2016-02-19 09:35:36.706003319 +0000 -+++ binutils-2.26/ld/scripttempl/pe.sc 2016-02-19 09:35:54.926106640 +0000 -@@ -165,6 +165,7 @@ SECTIONS - *(.drectve) - ${RELOCATING+ *(.note.GNU-stack)} - ${RELOCATING+ *(.gnu.lto_*)} -+ ${RELOCATING+ *(.gnu_object_only)} - } - - .idata ${RELOCATING+BLOCK(__section_alignment__)} : ---- binutils.orig/bfd/bfd-in2.h 2017-03-02 11:14:48.572979573 +0000 -+++ binutils-2.28/bfd/bfd-in2.h 2017-03-02 11:21:39.828458555 +0000 -@@ -1118,6 +1118,9 @@ bfd_boolean bfd_fill_in_gnu_debuglink_se - - char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir); - -+const char *bfd_extract_object_only_section -+ (bfd *abfd); -+ - /* Extracted from libbfd.c. */ - - /* Byte swapping macros for user section data. */ ---- binutils.orig/bfd/opncls.c 2017-03-02 11:14:48.586979385 +0000 -+++ binutils-2.28/bfd/opncls.c 2017-03-02 11:23:23.546065945 +0000 -@@ -1990,3 +1990,69 @@ bfd_follow_build_id_debuglink (bfd *abfd - get_build_id_name, - check_build_id_file, &build_id); - } -+ -+/* -+FUNCTION -+ bfd_extract_object_only_section -+ -+SYNOPSIS -+ const char *bfd_extract_object_only_section -+ (bfd *abfd); -+ -+DESCRIPTION -+ -+ Takes a @var{ABFD} and extract the .gnu_object_only section into -+ a temporary file. -+ -+RETURNS -+ The name of the temporary file is returned if all is ok. -+ Otherwise <> is returned and bfd_error is set. -+*/ -+ -+const char * -+bfd_extract_object_only_section (bfd *abfd) -+{ -+ asection *sec = abfd->object_only_section; -+ const char *name; -+ FILE *file; -+ bfd_byte *memhunk = NULL; -+ size_t off, size; -+ bfd_error_type err; -+ -+ /* Get a temporary object-only file. */ -+ name = make_temp_file (".obj-only.o"); -+ -+ /* Open the object-only file. */ -+ file = _bfd_real_fopen (name, FOPEN_WB); -+ if (!bfd_get_full_section_contents (abfd, sec, &memhunk)) -+ { -+ err = bfd_get_error (); -+ -+loser: -+ free (memhunk); -+ fclose (file); -+ unlink (name); -+ bfd_set_error (err); -+ return NULL; -+ } -+ -+ off = 0; -+ size = sec->size; -+ while (off != size) -+ { -+ size_t written, nwrite = size - off; -+ -+ written = fwrite (memhunk + off, 1, nwrite, file); -+ if (written < nwrite && ferror (file)) -+ { -+ err = bfd_error_system_call; -+ goto loser; -+ } -+ -+ off += written; -+ } -+ -+ free (memhunk); -+ fclose (file); -+ return name; -+} ---- binutils.orig/bfd/plugin.c 2017-03-02 11:37:31.572677260 +0000 -+++ binutils-2.28/bfd/plugin.c 2017-03-02 11:40:35.246209573 +0000 -@@ -132,10 +132,10 @@ register_claim_file (ld_plugin_claim_fil - } - - static asection bfd_plugin_fake_text_section -- = BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, 0, ".text", 0); -+= BFD_FAKE_SECTION (bfd_plugin_fake_text_section, 0, ".text", 0, 0); - static asection bfd_plugin_fake_common_section -- = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, SEC_IS_COMMON, 0, -- NULL, 0); -+ = BFD_FAKE_SECTION (bfd_plugin_fake_common_section, 0, -+ NULL, 0, SEC_IS_COMMON); - - /* Get symbols from object only section. */ - ---- binutils.orig/ld/emultempl/armelf.em 2017-03-02 11:58:14.632981042 +0000 -+++ binutils-2.28/ld/emultempl/armelf.em 2017-03-02 12:00:55.663819055 +0000 -@@ -414,7 +414,7 @@ gld${EMULATION_NAME}_after_allocation (v - } - - static void --gld${EMULATION_NAME}_finish (void) -+arm_finish (void) - { - struct bfd_link_hash_entry * h; - -@@ -441,7 +441,7 @@ gld${EMULATION_NAME}_finish (void) - } - } - -- finish_default (); -+ gld${EMULATION_NAME}_finish (); - - if (params.thumb_entry_symbol) - { -@@ -790,4 +790,4 @@ LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME - LDEMUL_SET_SYMBOLS=gld"${EMULATION_NAME}"_set_symbols - - # Call the extra arm-elf function --LDEMUL_FINISH=gld${EMULATION_NAME}_finish -+LDEMUL_FINISH=arm_finish ---- binutils.orig/ld/emultempl/ppc64elf.em 2017-03-02 11:58:14.632981042 +0000 -+++ binutils-2.28/ld/emultempl/ppc64elf.em 2017-03-02 12:01:40.961210895 +0000 -@@ -561,7 +561,7 @@ gld${EMULATION_NAME}_after_allocation (v - /* Final emulation specific call. */ - - static void --gld${EMULATION_NAME}_finish (void) -+ppc_finish (void) - { - char *msg = NULL; - char *line, *endline; -@@ -592,7 +592,7 @@ gld${EMULATION_NAME}_finish (void) - if (msg != NULL) - free (msg); - -- finish_default (); -+ gld${EMULATION_NAME}_finish (); - } - - -@@ -926,4 +926,4 @@ LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS= - LDEMUL_AFTER_OPEN=ppc_after_open - LDEMUL_BEFORE_ALLOCATION=ppc_before_allocation - 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.28-ignore-gold-duplicates.patch b/binutils-2.28-ignore-gold-duplicates.patch deleted file mode 100644 index 346f956..0000000 --- a/binutils-2.28-ignore-gold-duplicates.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -rup binutils.orig/ld/ldmain.c binutils-2.28/ld/ldmain.c ---- binutils.orig/ld/ldmain.c 2017-06-09 09:08:26.954016429 +0100 -+++ binutils-2.28/ld/ldmain.c 2017-06-09 09:09:11.307490976 +0100 -@@ -923,6 +923,10 @@ multiple_definition (struct bfd_link_inf - obfd = h->u.def.section->owner; - break; - case bfd_link_hash_indirect: -+ /* PR 21074: The GOLD linker can produce multiple indirect -+ refences to the same symbol. These can be ignored. */ -+ if (bfd_is_ind_section (nsec)) -+ return; - osec = bfd_ind_section_ptr; - oval = 0; - obfd = NULL; diff --git a/binutils-2.30-allow_R_AARCH64-symbols.patch b/binutils-2.30-allow_R_AARCH64-symbols.patch deleted file mode 100644 index 213b267..0000000 --- a/binutils-2.30-allow_R_AARCH64-symbols.patch +++ /dev/null @@ -1,147 +0,0 @@ -From 279b2f94168ee91e02ccd070d27c983fc001fe12 Mon Sep 17 00:00:00 2001 -From: Renlin Li -Date: Sat, 3 Feb 2018 13:18:17 +0000 -Subject: [PATCH] [PR22764][LD][AARCH64]Allow R_AARCH64_ABS16 and - R_AARCH64_ABS32 against absolution symbol or undefine symbol in shared - object. - -The assumption that R_AARCH64_ABS16 and R_AARCH64_ABS32 relocation in LP64 abi -will be used to generate an address does not hold for absolute symbol. -In this case, it is a value fixed at static linking time. - -The condition to check the relocations is relax to allow absolute symbol and -undefined symbol case. - -bfd/ - -2018-02-05 Renlin Li - - PR ld/22764 - * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Relax the - R_AARCH64_ABS32 and R_AARCH64_ABS16 for absolute symbol. Apply the - check for writeable section as well. - -ld/ - -2018-02-05 Renlin Li - - PR ld/22764 - * testsuite/ld-aarch64/emit-relocs-258.s: Define symbol as an address. - * testsuite/ld-aarch64/emit-relocs-259.s: Likewise. - * testsuite/ld-aarch64/aarch64-elf.exp: Run new test. - * testsuite/ld-aarch64/pr22764.s: New. - * testsuite/ld-aarch64/pr22764.d: New. ---- - bfd/ChangeLog | 7 +++++++ - bfd/elfnn-aarch64.c | 15 ++++++++++++--- - ld/ChangeLog | 8 ++++++++ - ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 + - ld/testsuite/ld-aarch64/emit-relocs-258.s | 3 ++- - ld/testsuite/ld-aarch64/emit-relocs-259.s | 3 ++- - ld/testsuite/ld-aarch64/pr22764.d | 18 ++++++++++++++++++ - ld/testsuite/ld-aarch64/pr22764.s | 6 ++++++ - 8 files changed, 56 insertions(+), 5 deletions(-) - create mode 100644 ld/testsuite/ld-aarch64/pr22764.d - create mode 100644 ld/testsuite/ld-aarch64/pr22764.s - -diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c -index af448f9..2737773 100644 ---- a/bfd/elfnn-aarch64.c -+++ b/bfd/elfnn-aarch64.c -@@ -7189,10 +7189,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, - #if ARCH_SIZE == 64 - case BFD_RELOC_AARCH64_32: - #endif -- if (bfd_link_pic (info) -- && (sec->flags & SEC_ALLOC) != 0 -- && (sec->flags & SEC_READONLY) != 0) -+ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0) - { -+ if (h != NULL -+ /* This is an absolute symbol. It represents a value instead -+ of an address. */ -+ && ((h->root.type == bfd_link_hash_defined -+ && bfd_is_abs_section (h->root.u.def.section)) -+ /* This is an undefined symbol. */ -+ || h->root.type == bfd_link_hash_undefined)) -+ break; -+ -+ /* For local symbols, defined global symbols in a non-ABS section, -+ it is assumed that the value is an address. */ - int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; - _bfd_error_handler - /* xgettext:c-format */ -diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp -index 2602a43..c67ffb1 100644 ---- a/ld/testsuite/ld-aarch64/aarch64-elf.exp -+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp -@@ -285,6 +285,7 @@ run_dump_test "pr17415" - run_dump_test_lp64 "tprel_g2_overflow" - run_dump_test "tprel_add_lo12_overflow" - run_dump_test "protected-data" -+run_dump_test_lp64 "pr22764" - - # ifunc tests - run_dump_test "ifunc-1" -diff --git a/ld/testsuite/ld-aarch64/emit-relocs-258.s b/ld/testsuite/ld-aarch64/emit-relocs-258.s -index f724776..87bb657 100644 ---- a/ld/testsuite/ld-aarch64/emit-relocs-258.s -+++ b/ld/testsuite/ld-aarch64/emit-relocs-258.s -@@ -1,5 +1,6 @@ -+.global dummy - .text -- -+dummy: - ldr x0, .L1 - - .L1: -diff --git a/ld/testsuite/ld-aarch64/emit-relocs-259.s b/ld/testsuite/ld-aarch64/emit-relocs-259.s -index 7e1ba3c..0977c9d 100644 ---- a/ld/testsuite/ld-aarch64/emit-relocs-259.s -+++ b/ld/testsuite/ld-aarch64/emit-relocs-259.s -@@ -1,5 +1,6 @@ -+.global dummy - .text -- -+dummy: - ldr x0, .L1 - - .L1: -diff --git a/ld/testsuite/ld-aarch64/pr22764.d b/ld/testsuite/ld-aarch64/pr22764.d -new file mode 100644 -index 0000000..997519f ---- /dev/null -+++ b/ld/testsuite/ld-aarch64/pr22764.d -@@ -0,0 +1,18 @@ -+#source: pr22764.s -+#ld: -shared -T relocs.ld -defsym sym_abs1=0x1 -defsym sym_abs2=0x2 -defsym sym_abs3=0x3 -e0 --emit-relocs -+#notarget: aarch64_be-*-* -+#objdump: -dr -+#... -+ -+Disassembly of section \.text: -+ -+0000000000010000 \<\.text\>: -+ 10000: d503201f nop -+ ... -+ 10004: R_AARCH64_ABS64 sym_abs1 -+ 1000c: 00000002 \.word 0x00000002 -+ 1000c: R_AARCH64_ABS32 sym_abs2 -+ 10010: 0003 \.short 0x0003 -+ 10010: R_AARCH64_ABS16 sym_abs3 -+ 10012: 0000 \.short 0x0000 -+ 10014: d503201f nop -diff --git a/ld/testsuite/ld-aarch64/pr22764.s b/ld/testsuite/ld-aarch64/pr22764.s -new file mode 100644 -index 0000000..25e36b4 ---- /dev/null -+++ b/ld/testsuite/ld-aarch64/pr22764.s -@@ -0,0 +1,6 @@ -+ .text -+ nop -+ .xword sym_abs1 -+ .word sym_abs2 -+ .short sym_abs3 -+ nop --- -2.9.3 diff --git a/binutils-2.31-export-demangle.h.patch b/binutils-2.31-export-demangle.h.patch deleted file mode 100644 index e59f393..0000000 --- a/binutils-2.31-export-demangle.h.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -rup binutils.orig/bfd/Makefile.am binutils-2.30.90/bfd/Makefile.am ---- binutils.orig/bfd/Makefile.am 2018-07-09 09:49:43.378323137 +0100 -+++ binutils-2.30.90/bfd/Makefile.am 2018-07-09 09:50:40.252723495 +0100 -@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@ - bfdincludedir = @bfdincludedir@ - bfdlib_LTLIBRARIES = libbfd.la - bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ -- $(INCDIR)/bfdlink.h $(INCDIR)/diagnostics.h -+ $(INCDIR)/bfdlink.h $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h - else !INSTALL_LIBBFD - # Empty these so that the respective installation directories will not be created. - bfdlibdir = -diff -rup binutils.orig/bfd/Makefile.in binutils-2.30.90/bfd/Makefile.in ---- binutils.orig/bfd/Makefile.in 2018-07-09 09:49:42.757329685 +0100 -+++ binutils-2.30.90/bfd/Makefile.in 2018-07-09 09:51:16.145345812 +0100 -@@ -248,7 +248,7 @@ am__can_run_installinfo = \ - esac - am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \ - $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h \ -- $(INCDIR)/diagnostics.h -+ $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h - HEADERS = $(bfdinclude_HEADERS) - RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -@@ -467,7 +467,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel - @INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2) - @INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \ - @INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ --@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h \ -+@INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h \ - @INSTALL_LIBBFD_TRUE@ $(INCDIR)/diagnostics.h $(am__append_2) - @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@ - @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la diff --git a/binutils-CVE-2018-10372.patch b/binutils-CVE-2018-10372.patch deleted file mode 100644 index 073a407..0000000 --- a/binutils-CVE-2018-10372.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- binutils.orig/binutils/dwarf.c 2018-05-01 11:42:02.656431736 +0100 -+++ binutils-2.30/binutils/dwarf.c 2018-05-01 11:43:24.210383020 +0100 -@@ -9244,7 +9244,18 @@ process_cu_tu_index (struct dwarf_sectio - } - - if (!do_display) -- memcpy (&this_set[row - 1].signature, ph, sizeof (uint64_t)); -+ { -+ size_t num_copy = sizeof (uint64_t); -+ -+ /* PR 23064: Beware of buffer overflow. */ -+ if (ph + num_copy < limit) -+ memcpy (&this_set[row - 1].signature, ph, num_copy); -+ else -+ { -+ warn (_("Signature (%p) extends beyond end of space in section\n"), ph); -+ return 0; -+ } -+ } - - prow = poffsets + (row - 1) * ncols * 4; - /* PR 17531: file: b8ce60a8. */ diff --git a/binutils-CVE-2018-10373.patch b/binutils-CVE-2018-10373.patch deleted file mode 100644 index 21964f8..0000000 --- a/binutils-CVE-2018-10373.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- binutils.orig/bfd/dwarf2.c 2018-05-01 11:42:03.152425647 +0100 -+++ binutils-2.30/bfd/dwarf2.c 2018-05-01 12:03:27.533735710 +0100 -@@ -1559,7 +1559,7 @@ concat_filename (struct line_info_table - { - char *filename; - -- if (file - 1 >= table->num_files) -+ if (table == NULL || file - 1 >= table->num_files) - { - /* FILE == 0 means unknown. */ - if (file) diff --git a/binutils-CVE-2018-10534.patch b/binutils-CVE-2018-10534.patch deleted file mode 100644 index d06f9ea..0000000 --- a/binutils-CVE-2018-10534.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- binutils.orig/bfd/peXXigen.c 2018-05-10 10:09:03.619147342 +0100 -+++ binutils-2.30/bfd/peXXigen.c 2018-05-10 10:20:20.884883540 +0100 -@@ -2991,6 +2991,15 @@ _bfd_XX_bfd_copy_private_bfd_data_common - bfd_get_section_size (section) - (addr - section->vma)); - return FALSE; - } -+ /* PR 23110. */ -+ else if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size < 0) -+ { -+ /* xgettext:c-format */ -+ _bfd_error_handler -+ (_("%pB: Data Directory size (%#lx) is negative"), -+ obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size); -+ return FALSE; -+ } - - for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size - / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) diff --git a/binutils-CVE-2018-10535.patch b/binutils-CVE-2018-10535.patch deleted file mode 100644 index a442e47..0000000 --- a/binutils-CVE-2018-10535.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- binutils.orig/bfd/elf.c 2018-05-10 10:09:03.622147305 +0100 -+++ binutils-2.30/bfd/elf.c 2018-05-10 10:29:09.895577234 +0100 -@@ -4021,16 +4021,23 @@ ignore_section_sym (bfd *abfd, asymbol * - { - elf_symbol_type *type_ptr; - -+ if (sym == NULL) -+ return FALSE; -+ - if ((sym->flags & BSF_SECTION_SYM) == 0) - return FALSE; - -+ if (sym->section == NULL) -+ return TRUE; -+ - type_ptr = elf_symbol_from (abfd, sym); - return ((type_ptr != NULL - && type_ptr->internal_elf_sym.st_shndx != 0 - && bfd_is_abs_section (sym->section)) - || !(sym->section->owner == abfd -- || (sym->section->output_section->owner == abfd -- && sym->section->output_offset == 0) -+ || (sym->section->output_section != NULL -+ && sym->section->output_section->owner == abfd -+ && sym->section->output_offset == 0) - || bfd_is_abs_section (sym->section))); - } - diff --git a/binutils-CVE-2018-17358.patch b/binutils-CVE-2018-17358.patch deleted file mode 100644 index fd91fda..0000000 --- a/binutils-CVE-2018-17358.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff -rup binutils.orig/bfd/dwarf2.c binutils-2.30/bfd/dwarf2.c ---- binutils.orig/bfd/dwarf2.c 2018-09-26 15:07:47.162863937 +0100 -+++ binutils-2.30/bfd/dwarf2.c 2018-09-26 15:08:50.868368183 +0100 -@@ -527,6 +527,7 @@ read_section (bfd * abfd, - asection *msec; - const char *section_name = sec->uncompressed_name; - bfd_byte *contents = *section_buffer; -+ bfd_size_type amt; - - /* The section may have already been read. */ - if (contents == NULL) -@@ -549,7 +550,14 @@ read_section (bfd * abfd, - *section_size = msec->rawsize ? msec->rawsize : msec->size; - /* Paranoia - alloc one extra so that we can make sure a string - section is NUL terminated. */ -- contents = (bfd_byte *) bfd_malloc (*section_size + 1); -+ amt = *section_size + 1; -+ if (amt == 0) -+ { -+ bfd_set_error (bfd_error_no_memory); -+ return FALSE; -+ } -+ contents = (bfd_byte *) bfd_malloc (amt); -+ - if (contents == NULL) - return FALSE; - if (syms -diff -rup binutils.orig/bfd/syms.c binutils-2.30/bfd/syms.c ---- binutils.orig/bfd/syms.c 2018-09-26 15:07:47.162863937 +0100 -+++ binutils-2.30/bfd/syms.c 2018-09-26 15:11:41.671038993 +0100 -@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd - 0, strsize)) - return FALSE; - -+ /* Stab strings ought to be nul terminated. Ensure the last one -+ is, to prevent running off the end of the buffer. */ -+ info->strs[strsize - 1] = 0; -+ - /* If this is a relocatable object file, we have to relocate - the entries in .stab. This should always be simple 32 bit - relocations against symbols defined in this object file, so -@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd - || r->howto->bitsize != 32 - || r->howto->pc_relative - || r->howto->bitpos != 0 -- || r->howto->dst_mask != 0xffffffff) -+ || r->howto->dst_mask != 0xffffffff -+ || r->address * bfd_octets_per_byte (abfd) + 4 > stabsize) - { - _bfd_error_handler - (_("unsupported .stab relocation")); -@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd - { - nul_fun = stab; - nul_str = str; -- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) -+ if (file_name >= (char *) info->strs + strsize -+ || file_name < (char *) str) - file_name = NULL; - if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize - && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) -@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd - directory_name = file_name; - file_name = ((char *) str - + bfd_get_32 (abfd, stab + STRDXOFF)); -- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) -+ if (file_name >= (char *) info->strs + strsize -+ || file_name < (char *) str) - file_name = NULL; - } - } -@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd - file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); - /* PR 17512: file: 0c680a1f. */ - /* PR 17512: file: 5da8aec4. */ -- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) -+ if (file_name >= (char *) info->strs + strsize -+ || file_name < (char *) str) - file_name = NULL; - break; - -@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd - function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); - if (function_name == (char *) str) - continue; -- if (function_name >= (char *) info->strs + strsize) -+ if (function_name >= (char *) info->strs + strsize -+ || function_name < (char *) str) - function_name = NULL; - - nul_fun = NULL; -@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd - if (val <= offset) - { - file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); -- if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) -+ if (file_name >= (char *) info->strs + strsize -+ || file_name < (char *) str) - file_name = NULL; - *pline = 0; - } diff --git a/binutils-CVE-2018-20002.patch b/binutils-CVE-2018-20002.patch deleted file mode 100644 index 69057c7..0000000 --- a/binutils-CVE-2018-20002.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -rup binutils.ori/bfd/syms.c binutils-2.31.1/bfd/syms.c ---- binutils.ori/bfd/syms.c 2019-01-03 13:51:05.784005438 +0000 -+++ binutils-2.31.1/bfd/syms.c 2019-01-03 13:53:43.238815129 +0000 -@@ -822,10 +822,18 @@ _bfd_generic_read_minisymbols (bfd *abfd - if (symcount < 0) - goto error_return; - -- *minisymsp = syms; -- *sizep = sizeof (asymbol *); -+ if (symcount == 0) -+ /* We return 0 above when storage is 0. Exit in the same state -+ here, so as to not complicate callers with having to deal with -+ freeing memory for zero symcount. */ -+ free (syms); -+ else -+ { -+ *minisymsp = syms; -+ *sizep = sizeof (asymbol *); -+ } - -- return symcount; -+ return symcount; - - error_return: - bfd_set_error (bfd_error_no_symbols); -diff -rup binutils.ori/binutils/nm.c binutils-2.31.1/binutils/nm.c ---- binutils.ori/binutils/nm.c 2019-01-03 13:51:06.337001258 +0000 -+++ binutils-2.31.1/binutils/nm.c 2019-01-03 13:52:37.542311774 +0000 -@@ -1162,13 +1162,11 @@ display_rel_file (bfd *abfd, bfd *archiv - if (synth_count > 0) - { - asymbol **symp; -- void *new_mini; - long i; - -- new_mini = xmalloc ((symcount + synth_count + 1) * sizeof (*symp)); -- symp = (asymbol **) new_mini; -- memcpy (symp, minisyms, symcount * sizeof (*symp)); -- symp += symcount; -+ minisyms = xrealloc (minisyms, -+ (symcount + synth_count + 1) * sizeof (*symp)); -+ symp = (asymbol **) minisyms + symcount; - for (i = 0; i < synth_count; i++) - *symp++ = synthsyms + i; - *symp = 0; -diff -rup binutils.orig/binutils/nm.c binutils-2.31.1/binutils/nm.c ---- binutils.orig/binutils/nm.c 2019-01-03 14:18:21.086458519 +0000 -+++ binutils-2.31.1/binutils/nm.c 2019-01-03 14:18:23.642438853 +0000 -@@ -1170,7 +1170,6 @@ display_rel_file (bfd *abfd, bfd *archiv - for (i = 0; i < synth_count; i++) - *symp++ = synthsyms + i; - *symp = 0; -- minisyms = new_mini; - symcount += synth_count; - } - } diff --git a/binutils-CVE-2018-6323.patch b/binutils-CVE-2018-6323.patch deleted file mode 100644 index bb698b8..0000000 --- a/binutils-CVE-2018-6323.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- binutils.orig/bfd/elfcode.h 2018-05-01 11:42:03.250424443 +0100 -+++ binutils-2.30/bfd/elfcode.h 2018-05-01 12:41:00.745780026 +0100 -@@ -680,7 +680,7 @@ elf_object_p (bfd *abfd) - if (i_ehdrp->e_shnum > ((bfd_size_type) -1) / sizeof (*i_shdrp)) - goto got_wrong_format_error; - #endif -- amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum; -+ amt = sizeof (*i_shdrp) * (bfd_size_type) i_ehdrp->e_shnum; - i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); - if (!i_shdrp) - goto got_no_match; -@@ -776,7 +776,7 @@ elf_object_p (bfd *abfd) - if (i_ehdrp->e_phnum > ((bfd_size_type) -1) / sizeof (*i_phdr)) - goto got_wrong_format_error; - #endif -- amt = i_ehdrp->e_phnum * sizeof (*i_phdr); -+ amt = (bfd_size_type) i_ehdrp->e_phnum * sizeof (*i_phdr); - elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); - if (elf_tdata (abfd)->phdr == NULL) - goto got_no_match; diff --git a/binutils-CVE-2018-6759.patch b/binutils-CVE-2018-6759.patch deleted file mode 100644 index c52a636..0000000 --- a/binutils-CVE-2018-6759.patch +++ /dev/null @@ -1,69 +0,0 @@ ---- binutils.orig/bfd/opncls.c 2018-05-01 11:42:03.266424248 +0100 -+++ binutils-2.30/bfd/opncls.c 2018-05-01 12:52:36.792579838 +0100 -@@ -1179,6 +1179,7 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo - bfd_byte *contents; - unsigned int crc_offset; - char *name; -+ bfd_size_type size; - - BFD_ASSERT (abfd); - BFD_ASSERT (crc32_out); -@@ -1188,6 +1189,12 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo - if (sect == NULL) - return NULL; - -+ size = bfd_get_section_size (sect); -+ -+ /* PR 22794: Make sure that the section has a reasonable size. */ -+ if (size < 8 || size >= bfd_get_size (abfd)) -+ return NULL; -+ - if (!bfd_malloc_and_get_section (abfd, sect, &contents)) - { - if (contents != NULL) -@@ -1198,9 +1205,9 @@ bfd_get_debug_link_info_1 (bfd *abfd, vo - /* CRC value is stored after the filename, aligned up to 4 bytes. */ - name = (char *) contents; - /* PR 17597: avoid reading off the end of the buffer. */ -- crc_offset = strnlen (name, bfd_get_section_size (sect)) + 1; -+ crc_offset = strnlen (name, size) + 1; - crc_offset = (crc_offset + 3) & ~3; -- if (crc_offset + 4 > bfd_get_section_size (sect)) -+ if (crc_offset + 4 > size) - return NULL; - - *crc32 = bfd_get_32 (abfd, contents + crc_offset); -@@ -1261,6 +1268,7 @@ bfd_get_alt_debug_link_info (bfd * abfd, - bfd_byte *contents; - unsigned int buildid_offset; - char *name; -+ bfd_size_type size; - - BFD_ASSERT (abfd); - BFD_ASSERT (buildid_len); -@@ -1271,6 +1279,10 @@ bfd_get_alt_debug_link_info (bfd * abfd, - if (sect == NULL) - return NULL; - -+ size = bfd_get_section_size (sect); -+ if (size < 8 || size >= bfd_get_size (abfd)) -+ return NULL; -+ - if (!bfd_malloc_and_get_section (abfd, sect, & contents)) - { - if (contents != NULL) -@@ -1280,11 +1292,11 @@ bfd_get_alt_debug_link_info (bfd * abfd, - - /* BuildID value is stored after the filename. */ - name = (char *) contents; -- buildid_offset = strnlen (name, bfd_get_section_size (sect)) + 1; -- if (buildid_offset >= bfd_get_section_size (sect)) -+ buildid_offset = strnlen (name, size) + 1; -+ if (buildid_offset >= size) - return NULL; - -- *buildid_len = bfd_get_section_size (sect) - buildid_offset; -+ *buildid_len = size - buildid_offset; - *buildid_out = bfd_malloc (*buildid_len); - memcpy (*buildid_out, contents + buildid_offset, *buildid_len); - diff --git a/binutils-CVE-2018-7208.patch b/binutils-CVE-2018-7208.patch deleted file mode 100644 index c817edc..0000000 --- a/binutils-CVE-2018-7208.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- binutils.orig/bfd/coffgen.c 2018-04-27 09:23:33.449859052 +0100 -+++ binutils-2.30/bfd/coffgen.c 2018-04-27 09:34:34.530135122 +0100 -@@ -1555,7 +1555,8 @@ coff_pointerize_aux (bfd *abfd, - } - /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can - generate one, so we must be careful to ignore it. */ -- if (auxent->u.auxent.x_sym.x_tagndx.l > 0) -+ if ((unsigned long) auxent->u.auxent.x_sym.x_tagndx.l -+ < obj_raw_syment_count (abfd)) - { - auxent->u.auxent.x_sym.x_tagndx.p = - table_base + auxent->u.auxent.x_sym.x_tagndx.l; diff --git a/binutils-CVE-2018-7568.patch b/binutils-CVE-2018-7568.patch deleted file mode 100644 index 7ce6f3e..0000000 --- a/binutils-CVE-2018-7568.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- binutils.orig/bfd/dwarf1.c 2018-05-01 13:04:35.060041875 +0100 -+++ binutils-2.30/bfd/dwarf1.c 2018-05-01 13:24:17.943833855 +0100 -@@ -213,6 +213,7 @@ parse_die (bfd * abfd, - /* Then the attributes. */ - while (xptr + 2 <= aDiePtrEnd) - { -+ unsigned int block_len; - unsigned short attr; - - /* Parse the attribute based on its form. This section -@@ -255,12 +256,24 @@ parse_die (bfd * abfd, - break; - case FORM_BLOCK2: - if (xptr + 2 <= aDiePtrEnd) -- xptr += bfd_get_16 (abfd, xptr); -+ { -+ block_len = bfd_get_16 (abfd, xptr); -+ if (xptr + block_len > aDiePtrEnd -+ || xptr + block_len < xptr) -+ return FALSE; -+ xptr += block_len; -+ } - xptr += 2; - break; - case FORM_BLOCK4: - if (xptr + 4 <= aDiePtrEnd) -- xptr += bfd_get_32 (abfd, xptr); -+ { -+ block_len = bfd_get_32 (abfd, xptr); -+ if (xptr + block_len > aDiePtrEnd -+ || xptr + block_len < xptr) -+ return FALSE; -+ xptr += block_len; -+ } - xptr += 4; - break; - case FORM_STRING: diff --git a/binutils-CVE-2018-7569.patch b/binutils-CVE-2018-7569.patch deleted file mode 100644 index 32962bd..0000000 --- a/binutils-CVE-2018-7569.patch +++ /dev/null @@ -1,75 +0,0 @@ ---- binutils.orig/bfd/dwarf2.c 2018-05-01 13:04:35.055041935 +0100 -+++ binutils-2.30/bfd/dwarf2.c 2018-05-01 13:31:32.882624448 +0100 -@@ -622,14 +622,24 @@ read_8_bytes (bfd *abfd, bfd_byte *buf, - } - - static bfd_byte * --read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, -- bfd_byte *buf, -- bfd_byte *end, -- unsigned int size ATTRIBUTE_UNUSED) --{ -- if (buf + size > end) -- return NULL; -- return buf; -+read_n_bytes (bfd_byte * buf, -+ bfd_byte * end, -+ struct dwarf_block * block) -+{ -+ unsigned int size = block->size; -+ bfd_byte * block_end = buf + size; -+ -+ if (block_end > end || block_end < buf) -+ { -+ block->data = NULL; -+ block->size = 0; -+ return end; -+ } -+ else -+ { -+ block->data = buf; -+ return block_end; -+ } - } - - /* Scans a NUL terminated string starting at BUF, returning a pointer to it. -@@ -1127,8 +1137,7 @@ read_attribute_value (struct attribute * - return NULL; - blk->size = read_2_bytes (abfd, info_ptr, info_ptr_end); - info_ptr += 2; -- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); -- info_ptr += blk->size; -+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; - case DW_FORM_block4: -@@ -1138,8 +1147,7 @@ read_attribute_value (struct attribute * - return NULL; - blk->size = read_4_bytes (abfd, info_ptr, info_ptr_end); - info_ptr += 4; -- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); -- info_ptr += blk->size; -+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; - case DW_FORM_data2: -@@ -1179,8 +1187,7 @@ read_attribute_value (struct attribute * - blk->size = _bfd_safe_read_leb128 (abfd, info_ptr, &bytes_read, - FALSE, info_ptr_end); - info_ptr += bytes_read; -- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); -- info_ptr += blk->size; -+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; - case DW_FORM_block1: -@@ -1190,8 +1197,7 @@ read_attribute_value (struct attribute * - return NULL; - blk->size = read_1_byte (abfd, info_ptr, info_ptr_end); - info_ptr += 1; -- blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); -- info_ptr += blk->size; -+ info_ptr = read_n_bytes (info_ptr, info_ptr_end, blk); - attr->u.blk = blk; - break; - case DW_FORM_data1: diff --git a/binutils-CVE-2018-7570.patch b/binutils-CVE-2018-7570.patch deleted file mode 100644 index e057d63..0000000 --- a/binutils-CVE-2018-7570.patch +++ /dev/null @@ -1,156 +0,0 @@ ---- binutils.orig/bfd/elf.c 2018-05-01 11:42:03.151425659 +0100 -+++ binutils-2.30/bfd/elf.c 2018-05-01 12:30:42.129206856 +0100 -@@ -5713,6 +5713,9 @@ assign_file_positions_for_load_sections - return TRUE; - } - -+#define IS_TBSS(s) \ -+ ((s->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) == SEC_THREAD_LOCAL) -+ - /* Assign file positions for the other sections. */ - - static bfd_boolean -@@ -5862,65 +5865,100 @@ assign_file_positions_for_non_load_secti - { - if (p->p_type == PT_GNU_RELRO) - { -- const Elf_Internal_Phdr *lp; -- struct elf_segment_map *lm; -+ bfd_vma start, end; -+ bfd_boolean ok; - - if (link_info != NULL) - { - /* During linking the range of the RELRO segment is passed -- in link_info. */ -+ in link_info. Note that there may be padding between -+ relro_start and the first RELRO section. */ -+ start = link_info->relro_start; -+ end = link_info->relro_end; -+ } -+ else if (m->count != 0) -+ { -+ if (!m->p_size_valid) -+ abort (); -+ start = m->sections[0]->vma; -+ end = start + m->p_size; -+ } -+ else -+ { -+ start = 0; -+ end = 0; -+ } -+ -+ ok = FALSE; -+ if (start < end) -+ { -+ struct elf_segment_map *lm; -+ const Elf_Internal_Phdr *lp; -+ unsigned int i; -+ -+ /* Find a LOAD segment containing a section in the RELRO -+ segment. */ - for (lm = elf_seg_map (abfd), lp = phdrs; - lm != NULL; - lm = lm->next, lp++) - { - if (lp->p_type == PT_LOAD -- && lp->p_vaddr < link_info->relro_end - && lm->count != 0 -- && lm->sections[0]->vma >= link_info->relro_start) -+ && (lm->sections[lm->count - 1]->vma -+ + (!IS_TBSS (lm->sections[lm->count - 1]) -+ ? lm->sections[lm->count - 1]->size -+ : 0)) > start -+ && lm->sections[0]->vma < end) - break; - } - -- BFD_ASSERT (lm != NULL); -- } -- else -- { -- /* Otherwise we are copying an executable or shared -- library, but we need to use the same linker logic. */ -- for (lp = phdrs; lp < phdrs + count; ++lp) -+ if (lm != NULL) - { -- if (lp->p_type == PT_LOAD -- && lp->p_paddr == p->p_paddr) -- break; -+ /* Find the section starting the RELRO segment. */ -+ for (i = 0; i < lm->count; i++) -+ { -+ asection *s = lm->sections[i]; -+ if (s->vma >= start -+ && s->vma < end -+ && s->size != 0) -+ break; -+ } -+ -+ if (i < lm->count) -+ { -+ p->p_vaddr = lm->sections[i]->vma; -+ p->p_paddr = lm->sections[i]->lma; -+ p->p_offset = lm->sections[i]->filepos; -+ p->p_memsz = end - p->p_vaddr; -+ p->p_filesz = p->p_memsz; -+ -+ /* The RELRO segment typically ends a few bytes -+ into .got.plt but other layouts are possible. -+ In cases where the end does not match any -+ loaded section (for instance is in file -+ padding), trim p_filesz back to correspond to -+ the end of loaded section contents. */ -+ if (p->p_filesz > lp->p_vaddr + lp->p_filesz - p->p_vaddr) -+ p->p_filesz = lp->p_vaddr + lp->p_filesz - p->p_vaddr; -+ -+ /* Preserve the alignment and flags if they are -+ valid. The gold linker generates RW/4 for -+ the PT_GNU_RELRO section. It is better for -+ objcopy/strip to honor these attributes -+ otherwise gdb will choke when using separate -+ debug files. */ -+ if (!m->p_align_valid) -+ p->p_align = 1; -+ if (!m->p_flags_valid) -+ p->p_flags = PF_R; -+ ok = TRUE; -+ } - } - } -- -- if (lp < phdrs + count) -- { -- p->p_vaddr = lp->p_vaddr; -- p->p_paddr = lp->p_paddr; -- p->p_offset = lp->p_offset; -- if (link_info != NULL) -- p->p_filesz = link_info->relro_end - lp->p_vaddr; -- else if (m->p_size_valid) -- p->p_filesz = m->p_size; -- else -- abort (); -- p->p_memsz = p->p_filesz; -- /* Preserve the alignment and flags if they are valid. The -- gold linker generates RW/4 for the PT_GNU_RELRO section. -- It is better for objcopy/strip to honor these attributes -- otherwise gdb will choke when using separate debug files. -- */ -- if (!m->p_align_valid) -- p->p_align = 1; -- if (!m->p_flags_valid) -- p->p_flags = PF_R; -- } -- else -- { -- memset (p, 0, sizeof *p); -- p->p_type = PT_NULL; -- } -+ if (link_info != NULL) -+ BFD_ASSERT (ok); -+ if (!ok) -+ memset (p, 0, sizeof *p); - } - else if (p->p_type == PT_GNU_STACK) - { diff --git a/binutils-CVE-2018-7642.patch b/binutils-CVE-2018-7642.patch deleted file mode 100644 index 62178da..0000000 --- a/binutils-CVE-2018-7642.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- binutils.orig/bfd/aoutx.h 2018-04-26 15:14:18.411450291 +0100 -+++ binutils-2.30/bfd/aoutx.h 2018-04-26 17:22:38.328770529 +0100 -@@ -2283,10 +2283,12 @@ NAME (aout, swap_std_reloc_in) (bfd *abf - if (r_baserel) - r_extern = 1; - -- if (r_extern && r_index > symcount) -+ if (r_extern && r_index >= symcount) - { - /* We could arrange to return an error, but it might be useful -- to see the file even if it is bad. */ -+ to see the file even if it is bad. FIXME: Of course this -+ means that objdump -r *doesn't* see the actual reloc, and -+ objcopy silently writes a different reloc. */ - r_extern = 0; - r_index = N_ABS; - } diff --git a/binutils-CVE-2018-7643.patch b/binutils-CVE-2018-7643.patch deleted file mode 100644 index 6ccf257..0000000 --- a/binutils-CVE-2018-7643.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- binutils.orig/binutils/dwarf.c 2018-04-27 09:22:07.402864408 +0100 -+++ binutils-2.30/binutils/dwarf.c 2018-04-27 09:24:26.794235786 +0100 -@@ -6810,6 +6810,13 @@ display_debug_ranges (struct dwarf_secti - continue; - } - -+ if (next < section_begin || next >= finish) -+ { -+ warn (_("Corrupt offset (%#8.8lx) in range entry %u\n"), -+ (unsigned long) offset, i); -+ continue; -+ } -+ - if (dwarf_check != 0 && i > 0) - { - if (start < next) diff --git a/binutils-CVE-2018-8945.patch b/binutils-CVE-2018-8945.patch deleted file mode 100644 index 33ec9f5..0000000 --- a/binutils-CVE-2018-8945.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff -rup binutils.orig/bfd/elf-attrs.c binutils-2.30/bfd/elf-attrs.c ---- binutils.orig/bfd/elf-attrs.c 2018-05-17 14:14:04.341805666 +0100 -+++ binutils-2.30/bfd/elf-attrs.c 2018-05-17 14:15:19.729952453 +0100 -@@ -438,6 +438,14 @@ _bfd_elf_parse_attributes (bfd *abfd, El - /* PR 17512: file: 2844a11d. */ - if (hdr->sh_size == 0) - return; -+ if (hdr->sh_size > bfd_get_file_size (abfd)) -+ { -+ _bfd_error_handler (_("%pB: error: attribute section '%pA' too big: %#llx"), -+ abfd, hdr->bfd_section, (long long) hdr->sh_size); -+ bfd_set_error (bfd_error_invalid_operation); -+ return; -+ } -+ - contents = (bfd_byte *) bfd_malloc (hdr->sh_size + 1); - if (!contents) - return; -diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c ---- binutils.orig/bfd/elf.c 2018-05-17 14:14:04.326805836 +0100 -+++ binutils-2.30/bfd/elf.c 2018-05-17 14:15:59.412503342 +0100 -@@ -298,6 +298,7 @@ bfd_elf_get_str_section (bfd *abfd, unsi - /* Allocate and clear an extra byte at the end, to prevent crashes - in case the string table is not terminated. */ - if (shstrtabsize + 1 <= 1 -+ || shstrtabsize > bfd_get_file_size (abfd) - || bfd_seek (abfd, offset, SEEK_SET) != 0 - || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL) - shstrtab = NULL; diff --git a/binutils-CVE-2019-9071.patch b/binutils-CVE-2019-9071.patch index 0b0736d..f4ef3bc 100644 --- a/binutils-CVE-2019-9071.patch +++ b/binutils-CVE-2019-9071.patch @@ -43,7 +43,7 @@ - d_count_templates_scopes (num_templates, num_scopes, - d_right (dc)); + /* PR 89394 - Check for too much recursion. */ -+ if (dpi->recursion > MAX_RECURSION_COUNT) ++ if (dpi->recursion > DEMANGLE_RECURSION_LIMIT) + /* FIXME: There ought to be a way to report to the + user that the recursion limit has been reached. */ + return; @@ -100,10 +100,10 @@ - d_count_templates_scopes (&dpi->num_copy_templates, - &dpi->num_saved_scopes, dc); + d_count_templates_scopes (dpi, dc); -+ /* If we did not reach the recursion limit then reset the ++ /* If we did not reach the recursion limit, then reset the + current recursion value back to 0, so that we can print + the templates. */ -+ if (dpi->recursion < MAX_RECURSION_COUNT) ++ if (dpi->recursion < DEMANGLE_RECURSION_LIMIT) + dpi->recursion = 0; dpi->num_copy_templates *= dpi->num_saved_scopes; diff --git a/binutils-PowerPC-IEEE-long-double-warnings.patch b/binutils-PowerPC-IEEE-long-double-warnings.patch deleted file mode 100644 index 2c3d8d3..0000000 --- a/binutils-PowerPC-IEEE-long-double-warnings.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- binutils.orig/bfd/elf32-ppc.c 2018-06-12 17:35:40.931551297 +0100 -+++ binutils-2.30/bfd/elf32-ppc.c 2018-06-12 17:37:22.252441292 +0100 -@@ -4677,12 +4677,12 @@ _bfd_elf_ppc_merge_fp_attributes (bfd *i - _bfd_error_handler - /* xgettext:c-format */ - (_("Warning: %B uses IBM long double, " -- "%B uses IEEE long double"), ibfd, obfd); -+ "%B uses IEEE long double"), obfd, ibfd); - else if (out_fp == 3 * 4 && in_fp == 1 * 4) - _bfd_error_handler - /* xgettext:c-format */ - (_("Warning: %B uses IBM long double, " -- "%B uses IEEE long double"), obfd, ibfd); -+ "%B uses IEEE long double"), ibfd, obfd); - } - } - diff --git a/binutils-clear-version-info.patch b/binutils-clear-version-info.patch deleted file mode 100644 index d5d5c20..0000000 --- a/binutils-clear-version-info.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- binutils.orig/bfd/elflink.c 2018-08-14 10:25:09.108322746 +0100 -+++ binutils-2.31.1/bfd/elflink.c 2018-08-14 10:28:45.617780256 +0100 -@@ -686,13 +686,11 @@ bfd_elf_record_link_assignment (bfd *out - && !h->def_regular) - h->root.type = bfd_link_hash_undefined; - -- /* If this symbol is not being provided by the linker script, and it is -- currently defined by a dynamic object, but not by a regular object, -- then clear out any version information because the symbol will not be -- associated with the dynamic object any more. */ -- if (!provide -- && h->def_dynamic -- && !h->def_regular) -+ /* If this symbol is currently defined by a dynamic object, but not -+ by a regular object, then clear out any version information because -+ the symbol will not be associated with the dynamic object any -+ more. */ -+ if (h->def_dynamic && !h->def_regular) - h->verinfo.verdef = NULL; - - /* Make sure this symbol is not garbage collected. */ diff --git a/binutils-debug-section-marking.patch b/binutils-debug-section-marking.patch deleted file mode 100644 index d1dfdc5..0000000 --- a/binutils-debug-section-marking.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- binutils.orig/bfd/elflink.c 2018-03-14 10:14:49.729271271 +0000 -+++ binutils-2.30/bfd/elflink.c 2018-03-14 10:15:15.748967793 +0000 -@@ -12785,7 +12785,7 @@ _bfd_elf_gc_mark_hook (asection *sec, - return NULL; - } - --/* Return the global debug definition section. */ -+/* Return the debug definition section. */ - - static asection * - elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED, -@@ -12794,11 +12794,22 @@ elf_gc_mark_debug_section (asection *sec - struct elf_link_hash_entry *h, - Elf_Internal_Sym *sym ATTRIBUTE_UNUSED) - { -- if (h != NULL -- && (h->root.type == bfd_link_hash_defined -- || h->root.type == bfd_link_hash_defweak) -- && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0) -- return h->root.u.def.section; -+ if (h != NULL) -+ { -+ /* Return the global debug definition section. */ -+ if ((h->root.type == bfd_link_hash_defined -+ || h->root.type == bfd_link_hash_defweak) -+ && (h->root.u.def.section->flags & SEC_DEBUGGING) != 0) -+ return h->root.u.def.section; -+ } -+ else -+ { -+ /* Return the local debug definition section. */ -+ asection *isec = bfd_section_from_elf_index (sec->owner, -+ sym->st_shndx); -+ if ((isec->flags & SEC_DEBUGGING) != 0) -+ return isec; -+ } - - return NULL; - } diff --git a/binutils-delay-ld-script-constant-eval.patch b/binutils-delay-ld-script-constant-eval.patch deleted file mode 100644 index ff20b6a..0000000 --- a/binutils-delay-ld-script-constant-eval.patch +++ /dev/null @@ -1,196 +0,0 @@ -diff -rup binutils.orig/ld/emultempl/pe.em binutils-2.31.1/ld/emultempl/pe.em ---- binutils.orig/ld/emultempl/pe.em 2018-09-04 11:00:05.546667021 +0100 -+++ binutils-2.31.1/ld/emultempl/pe.em 2018-09-04 11:00:58.427292612 +0100 -@@ -2165,7 +2165,7 @@ gld_${EMULATION_NAME}_place_orphan (asec - &add_child); - if (bfd_link_relocatable (&link_info)) - { -- os->section_alignment = s->alignment_power; -+ os->section_alignment = exp_intop (1U << s->alignment_power); - os->bfd_section->alignment_power = s->alignment_power; - } - } -diff -rup binutils.orig/ld/emultempl/pep.em binutils-2.31.1/ld/emultempl/pep.em ---- binutils.orig/ld/emultempl/pep.em 2018-09-04 11:00:05.545667029 +0100 -+++ binutils-2.31.1/ld/emultempl/pep.em 2018-09-04 11:01:29.340073740 +0100 -@@ -1962,7 +1962,7 @@ gld_${EMULATION_NAME}_place_orphan (asec - &add_child); - if (bfd_link_relocatable (&link_info)) - { -- os->section_alignment = s->alignment_power; -+ os->section_alignment = exp_intop (1U << s->alignment_power); - os->bfd_section->alignment_power = s->alignment_power; - } - } -diff -rup binutils.orig/ld/ldexp.c binutils-2.31.1/ld/ldexp.c ---- binutils.orig/ld/ldexp.c 2018-09-04 11:00:05.535667100 +0100 -+++ binutils-2.31.1/ld/ldexp.c 2018-09-04 11:03:29.179225246 +0100 -@@ -1528,6 +1528,28 @@ exp_get_value_int (etree_type *tree, int - return exp_get_vma (tree, def, name); - } - -+/* Return the smallest non-negative integer such that two raised to -+ that power is at least as large as the vma evaluated at TREE, if -+ TREE is a non-NULL expression that can be resolved. If TREE is -+ NULL or cannot be resolved, return -1. */ -+ -+signed int -+exp_get_power (etree_type *tree, char *name) -+{ -+ bfd_vma x = exp_get_vma (tree, -1, name); -+ bfd_vma p2; -+ int n; -+ -+ if (x == (bfd_vma) -1) -+ return -1; -+ -+ for (n = 0, p2 = 1; p2 < x; ++n, p2 <<= 1) -+ if (p2 == 0) -+ break; -+ -+ return n; -+} -+ - fill_type * - exp_get_fill (etree_type *tree, fill_type *def, char *name) - { -diff -rup binutils.orig/ld/ldexp.h binutils-2.31.1/ld/ldexp.h ---- binutils.orig/ld/ldexp.h 2018-09-04 11:00:05.536667092 +0100 -+++ binutils-2.31.1/ld/ldexp.h 2018-09-04 11:04:12.937915422 +0100 -@@ -231,6 +231,8 @@ bfd_vma exp_get_vma - (etree_type *, bfd_vma, char *); - int exp_get_value_int - (etree_type *, int, char *); -+signed int exp_get_power -+ (etree_type *, char *); - fill_type *exp_get_fill - (etree_type *, fill_type *, char *); - bfd_vma exp_get_abs_int -diff -rup binutils.orig/ld/ldlang.c binutils-2.31.1/ld/ldlang.c ---- binutils.orig/ld/ldlang.c 2018-09-04 11:00:05.536667092 +0100 -+++ binutils-2.31.1/ld/ldlang.c 2018-09-04 11:07:42.249433438 +0100 -@@ -1199,8 +1199,8 @@ output_section_statement_newfunc (struct - ret = (struct out_section_hash_entry *) entry; - memset (&ret->s, 0, sizeof (ret->s)); - ret->s.header.type = lang_output_section_statement_enum; -- ret->s.output_section_statement.subsection_alignment = -1; -- ret->s.output_section_statement.section_alignment = -1; -+ ret->s.output_section_statement.subsection_alignment = NULL; -+ ret->s.output_section_statement.section_alignment = NULL; - ret->s.output_section_statement.block_value = 1; - lang_list_init (&ret->s.output_section_statement.children); - lang_statement_append (stat_ptr, &ret->s, &ret->s.header.next); -@@ -2193,8 +2193,9 @@ init_os (lang_output_section_statement_t - exp_init_os (s->load_base); - - /* If supplied an alignment, set it. */ -- if (s->section_alignment != -1) -- s->bfd_section->alignment_power = s->section_alignment; -+ if (s->section_alignment != NULL) -+ s->bfd_section->alignment_power = exp_get_power (s->section_alignment, -+ "section alignment"); - } - - /* Make sure that all output sections mentioned in an expression are -@@ -4706,8 +4707,10 @@ size_input_section - is greater than any seen before, then record it too. Perform - the alignment by inserting a magic 'padding' statement. */ - -- if (output_section_statement->subsection_alignment != -1) -- i->alignment_power = output_section_statement->subsection_alignment; -+ if (output_section_statement->subsection_alignment != NULL) -+ i->alignment_power -+ = exp_get_power (output_section_statement->subsection_alignment, -+ "subsection alignment"); - - if (o->alignment_power < i->alignment_power) - o->alignment_power = i->alignment_power; -@@ -5147,7 +5150,8 @@ lang_size_sections_1 - section_alignment = os->bfd_section->alignment_power; - } - else -- section_alignment = os->section_alignment; -+ section_alignment = exp_get_power (os->section_alignment, -+ "section alignment"); - - /* Align to what the section needs. */ - if (section_alignment > 0) -@@ -5225,7 +5229,8 @@ lang_size_sections_1 - only align according to the value in the output - statement. */ - if (os->lma_region != os->region) -- section_alignment = os->section_alignment; -+ section_alignment = exp_get_power (os->section_alignment, -+ "section alignment"); - if (section_alignment > 0) - lma = align_power (lma, section_alignment); - } -@@ -6673,25 +6678,6 @@ lang_add_output (const char *name, int f - } - } - --static int --topower (int x) --{ -- unsigned int i = 1; -- int l; -- -- if (x < 0) -- return -1; -- -- for (l = 0; l < 32; l++) -- { -- if (i >= (unsigned int) x) -- return l; -- i <<= 1; -- } -- -- return 0; --} -- - lang_output_section_statement_type * - lang_enter_output_section_statement (const char *output_section_statement_name, - etree_type *address_exp, -@@ -6727,10 +6713,8 @@ lang_enter_output_section_statement (con - einfo (_("%F%P:%pS: error: align with input and explicit align specified\n"), - NULL); - -- os->subsection_alignment = -- topower (exp_get_value_int (subalign, -1, "subsection alignment")); -- os->section_alignment = -- topower (exp_get_value_int (align, -1, "section alignment")); -+ os->subsection_alignment = subalign; -+ os->section_alignment = align; - - os->load_base = ebase; - return os; -@@ -7748,7 +7732,7 @@ lang_new_phdr (const char *name, - n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr)); - n->next = NULL; - n->name = name; -- n->type = exp_get_value_int (type, 0, "program header type"); -+ n->type = exp_get_vma (type, 0, "program header type"); - n->filehdr = filehdr; - n->phdrs = phdrs; - n->at = at; -diff -rup binutils.orig/ld/ldlang.h binutils-2.31.1/ld/ldlang.h ---- binutils.orig/ld/ldlang.h 2018-09-04 11:00:05.533667114 +0100 -+++ binutils-2.31.1/ld/ldlang.h 2018-09-04 11:08:29.224100845 +0100 -@@ -143,6 +143,8 @@ typedef struct lang_output_section_state - fill_type *fill; - union etree_union *addr_tree; - union etree_union *load_base; -+ union etree_union *section_alignment; -+ union etree_union *subsection_alignment; - - /* If non-null, an expression to evaluate after setting the section's - size. The expression is evaluated inside REGION (above) with '.' -@@ -153,8 +155,6 @@ typedef struct lang_output_section_state - lang_output_section_phdr_list *phdrs; - - unsigned int block_value; -- int subsection_alignment; /* Alignment of components. */ -- int section_alignment; /* Alignment of start of section. */ - int constraint; - flagword flags; - enum section_type sectype; diff --git a/binutils-detect-corrupt-sym-version-info.patch b/binutils-detect-corrupt-sym-version-info.patch deleted file mode 100644 index dc7cf17..0000000 --- a/binutils-detect-corrupt-sym-version-info.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff -rup binutils,orig/bfd/elf.c binutils-2.31.1/bfd/elf.c ---- binutils,orig/bfd/elf.c 2018-08-28 12:38:29.987511521 +0100 -+++ binutils-2.31.1/bfd/elf.c 2018-08-28 12:39:35.010036349 +0100 -@@ -1877,7 +1877,7 @@ _bfd_elf_get_symbol_version_string (bfd - { - Elf_Internal_Verneed *t; - -- version_string = ""; -+ version_string = _(""); - for (t = elf_tdata (abfd)->verref; - t != NULL; - t = t->vn_nextref) -diff -rup binutils,orig/binutils/readelf.c binutils-2.31.1/binutils/readelf.c ---- binutils,orig/binutils/readelf.c 2018-08-28 12:38:30.552507392 +0100 -+++ binutils-2.31.1/binutils/readelf.c 2018-08-28 12:42:04.625942967 +0100 -@@ -11263,6 +11263,7 @@ get_symbol_version_string (Filedata * - unsigned char data[2]; - unsigned short vers_data; - unsigned long offset; -+ unsigned short max_vd_ndx; - - if (!is_dynsym - || version_info[DT_VERSIONTAGIDX (DT_VERSYM)] == 0) -@@ -11280,6 +11281,8 @@ get_symbol_version_string (Filedata * - if ((vers_data & VERSYM_HIDDEN) == 0 && vers_data == 0) - return NULL; - -+ max_vd_ndx = 0; -+ - /* Usually we'd only see verdef for defined symbols, and verneed for - undefined symbols. However, symbols defined by the linker in - .dynbss for variables copied from a shared library in order to -@@ -11322,6 +11325,9 @@ get_symbol_version_string (Filedata * - ivd.vd_flags = BYTE_GET (evd.vd_flags); - } - -+ if ((ivd.vd_ndx & VERSYM_VERSION) > max_vd_ndx) -+ max_vd_ndx = ivd.vd_ndx & VERSYM_VERSION; -+ - off += ivd.vd_next; - } - while (ivd.vd_ndx != (vers_data & VERSYM_VERSION) && ivd.vd_next != 0); -@@ -11413,6 +11419,9 @@ get_symbol_version_string (Filedata * - return (ivna.vna_name < strtab_size - ? strtab + ivna.vna_name : _("")); - } -+ else if ((max_vd_ndx || (vers_data & VERSYM_VERSION) != 1) -+ && (vers_data & VERSYM_VERSION) > max_vd_ndx) -+ return _(""); - } - return NULL; - } diff --git a/binutils-disable-readelf-gap-reports.patch b/binutils-disable-readelf-gap-reports.patch deleted file mode 100644 index cee63ba..0000000 --- a/binutils-disable-readelf-gap-reports.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- binutils.orig/binutils/readelf.c 2018-09-05 14:08:22.733186922 +0100 -+++ binutils-2.30/binutils/readelf.c 2018-09-05 15:35:38.009749485 +0100 -@@ -17634,11 +17634,12 @@ print_gnu_build_attribute_description (E - - if (is_open_attr) - { -+#if 0 - /* 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); -- -+#endif - printf (_(" Applies to region from %#lx"), start); - global_offset = start; - diff --git a/binutils-export-demangle.h.patch b/binutils-export-demangle.h.patch new file mode 100644 index 0000000..6e47d7d --- /dev/null +++ b/binutils-export-demangle.h.patch @@ -0,0 +1,33 @@ +diff -rup binutils.orig/bfd/Makefile.am binutils-2.32/bfd/Makefile.am +--- binutils.orig/bfd/Makefile.am 2019-02-08 12:22:51.395684251 +0000 ++++ binutils-2.32/bfd/Makefile.am 2019-02-08 12:22:53.970664973 +0000 +@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@ + bfdincludedir = @bfdincludedir@ + bfdlib_LTLIBRARIES = libbfd.la + bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ +- bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h ++ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h + else !INSTALL_LIBBFD + # Empty these so that the respective installation directories will not be created. + bfdlibdir = +diff -rup binutils.orig/bfd/Makefile.in binutils-2.32/bfd/Makefile.in +--- binutils.orig/bfd/Makefile.in 2019-02-08 12:21:35.291254044 +0000 ++++ binutils-2.32/bfd/Makefile.in 2019-02-08 12:22:10.163992947 +0000 +@@ -249,7 +249,7 @@ am__can_run_installinfo = \ + esac + am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bfd_stdint.h \ +- $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h ++ $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h $(INCDIR)/demangle.h + HEADERS = $(bfdinclude_HEADERS) + RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +@@ -468,7 +468,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -rel + @INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2) + @INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \ + @INSTALL_LIBBFD_TRUE@ $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ +-@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h \ ++@INSTALL_LIBBFD_TRUE@ bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/demangle.h \ + @INSTALL_LIBBFD_TRUE@ $(INCDIR)/bfdlink.h $(am__append_2) + @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@ + @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la diff --git a/binutils-fix-testsuite-failures.patch b/binutils-fix-testsuite-failures.patch index b8a1a56..c171343 100644 --- a/binutils-fix-testsuite-failures.patch +++ b/binutils-fix-testsuite-failures.patch @@ -1,657 +1,352 @@ -diff -rup binutils.orig/gold/testsuite/Makefile.am binutils-2.30/gold/testsuite/Makefile.am ---- binutils.orig/gold/testsuite/Makefile.am 2018-05-31 16:14:12.736538727 +0100 -+++ binutils-2.30/gold/testsuite/Makefile.am 2018-06-01 10:15:00.936103521 +0100 -@@ -393,7 +393,7 @@ icf_sht_rel_addend_test: icf_sht_rel_add - icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test - $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout - --check_PROGRAMS += large_symbol_alignment -+# check_PROGRAMS += large_symbol_alignment - large_symbol_alignment_SOURCES = large_symbol_alignment.cc - large_symbol_alignment_DEPENDENCIES = gcctestdir/ld - large_symbol_alignment_LDFLAGS = -Bgcctestdir/ -@@ -783,7 +783,7 @@ weak_test_DEPENDENCIES = gcctestdir/ld - weak_test_LDFLAGS = -Bgcctestdir/ - weak_test_LDADD = - --check_PROGRAMS += weak_undef_test -+# check_PROGRAMS += weak_undef_test - MOSTLYCLEANFILES += alt/weak_undef_lib.so - weak_undef_test_SOURCES = weak_undef_test.cc - weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so -@@ -1409,7 +1409,7 @@ initpri2_DEPENDENCIES = gcctestdir/ld - initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array - initpri2_LDADD = - --check_PROGRAMS += initpri3a -+# check_PROGRAMS += initpri3a - initpri3a_SOURCES = initpri3.c - initpri3a_DEPENDENCIES = gcctestdir/ld - initpri3a_LDFLAGS = -Bgcctestdir/ -@@ -1897,19 +1897,19 @@ relro_script_test_LDADD = relro_script_t - relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o - $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o - --check_PROGRAMS += script_test_1 -+# check_PROGRAMS += script_test_1 - script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc - script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t - script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t - script_test_1_LDADD = - --check_PROGRAMS += script_test_2 -+# check_PROGRAMS += script_test_2 - script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc - script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t - script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t - script_test_2_LDADD = - --check_PROGRAMS += justsyms -+# check_PROGRAMS += justsyms - justsyms_SOURCES = justsyms_1.cc - justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o - justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o -@@ -1919,7 +1919,7 @@ justsyms_2.o: justsyms_2.cc - justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t - gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o - --check_PROGRAMS += justsyms_exec -+# check_PROGRAMS += justsyms_exec - justsyms_exec_SOURCES = justsyms_exec.c - justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib - justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib -@@ -1930,7 +1930,7 @@ justsyms_lib.o: justsyms_lib.c - justsyms_lib: justsyms_lib.o gcctestdir/ld - gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o - --check_PROGRAMS += binary_test -+# check_PROGRAMS += binary_test - MOSTLYCLEANFILES += binary.txt - binary_test_SOURCES = binary_test.cc - binary_test_DEPENDENCIES = gcctestdir/ld binary.txt -@@ -1952,7 +1952,7 @@ ver_matching_def_pic.o: ver_matching_def - ver_matching_test.stdout: ver_matching_def.so - $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout - --check_PROGRAMS += script_test_3 -+# check_PROGRAMS += script_test_3 - check_SCRIPTS += script_test_3.sh - check_DATA += script_test_3.stdout - MOSTLYCLEANFILES += script_test_3.stdout -@@ -1961,7 +1961,7 @@ script_test_3: basic_test.o gcctestdir/l - script_test_3.stdout: script_test_3 - $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout - --check_PROGRAMS += tls_phdrs_script_test -+# check_PROGRAMS += tls_phdrs_script_test - tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES) - tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t - tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t -@@ -2043,7 +2043,7 @@ check_PROGRAMS += script_test_12 - script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o - $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o - --check_PROGRAMS += script_test_12i -+# check_PROGRAMS += script_test_12i - script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o - $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o - script_test_12a.o: script_test_12a.c -@@ -3023,7 +3023,7 @@ two_file_test_2_ndebug.o: two_file_test_ - two_file_test_main_ndebug.o: two_file_test_main.cc - $(CXXCOMPILE) -O0 -g0 -c -o $@ $< - --check_PROGRAMS += incremental_test_2 -+# check_PROGRAMS += incremental_test_2 - MOSTLYCLEANFILES += two_file_test_tmp_2.o - incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \ - two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld -@@ -3033,7 +3033,7 @@ incremental_test_2: two_file_test_1_v1_n - cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o - $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o - --check_PROGRAMS += incremental_test_3 -+# check_PROGRAMS += incremental_test_3 - MOSTLYCLEANFILES += two_file_test_tmp_3.o - incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \ - two_file_test_2.o two_file_test_main.o gcctestdir/ld -@@ -3043,7 +3043,7 @@ incremental_test_3: two_file_test_1.o tw - cp -f two_file_test_1b.o two_file_test_tmp_3.o - $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o - --check_PROGRAMS += incremental_test_4 -+# check_PROGRAMS += incremental_test_4 - MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o - incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \ - two_file_test_2.o two_file_test_main.o gcctestdir/ld -@@ -3054,7 +3054,7 @@ incremental_test_4: two_file_test_1.o tw - cp -f two_file_test_2.o two_file_test_tmp_4.o - $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o - --check_PROGRAMS += incremental_test_5 -+# check_PROGRAMS += incremental_test_5 - MOSTLYCLEANFILES += two_file_test_5.a - incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \ - two_file_test_2.o two_file_test_main.o gcctestdir/ld -@@ -3068,7 +3068,7 @@ incremental_test_5: two_file_test_1.o tw - - # Test the --incremental-unchanged flag with an archive library. - # The second link should not update the library. --check_PROGRAMS += incremental_test_6 -+# check_PROGRAMS += incremental_test_6 - MOSTLYCLEANFILES += two_file_test_6.a - incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \ - two_file_test_2.o two_file_test_main.o gcctestdir/ld -@@ -3080,7 +3080,7 @@ incremental_test_6: two_file_test_1.o tw - $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o - $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown - --check_PROGRAMS += incremental_copy_test -+# check_PROGRAMS += incremental_copy_test - incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so - cp -f copy_test_v1.o copy_test_tmp.o - $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so -@@ -3088,7 +3088,7 @@ incremental_copy_test: copy_test_v1.o co - cp -f copy_test.o copy_test_tmp.o - $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so - --check_PROGRAMS += incremental_common_test_1 -+# check_PROGRAMS += incremental_common_test_1 - incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld - cp -f common_test_1_v1.o common_test_1_tmp.o - $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ common_test_1_tmp.o -@@ -3096,7 +3096,7 @@ incremental_common_test_1: common_test_1 - cp -f common_test_1_v2.o common_test_1_tmp.o - $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro,-no-pie -Bgcctestdir/ common_test_1_tmp.o - --check_PROGRAMS += incremental_comdat_test_1 -+# check_PROGRAMS += incremental_comdat_test_1 - incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_comdat_test_2_v2.o incr_comdat_test_2_v3.o gcctestdir/ld - cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o - $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro,-no-pie -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o -diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/Makefile.in ---- binutils.orig/gold/testsuite/Makefile.in 2018-05-31 16:14:12.729538804 +0100 -+++ binutils-2.30/gold/testsuite/Makefile.in 2018-06-01 10:15:13.070965094 +0100 -@@ -166,7 +166,6 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E - @GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/weak_undef_lib.so \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ libweak_undef_2.a - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_5 = icf_virtual_function_folding_test \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ large_symbol_alignment \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test basic_pic_test \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ eh_test - @GCC_FALSE@large_symbol_alignment_DEPENDENCIES = -@@ -220,7 +219,6 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E - @NATIVE_LINKER_FALSE@exception_test_DEPENDENCIES = - @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__append_14 = exception_static_test - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_15 = weak_test \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test_2 - @GCC_FALSE@weak_test_DEPENDENCIES = - @NATIVE_LINKER_FALSE@weak_test_DEPENDENCIES = -@@ -334,7 +332,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E - # Test difference between "*(a b)" and "*(a) *(b)" in input section spec. - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_39 = many_sections_test \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test initpri1 \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 initpri3a \ -+@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2 \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_none \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections \ -@@ -348,13 +346,9 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E - @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_12 protected_1 \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_2 relro_test \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_now_test relro_strip_test \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test script_test_1 \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_exec binary_test \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3 \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_phdrs_script_test \ -+@GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_script_test script_test_11 \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12 script_test_12i \ -+@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12 \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list_2 \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1 \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2 -@@ -813,15 +807,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E - - # Test the --incremental-unchanged flag with an archive library. - # The second link should not update the library. --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_82 = incremental_test_2 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_5 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_6 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1 \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test -+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_82 = - @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_83 = two_file_test_tmp_2.o \ - @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_tmp_3.o \ - @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4.base \ -@@ -1082,7 +1068,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest - @NATIVE_OR_CROSS_LINKER_TRUE@ leb128_unittest$(EXEEXT) \ - @NATIVE_OR_CROSS_LINKER_TRUE@ overflow_unittest$(EXEEXT) - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_2 = icf_virtual_function_folding_test$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ large_symbol_alignment$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ eh_test$(EXEEXT) -@@ -1127,7 +1112,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest - @GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_separate_shared_21_test$(EXEEXT) - @GCC_TRUE@@HAVE_STATIC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_11 = exception_static_test$(EXEEXT) - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_12 = weak_test$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_undef_test_2$(EXEEXT) - @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_13 = weak_undef_nonpic_test$(EXEEXT) - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_14 = \ -@@ -1164,7 +1148,6 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest - @GCC_TRUE@@NATIVE_LINKER_TRUE@ many_sections_r_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri1$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri2$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ initpri3a$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections_none$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_compress_debug_sections$(EXEEXT) \ -@@ -1186,17 +1169,9 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest - @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_now_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_strip_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_script_test$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms_exec$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_phdrs_script_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ tls_script_test$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_11$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12$(EXEEXT) \ --@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_12i$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ dynamic_list_2$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_1$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_test_2$(EXEEXT) -@@ -1263,14 +1238,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest - @GCC_TRUE@@NATIVE_LINKER_TRUE@ ehdr_start_test_3$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ ehdr_start_test_5$(EXEEXT) \ - @GCC_TRUE@@NATIVE_LINKER_TRUE@ pr20976$(EXEEXT) --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_40 = incremental_test_2$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_3$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_4$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_5$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_test_6$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_copy_test$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_common_test_1$(EXEEXT) \ --@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ incremental_comdat_test_1$(EXEEXT) \ -+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_40 = \ - @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_x86_64_bnd_test$(EXEEXT) - @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_41 = pr22266$(EXEEXT) - basic_pic_test_SOURCES = basic_pic_test.c ---- binutils.orig/ld/testsuite/ld-elf/pr22269-1.c 2018-05-31 16:14:12.648539694 +0100 -+++ binutils-2.30/ld/testsuite/ld-elf/pr22269-1.c 2018-06-01 10:55:24.284977908 +0100 -@@ -5,4 +5,5 @@ _start (void) - { - if (&foo) - return foo; -+ return 0; - } ---- binutils.orig/ld/testsuite/ld-scripts/cross3.t 2018-05-31 16:14:12.679539354 +0100 -+++ binutils-2.30/ld/testsuite/ld-scripts/cross3.t 2018-06-01 10:59:46.109996654 +0100 -@@ -6,5 +6,6 @@ SECTIONS - .nocrossrefs : { *(.nocrossrefs) } - .data : { *(.data) *(.data.*) *(.sdata) *(.opd) *(.toc) } - .bss : { *(.bss) *(COMMON) } -+ .got.plt : { *(.got) *(.plt) *(.got.plt) } - /DISCARD/ : { *(*) } - } ---- binutils.orig/ld/testsuite/ld-srec/srec.exp 2018-05-31 16:14:12.570540551 +0100 -+++ binutils-2.30/ld/testsuite/ld-srec/srec.exp 2018-06-01 11:01:15.443979458 +0100 -@@ -19,6 +19,14 @@ - # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - # MA 02110-1301, USA. - -+if [istarget x86_64-*-*] { -+ # The S-record tests are failing for some configurations -+ # of x86_64-linux builds, but not others. Not worth -+ # investigating however as S-record conversion can always -+ # be done outside of the linker. -+ return -+} -+ - # Get the offset from an S-record line to the start of the data. - - proc srec_off { l } { ---- binutils.orig/ld/testsuite/ld-x86-64/pr22001-1b.err 2018-05-31 16:14:12.621539991 +0100 -+++ binutils-2.30/ld/testsuite/ld-x86-64/pr22001-1b.err 2018-06-01 11:02:58.554805393 +0100 -@@ -1,2 +1,2 @@ --.*relocation R_X86_64_32S against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC -+.*relocation R_X86_64_(PC32|32S) against symbol `copy' can not be used when making a P(D|I)E object; recompile with -fPIC +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 13:40:26.911199033 +0000 +@@ -34,5 +34,6 @@ hook called: claim_file tmpdir/libtext.a + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. #... ---- binutils.orig/ld/testsuite/ld-x86-64/pr21997-1b.err 2018-05-31 16:14:12.620540002 +0100 -+++ binutils-2.30/ld/testsuite/ld-x86-64/pr21997-1b.err 2018-06-01 11:04:01.535088273 +0100 -@@ -1,2 +1,2 @@ --.*relocation R_X86_64_32S against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC -+.*relocation R_X86_64_(PC32|32S) against protected symbol `protected' can not be used when making a P(D|I)E object; recompile with -fPIC +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 13:33:21.976627309 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 13:47:04.060076132 +0000 +@@ -1,5 +1,5 @@ #... ---- binutils.orig/ld/testsuite/ld-x86-64/x86-64.exp 2018-05-31 16:14:12.617540035 +0100 -+++ binutils-2.30/ld/testsuite/ld-x86-64/x86-64.exp 2018-06-01 11:05:46.005912951 +0100 -@@ -1792,7 +1792,7 @@ if { [isnative] && [which $CC] != 0 } { - } - } - -- undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" -+ # undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" - undefined_weak "-fPIE" "" - undefined_weak "-fPIE" "-pie" - undefined_weak "-fPIE" "-Wl,-z,nodynamic-undefined-weak" ---- binutils.orig/ld/testsuite/ld-size/size-7a.c 2018-05-31 16:14:12.569540562 +0100 -+++ binutils-2.30/ld/testsuite/ld-size/size-7a.c 2018-06-01 11:06:44.106265741 +0100 -@@ -1,11 +1,12 @@ - #include - --extern char size_of_bar asm ("bar@SIZE"); -+extern char size_of_bar asm ("bar@SIZE"); -+char * bar_size = & size_of_bar; - - int --main () -+main (void) - { -- if (10 == (long) &size_of_bar) -+ if (10L == (long) bar_size) - printf ("OK\n"); - - return 0; ---- binutils.orig/ld/testsuite/ld-size/size-8a.c 2018-05-31 16:14:12.568540573 +0100 -+++ binutils-2.30/ld/testsuite/ld-size/size-8a.c 2018-06-01 11:07:54.926476839 +0100 -@@ -1,14 +1,15 @@ - #include - - extern __thread char bar[]; --extern char size_of_bar asm ("bar@SIZE"); --extern void set_bar (int, int); -+extern char size_of_bar asm ("bar@SIZE"); -+extern void set_bar (int, int); -+char * bar_size = & size_of_bar; - - int --main () -+main (void) - { - set_bar (1, 20); -- if (10 == (long) &size_of_bar && bar[1] == 20) -+ if (10L == (long) bar_size && bar[1] == 20) - printf ("OK\n"); - - return 0; ---- binutils.orig/ld/testsuite/ld-size/size-4b.c 2018-05-31 16:14:12.569540562 +0100 -+++ binutils-2.30/ld/testsuite/ld-size/size-4b.c 2018-06-01 11:09:00.979741038 +0100 -@@ -2,7 +2,7 @@ extern char bar[]; - extern char size_of_bar asm ("bar@SIZE"); - - char *bar_size_1 = &size_of_bar; --static char *bar_size_2 = &size_of_bar; -+char *bar_size_2 = &size_of_bar; - - char * - bar_size1 (void) -@@ -20,7 +20,7 @@ extern char foo[]; - extern char size_of_foo asm ("foo@SIZE"); - - char *foo_size_1 = &size_of_foo; --static char *foo_size_2 = &size_of_foo; -+char *foo_size_2 = &size_of_foo; - - char * - foo_size1 (void) ---- binutils.orig/ld/testsuite/ld-size/size-5b.c 2018-05-31 16:14:12.569540562 +0100 -+++ binutils-2.30/ld/testsuite/ld-size/size-5b.c 2018-06-01 11:09:42.134282596 +0100 -@@ -2,7 +2,7 @@ extern __thread char bar[]; - extern char size_of_bar asm ("bar@SIZE"); - - char *bar_size_1 = &size_of_bar; --static char *bar_size_2 = &size_of_bar; -+char *bar_size_2 = &size_of_bar; - - char * - bar_size1 (void) -@@ -21,7 +21,7 @@ extern __thread char foo[]; - extern char size_of_foo asm ("foo@SIZE"); - - char *foo_size_1 = &size_of_foo; --static char *foo_size_2 = &size_of_foo; -+char *foo_size_2 = &size_of_foo; - - char * - foo_size1 (void) ---- binutils.orig/ld/testsuite/ld-size/size-6a.c 2018-05-31 16:14:12.568540573 +0100 -+++ binutils-2.30/ld/testsuite/ld-size/size-6a.c 2018-06-01 11:11:42.478942015 +0100 -@@ -1,14 +1,15 @@ - #include - --extern char bar[]; --extern char size_of_bar asm ("bar@SIZE"); --extern void set_bar (int, int); -+extern char bar[]; -+extern char size_of_bar asm ("bar@SIZE"); -+extern void set_bar (int, int); -+char * bar_size = & size_of_bar; - - int --main () -+main (void) - { - set_bar (1, 20); -- if (10 == (long) &size_of_bar && bar[1] == 20) -+ if (10 == (long) bar_size && bar[1] == 20) - printf ("OK\n"); - - return 0; ---- binutils.orig/ld/testsuite/ld-s390/tlspic_64.dd 2018-05-31 16:14:12.579540452 +0100 -+++ binutils-2.30/ld/testsuite/ld-s390/tlspic_64.dd 2018-06-01 13:20:16.509595466 +0100 -@@ -78,7 +78,7 @@ Disassembly of section .text: - +[0-9a-f]+: 00 00 00 60 .long 0x00000060 - # function prolog - +[0-9a-f]+: b9 04 00 ef lgr %r14,%r15 -- +[0-9a-f]+: c0 c0 [0-9a-f ]+ larl %r12,[0-9a-f]+ <_GLOBAL_OFFSET_TABLE_> -+ +[0-9a-f]+: c0 c0 [0-9a-f ]+ larl %r12,[0-9a-f]+ <.*> - +[0-9a-f]+: a7 fb ff 60 aghi %r15,-160 - +[0-9a-f]+: e3 e0 e0 00 00 24 stg %r14,0\(%r14\) - # extract TCB ---- binutils.orig/ld/testsuite/ld-srec/srec.exp 2018-05-31 16:14:12.570540551 +0100 -+++ binutils-2.30/ld/testsuite/ld-srec/srec.exp 2018-06-01 13:24:35.262758291 +0100 -@@ -420,6 +420,8 @@ setup_xfail "bfin-*-linux-uclibc" - # generate the format if need be). - setup_xfail "tile*-*-*" - -+setup_xfail "s390*-*-*" -+ - run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o" - - # Now try linking a C++ program with global constructors and ---- binutils.orig/ld/testsuite/ld-elf/indirect.exp 2018-05-31 16:14:12.649539683 +0100 -+++ binutils-2.30/ld/testsuite/ld-elf/indirect.exp 2018-06-01 14:32:22.949232924 +0100 -@@ -156,12 +156,26 @@ set run_tests { - {"Run with libindirect4c.so 4" - "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" - {dummy.c} "indirect4d" "indirect4.out"} -- {"Run indirect5 1" -- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" -- {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"} -- {"Run indirect5 2" -- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" -- {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"} -+} -+ -+run_ld_link_exec_tests $run_tests -+ -+# The s390x system compiler miscompiles these tests. -+if { ! [istarget s390x-*-*] } { -+ -+ set run_tests { -+ {"Run indirect5 1" -+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" -+ {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"} -+ {"Run indirect5 2" -+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" -+ {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"} -+ } -+ -+ run_ld_link_exec_tests $run_tests -+} +-.*: symbol `func' definition: 0, visibility: 0, resolution: 2 ++.*: symbol `func' definition: 0, visibility: 0, resolution: . + .*: symbol `func1' definition: 0, visibility: 1, resolution: 3 + .*: symbol `func2' definition: 0, visibility: 2, resolution: 3 + .*: symbol `func3' definition: 0, visibility: 3, resolution: 3 +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-13.d 2019-02-15 13:41:30.189692800 +0000 +@@ -23,5 +23,3 @@ hook called: claim_file tmpdir/main.o \[ + hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... +-.*main.c.*: undefined reference to `\.?func' +-#... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-14.d binutils-2.32/ld/testsuite/ld-plugin/plugin-14.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-14.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-14.d 2019-02-15 13:42:03.598430960 +0000 +@@ -27,7 +27,6 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-15.d binutils-2.32/ld/testsuite/ld-plugin/plugin-15.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-15.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-15.d 2019-02-15 13:42:28.014239600 +0000 +@@ -28,7 +28,6 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-16.d binutils-2.32/ld/testsuite/ld-plugin/plugin-16.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-16.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-16.d 2019-02-15 13:43:21.309821910 +0000 +@@ -30,9 +30,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-17.d binutils-2.32/ld/testsuite/ld-plugin/plugin-17.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-17.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-17.d 2019-02-15 13:43:54.925558451 +0000 +@@ -31,7 +31,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-20.d binutils-2.32/ld/testsuite/ld-plugin/plugin-20.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-20.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-20.d 2019-02-15 13:49:20.091010016 +0000 +@@ -2,6 +2,5 @@ hook called: all symbols read. + Input: func.c \(tmpdir/libfunc.a\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-21.d binutils-2.32/ld/testsuite/ld-plugin/plugin-21.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-21.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-21.d 2019-02-15 13:49:34.506897033 +0000 +@@ -2,6 +2,5 @@ hook called: all symbols read. + Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-22.d binutils-2.32/ld/testsuite/ld-plugin/plugin-22.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-22.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-22.d 2019-02-15 13:50:00.409694022 +0000 +@@ -2,6 +2,5 @@ Claimed: tmpdir/libfunc.a \[@.* + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-23.d binutils-2.32/ld/testsuite/ld-plugin/plugin-23.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-23.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-23.d 2019-02-15 13:50:14.938580156 +0000 +@@ -2,6 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func. + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-24.d binutils-2.32/ld/testsuite/ld-plugin/plugin-24.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-24.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-24.d 2019-02-15 13:49:46.346804240 +0000 +@@ -2,4 +2,5 @@ hook called: all symbols read. + Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\) + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-25.d binutils-2.32/ld/testsuite/ld-plugin/plugin-25.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-25.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-25.d 2019-02-15 13:50:29.322467422 +0000 +@@ -2,4 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func. + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* ++#... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 13:45:05.343006557 +0000 +@@ -1 +1,3 @@ + .*: error: Error ++#... + -+set run_tests { - {"Run indirect6 1" - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"} -@@ -213,12 +227,15 @@ proc check_dynamic_syms { test } { - return 1 - } - --foreach t [list indirect5a indirect5b indirect6a indirect6b] { -- set testname [concat $t "dynsym"] -- if { [check_dynamic_syms tmpdir/$t] } { -- pass $testname -- } else { -- fail $testname -+# The s390x system compiler miscompiles indirect5 tests. -+if { ! [istarget s390x-*-*] } { -+ foreach t [list indirect5a indirect5b indirect6a indirect6b] { -+ set testname [concat $t "dynsym"] -+ if { [check_dynamic_syms tmpdir/$t] } { -+ pass $testname -+ } else { -+ fail $testname -+ } - } - } +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-29.d binutils-2.32/ld/testsuite/ld-plugin/plugin-29.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-29.d 2019-02-15 13:33:21.978627293 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-29.d 2019-02-15 13:45:22.764870016 +0000 +@@ -1 +1,2 @@ + .*: warning: Warning ++#... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-30.d binutils-2.32/ld/testsuite/ld-plugin/plugin-30.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-30.d 2019-02-15 13:33:21.976627309 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-30.d 2019-02-15 13:48:57.067190464 +0000 +@@ -24,3 +24,4 @@ hook called: claim_file tmpdir/main.o \[ + hook called: claim_file tmpdir/func.o \[@0/.* not claimed + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + hook called: claim_file tmpdir/libempty.a \[@.* not claimed ++#pass +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-6.d binutils-2.32/ld/testsuite/ld-plugin/plugin-6.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-6.d 2019-02-15 13:33:21.979627285 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-6.d 2019-02-15 13:37:14.672749977 +0000 +@@ -27,7 +27,6 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-7.d binutils-2.32/ld/testsuite/ld-plugin/plugin-7.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-7.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-7.d 2019-02-15 13:37:58.000400421 +0000 +@@ -28,7 +28,6 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 13:33:21.980627277 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 13:38:34.096109209 +0000 +@@ -32,7 +32,6 @@ hook called: claim_file tmpdir/text.o \[ + hook called: all symbols read. + Sym: '_?func' Resolution: LDPR_PREVAILING_DEF + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-.*: tmpdir/main.o: in function `main': +-.*main.c.*: undefined reference to `\.?func' ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-9.d binutils-2.32/ld/testsuite/ld-plugin/plugin-9.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-9.d 2019-02-15 13:33:21.977627301 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-9.d 2019-02-15 13:39:52.655475403 +0000 +@@ -31,7 +31,8 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/pr20070.d binutils-2.32/ld/testsuite/ld-plugin/pr20070.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/pr20070.d 2019-02-15 13:33:21.976627309 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/pr20070.d 2019-02-15 13:50:56.874251486 +0000 +@@ -5,5 +5,6 @@ Sym: 'weakdef' Resolution: LDPR_PREVAILI + Sym: 'undef' Resolution: LDPR_UNDEF + Sym: 'weakundef' Resolution: LDPR_UNDEF + Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp binutils-2.32/ld/testsuite/ld-srec/srec.exp +--- binutils-2.32.orig/ld/testsuite/ld-srec/srec.exp 2019-02-15 13:33:21.938627615 +0000 ++++ binutils-2.32/ld/testsuite/ld-srec/srec.exp 2019-02-15 13:53:58.744814006 +0000 +@@ -21,6 +21,8 @@ -@@ -229,13 +246,22 @@ if { ! [string match "" $exec_output] } - return - } + # Get the offset from an S-record line to the start of the data. ++return + -+# The s390x system compiler miscompiles these tests. -+if { ! [istarget s390x-*-*] } { -+ set pie_tests { -+ {"Run indirect5 3" -+ "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" "" -+ {indirect5a.c} "indirect5c" "indirect5.out" "-fPIE"} -+ {"Run indirect5 4" -+ "-pie -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" -+ {dummy.c} "indirect5d" "indirect5.out" "-fPIE"} -+ } -+ -+ run_ld_link_exec_tests $pie_tests -+} -+ - set pie_tests { -- {"Run indirect5 3" -- "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" "" -- {indirect5a.c} "indirect5c" "indirect5.out" "-fPIE"} -- {"Run indirect5 4" -- "-pie -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" -- {dummy.c} "indirect5d" "indirect5.out" "-fPIE"} - {"Run indirect6 3" - "-pie -Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect6a.c} "indirect6c" "indirect5.out" "-fPIE"} -@@ -246,11 +272,14 @@ set pie_tests { - - run_ld_link_exec_tests $pie_tests - --foreach t [list indirect5c indirect5d indirect6c indirect6d] { -- set testname [concat $t "dynsym"] -- if { [check_dynamic_syms tmpdir/$t] } { -- pass $testname + proc srec_off { l } { + if [string match "S1*" $l] { + return 8 +diff -rup binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp +--- binutils-2.32.orig/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:33:22.030626874 +0000 ++++ binutils-2.32/ld/testsuite/ld-x86-64/x86-64.exp 2019-02-15 13:57:34.295106041 +0000 +@@ -1275,25 +1275,6 @@ if { [isnative] && [which $CC] != 0 } { + "$NOPIE_CFLAGS" \ + ] \ + ] - } else { -- fail $testname -+# The s390x system compiler miscompiles indirect5 tests. -+if { ! [istarget s390x-*-*] } { -+ foreach t [list indirect5c indirect5d indirect6c indirect6d] { -+ set testname [concat $t "dynsym"] -+ if { [check_dynamic_syms tmpdir/$t] } { -+ pass $testname -+ } else { -+ fail $testname -+ } +- run_cc_link_tests [list \ +- [list \ +- "Build pr22001-1b" \ +- "$NOPIE_LDFLAGS -Wl,-z,nocopyreloc,--no-as-needed tmpdir/pr22001-1.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { pr22001-1c.c } \ +- {{error_output "pr22001-1b.err"}} \ +- "pr22001-1b" \ +- ] \ +- [list \ +- "Build pr21997-1b" \ +- "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr21997-1.so" \ +- "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \ +- { pr21997-1c.c } \ +- {{error_output "pr21997-1b.err"}} \ +- "pr21997-1b" \ +- ] \ +- ] } - } ---- binutils.orig/ld/testsuite/ld-elfvers/vers.exp 2018-05-31 16:14:12.572540529 +0100 -+++ binutils-2.30/ld/testsuite/ld-elfvers/vers.exp 2018-06-01 15:23:36.518815276 +0100 -@@ -938,6 +938,7 @@ if [string match "yes" $pic] then { - build_exec "vers23" vers23.c vers23 "-Wl,--no-as-needed tmpdir/vers23a.so tmpdir/vers23b.o tmpdir/vers23b.so" "" vers23.ver vers23.dsym "" - } - -+if {! [istarget ppc64*-*-*] } { - # Test .symver x,x@VERS.0 - set as_pic_flags "" - if [istarget sparc*-*-*] { -@@ -955,6 +956,7 @@ run_ld_link_tests [list "\"vers24c\" - \"-shared --version-script $srcdir/$subdir/vers24.map\" \"\" - \"$as_pic_flags $as_options\" {vers24c.c} { { readelf -Wrs vers24.rd } } - \"libvers24c.so\" \"-fpic\""] -+} - # Test versioned definition vs. normal definition in different files. - if [string match "yes" $pic] then { ---- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2018-05-31 16:14:12.573540519 +0100 -+++ binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp 2018-06-01 15:26:52.020691739 +0100 -@@ -284,11 +284,14 @@ if {! [check_osabi tmpdir/static_nonifun - # The linked ifunc using executables and the shared library containing - # ifunc should contain an IFUNC symbol. The non-ifunc using executable - # should not. + run_ld_link_exec_tests [list \ +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:10:59.038709514 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-10.d 2019-02-15 14:13:53.532300721 +0000 +@@ -32,7 +32,7 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-11.d binutils-2.32/ld/testsuite/ld-plugin/plugin-11.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-11.d 2019-02-15 14:10:59.041709490 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-11.d 2019-02-15 14:14:50.061844322 +0000 +@@ -35,8 +35,9 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 14:10:58.912710532 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-12.d 2019-02-15 14:13:18.464583848 +0000 +@@ -1,6 +1,6 @@ + #... +-.*: symbol `func' definition: 0, visibility: 0, resolution: . +-.*: symbol `func1' definition: 0, visibility: 1, resolution: 3 +-.*: symbol `func2' definition: 0, visibility: 2, resolution: 3 +-.*: symbol `func3' definition: 0, visibility: 3, resolution: 3 ++.*: symbol `_?func' definition: 0, visibility: 0, resolution: . ++.*: symbol `_?func1' definition: 0, visibility: 1, resolution: 3 ++.*: symbol `_?func2' definition: 0, visibility: 2, resolution: 3 ++.*: symbol `_?func3' definition: 0, visibility: 3, resolution: 3 + #pass +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:10:58.942710289 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-18.d 2019-02-15 14:15:20.030602369 +0000 +@@ -32,7 +32,8 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-19.d binutils-2.32/ld/testsuite/ld-plugin/plugin-19.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-19.d 2019-02-15 14:10:59.024709627 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-19.d 2019-02-15 14:15:54.926320633 +0000 +@@ -35,8 +35,9 @@ hook called: claim_file .*/ld/testsuite/ + hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY ++#... + hook called: cleanup. + #... +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 14:10:58.998709837 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-28.d 2019-02-15 14:12:19.856057024 +0000 +@@ -1,3 +1,2 @@ + .*: error: Error + #... - -+if { ![istarget "ppc*-*-*"] } { - if {[contains_ifunc_symbol tmpdir/libshared_ifunc.so] != 1} { - fail "Shared libraries containing ifunc does not contain an IFUNC symbol" - set fails [expr $fails + 1] - } -+} -+ -+if { ![istarget "ppc*-*-*"] } { - if {[contains_ifunc_symbol tmpdir/local_prog] != 1} { - fail "Local ifunc-using executable does not contain an IFUNC symbol" - set fails [expr $fails + 1] -@@ -297,6 +300,7 @@ if {[contains_ifunc_symbol tmpdir/static - fail "Static ifunc-using executable does not contain an IFUNC symbol" - set fails [expr $fails + 1] - } -+} - if {[contains_ifunc_symbol tmpdir/dynamic_prog] != 0} { - fail "Dynamic ifunc-using executable contains an IFUNC symbol" - set fails [expr $fails + 1] ---- binutils.orig/ld/testsuite/ld-plugin/plugin.exp 2018-05-31 16:14:12.580540442 +0100 -+++ binutils-2.30/ld/testsuite/ld-plugin/plugin.exp 2018-06-01 15:29:44.048823172 +0100 -@@ -293,12 +293,14 @@ if { !$can_compile || $failed_compile } - - run_ld_link_tests $plugin_tests - -+if { ! [istarget "ppc*-*-*"] } { - if { [is_elf_format] \ - && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \ - && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \ - && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } { - run_ld_link_tests $plugin_extra_elf_tests - } -+} - - if {![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] || \ - ![ar_simple_create $ar "" "tmpdir/libempty.a" ""]} { ---- binutils.orig/ld/testsuite/ld-elf/tls.exp 2018-07-09 09:49:50.488248175 +0100 -+++ binutils-2.30.90/ld/testsuite/ld-elf/tls.exp 2018-07-09 10:46:26.449688046 +0100 -@@ -39,7 +39,9 @@ if [istarget "sparc*-*-*"] { - append AFLAGS_PIC " -K PIC" - } - --run_ld_link_tests [list \ -+# The s390x system compiler miscompiles these tests. -+if { ! [istarget s390x-*-*] } { -+ run_ld_link_tests [list \ - [list \ - "Build pr22263-1" \ - "-pie -e _start -z text" \ -@@ -51,3 +53,4 @@ run_ld_link_tests [list \ - "-fPIE -O2" \ - ] \ - ] -+} +diff -rup binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d +--- binutils-2.32.orig/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 14:10:59.074709224 +0000 ++++ binutils-2.32/ld/testsuite/ld-plugin/plugin-8.d 2019-02-15 14:11:48.144313048 +0000 +@@ -30,7 +30,7 @@ hook called: claim_file tmpdir/func.o \[ + hook called: claim_file tmpdir/text.o \[@0/.* not claimed + #... + hook called: all symbols read. +-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF ++Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY + Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY + #... + hook called: cleanup. diff --git a/binutils-gas-build-notes.patch b/binutils-gas-build-notes.patch deleted file mode 100644 index 8c6fc9f..0000000 --- a/binutils-gas-build-notes.patch +++ /dev/null @@ -1,555 +0,0 @@ -diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c ---- binutils.orig/binutils/readelf.c 2018-04-26 15:14:17.220464639 +0100 -+++ binutils-2.30/binutils/readelf.c 2018-04-26 15:14:31.927287474 +0100 -@@ -12294,7 +12294,8 @@ is_32bit_abs_reloc (Filedata * filedata, - case EM_OR1K: - return reloc_type == 1; /* R_OR1K_32. */ - case EM_PARISC: -- return (reloc_type == 1 /* R_PARISC_DIR32. */ -+ return (reloc_type == 1 /* R_PARISC_DIR32. */ -+ || reloc_type == 2 /* R_PARISC_DIR21L. */ - || reloc_type == 41); /* R_PARISC_SECREL32. */ - case EM_PJ: - case EM_PJ_OLD: -Only in binutils-2.30/binutils: readelf.c.orig -diff -rup binutils.orig/binutils/testsuite/binutils-all/objcopy.exp binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp ---- binutils.orig/binutils/testsuite/binutils-all/objcopy.exp 2018-04-26 15:14:17.215464699 +0100 -+++ binutils-2.30/binutils/testsuite/binutils-all/objcopy.exp 2018-04-26 15:14:31.927287474 +0100 -@@ -1062,6 +1062,7 @@ if [is_elf_format] { - run_dump_test "note-3-32" - run_dump_test "note-4-32" - } -+ run_dump_test "note-5" - } - - run_dump_test "copy-2" -Only in binutils-2.30/binutils/testsuite/binutils-all: objcopy.exp.orig -diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c ---- binutils.orig/gas/as.c 2018-04-26 15:14:17.646459507 +0100 -+++ binutils-2.30/gas/as.c 2018-04-26 15:14:31.927287474 +0100 -@@ -97,6 +97,7 @@ int verbose = 0; - - #if defined OBJ_ELF || defined OBJ_MAYBE_ELF - int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON; -+bfd_boolean flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES; - #endif - - /* Keep the output file. */ -@@ -304,8 +305,19 @@ Options:\n\ - generate ELF common symbols with STT_COMMON type\n")); - fprintf (stream, _("\ - --sectname-subst enable section name substitution sequences\n")); -+ -+ fprintf (stream, _("\ -+ --generate-missing-build-notes=[no|yes] ")); -+#if DEFAULT_GENERATE_BUILD_NOTES -+ fprintf (stream, _("(default: yes)\n")); -+#else -+ fprintf (stream, _("(default: no)\n")); - #endif - fprintf (stream, _("\ -+ generate GNU Build notes if none are present in the input\n")); -+#endif /* OBJ_ELF */ -+ -+ fprintf (stream, _("\ - -f skip whitespace and comment preprocessing\n")); - fprintf (stream, _("\ - -g --gen-debug generate debugging information\n")); -@@ -470,6 +482,7 @@ parse_args (int * pargc, char *** pargv) - OPTION_NOEXECSTACK, - OPTION_SIZE_CHECK, - OPTION_ELF_STT_COMMON, -+ OPTION_ELF_BUILD_NOTES, - OPTION_SECTNAME_SUBST, - OPTION_ALTERNATE, - OPTION_AL, -@@ -508,6 +521,7 @@ parse_args (int * pargc, char *** pargv) - ,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK} - ,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON} - ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST} -+ ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES} - #endif - ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} - ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2} -@@ -900,7 +914,19 @@ This program has absolutely no warranty. - case OPTION_SECTNAME_SUBST: - flag_sectname_subst = 1; - break; --#endif -+ -+ case OPTION_ELF_BUILD_NOTES: -+ if (strcasecmp (optarg, "no") == 0) -+ flag_generate_build_notes = FALSE; -+ else if (strcasecmp (optarg, "yes") == 0) -+ flag_generate_build_notes = TRUE; -+ else -+ as_fatal (_("Invalid --generate-missing-build-notes option: `%s'"), -+ optarg); -+ break; -+ -+#endif /* OBJ_ELF */ -+ - case 'Z': - flag_always_generate_output = 1; - break; -diff -rup binutils.orig/gas/as.h binutils-2.30/gas/as.h ---- binutils.orig/gas/as.h 2018-04-26 15:14:17.654459410 +0100 -+++ binutils-2.30/gas/as.h 2018-04-26 15:14:31.927287474 +0100 -@@ -585,6 +585,10 @@ COMMON int flag_allow_nonconst_size; - /* If we should generate ELF common symbols with the STT_COMMON type. */ - extern int flag_use_elf_stt_common; - -+/* TRUE iff GNU Build attribute notes should -+ be generated if none are in the input files. */ -+extern bfd_boolean flag_generate_build_notes; -+ - /* If section name substitution sequences should be honored */ - COMMON int flag_sectname_subst; - #endif -Only in binutils-2.30/gas: as.h.orig -diff -rup binutils.orig/gas/config.in binutils-2.30/gas/config.in ---- binutils.orig/gas/config.in 2018-04-26 15:14:17.645459519 +0100 -+++ binutils-2.30/gas/config.in 2018-04-26 15:14:31.927287474 +0100 -@@ -39,6 +39,10 @@ - /* Define if you want compressed debug sections by default. */ - #undef DEFAULT_FLAG_COMPRESS_DEBUG - -+/* Define to 1 if you want to generate GNU Build attribute notes by default, -+ if none are contained in the input. */ -+#undef DEFAULT_GENERATE_BUILD_NOTES -+ - /* Define to 1 if you want to generate ELF common symbols with the STT_COMMON - type by default. */ - #undef DEFAULT_GENERATE_ELF_STT_COMMON -diff -rup binutils.orig/gas/configure binutils-2.30/gas/configure ---- binutils.orig/gas/configure 2018-04-26 15:14:17.645459519 +0100 -+++ binutils-2.30/gas/configure 2018-04-26 15:14:31.928287462 +0100 -@@ -771,6 +771,7 @@ enable_checking - enable_compressed_debug_sections - enable_x86_relax_relocations - enable_elf_stt_common -+enable_generate_build_notes - enable_werror - enable_build_warnings - with_cpu -@@ -1426,6 +1427,9 @@ Optional Features: - generate x86 relax relocations by default - --enable-elf-stt-common generate ELF common symbols with STT_COMMON type by - default -+ --enable-generate-build-notes -+ generate GNU Build notes if none are provided by the -+ input - --enable-werror treat compile warnings as errors - --enable-build-warnings enable build-time compiler warnings - --disable-nls do not use Native Language Support -@@ -11011,7 +11015,7 @@ else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 10990 "configure" -+#line 10994 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11117,7 +11121,7 @@ else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF --#line 11096 "configure" -+#line 11100 "configure" - #include "confdefs.h" - - #if HAVE_DLFCN_H -@@ -11771,6 +11775,20 @@ if test "${enable_elf_stt_common+set}" = - esac - fi - -+ -+# Decide if the ELF assembler should default to generating -+# GNU Build notes if none are provided by the input. -+ac_default_generate_build_notes=0 -+# Provide a configuration option to override the default. -+# Check whether --enable-generate_build_notes was given. -+if test "${enable_generate_build_notes+set}" = set; then : -+ enableval=$enable_generate_build_notes; case "${enableval}" in -+ yes) ac_default_generate_build_notes=1 ;; -+ no) ac_default_generate_build_notes=0 ;; -+esac -+fi -+ -+ - using_cgen=no - - -@@ -12713,6 +12731,12 @@ cat >>confdefs.h <<_ACEOF - _ACEOF - - -+ -+cat >>confdefs.h <<_ACEOF -+#define DEFAULT_GENERATE_BUILD_NOTES $ac_default_generate_build_notes -+_ACEOF -+ -+ - if test x$ac_default_compressed_debug_sections = xyes ; then - - $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h -diff -rup binutils.orig/gas/configure.ac binutils-2.30/gas/configure.ac ---- binutils.orig/gas/configure.ac 2018-04-26 15:14:17.645459519 +0100 -+++ binutils-2.30/gas/configure.ac 2018-04-26 15:14:31.928287462 +0100 -@@ -100,6 +100,20 @@ AC_ARG_ENABLE(elf_stt_common, - yes) ac_default_elf_stt_common=1 ;; - esac])dnl - -+ -+# Decide if the ELF assembler should default to generating -+# GNU Build notes if none are provided by the input. -+ac_default_generate_build_notes=0 -+# Provide a configuration option to override the default. -+AC_ARG_ENABLE(generate_build_notes, -+ AS_HELP_STRING([--enable-generate-build-notes], -+ [generate GNU Build notes if none are provided by the input]), -+[case "${enableval}" in -+ yes) ac_default_generate_build_notes=1 ;; -+ no) ac_default_generate_build_notes=0 ;; -+esac])dnl -+ -+ - using_cgen=no - - AM_BINUTILS_WARNINGS -@@ -610,6 +624,11 @@ AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_ELF_ - [Define to 1 if you want to generate ELF common symbols with the - STT_COMMON type by default.]) - -+AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_BUILD_NOTES, -+ $ac_default_generate_build_notes, -+ [Define to 1 if you want to generate GNU Build attribute notes -+ by default, if none are contained in the input.]) -+ - if test x$ac_default_compressed_debug_sections = xyes ; then - AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.]) - fi -Only in binutils-2.30/gas: configure.ac.orig -Only in binutils-2.30/gas: configure.orig -diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo ---- binutils.orig/gas/doc/as.texinfo 2018-04-26 15:14:17.665459278 +0100 -+++ binutils-2.30/gas/doc/as.texinfo 2018-04-26 15:14:31.929287450 +0100 -@@ -244,6 +244,7 @@ gcc(1), ld(1), and the Info entries for - [@b{-Z}] [@b{@@@var{FILE}}] - [@b{--sectname-subst}] [@b{--size-check=[error|warning]}] - [@b{--elf-stt-common=[no|yes]}] -+ [@b{--generate-missing-build-notes=[no|yes]}] - [@b{--target-help}] [@var{target-options}] - [@b{--}|@var{files} @dots{}] - @c -@@ -754,6 +755,14 @@ Issue an error or warning for invalid EL - These options control whether the ELF assembler should generate common - symbols with the @code{STT_COMMON} type. The default can be controlled - by a configure option @option{--enable-elf-stt-common}. -+ -+@item --generate-missing-build-notes=yes -+@itemx --generate-missing-build-notes=no -+These options control whether the ELF assembler should generate GNU Build -+attribute notes if none are present in the input sources. -+The default can be controlled by the @option{--enable-generate-build-notes} -+configure option. -+ - @end ifset - - @item --help -Only in binutils-2.30/gas/doc: as.texinfo.orig -diff -rup binutils.orig/gas/NEWS binutils-2.30/gas/NEWS ---- binutils.orig/gas/NEWS 2018-04-26 15:14:17.646459507 +0100 -+++ binutils-2.30/gas/NEWS 2018-04-26 15:15:32.276560482 +0100 -@@ -1,5 +1,11 @@ - -*- text -*- - -+* Add --generate-missing-build-notes=[yes|no] option to create (or not) GNU -+ Build Attribute notes if none are present in the input sources. Add a -+ --enable-generate-build-notes=[yes|no] configure time option to set the -+ default behaviour. Set the default if the configure option is not used -+ to "no". -+ - Changes in 2.30: - - * Add support for loaction views in DWARF debug line information. -Only in binutils-2.30/gas: NEWS.orig -Only in binutils-2.30/gas: NEWS.rej -diff -rup binutils.orig/gas/symbols.c binutils-2.30/gas/symbols.c ---- binutils.orig/gas/symbols.c 2018-04-26 15:14:17.667459254 +0100 -+++ binutils-2.30/gas/symbols.c 2018-04-26 15:14:31.929287450 +0100 -@@ -108,6 +108,7 @@ save_symbol_name (const char *name) - size_t name_length; - char *ret; - -+ gas_assert (name != NULL); - name_length = strlen (name) + 1; /* +1 for \0. */ - obstack_grow (¬es, name, name_length); - ret = (char *) obstack_finish (¬es); -diff -rup binutils.orig/gas/write.c binutils-2.30/gas/write.c ---- binutils.orig/gas/write.c 2018-04-26 15:14:18.296451677 +0100 -+++ binutils-2.30/gas/write.c 2018-04-26 15:14:31.929287450 +0100 -@@ -1822,25 +1822,200 @@ create_obj_attrs_section (void) - const char *name; - - size = bfd_elf_obj_attr_size (stdoutput); -- if (size) -+ if (size == 0) -+ return; -+ -+ name = get_elf_backend_data (stdoutput)->obj_attrs_section; -+ if (!name) -+ name = ".gnu.attributes"; -+ s = subseg_new (name, 0); -+ elf_section_type (s) -+ = get_elf_backend_data (stdoutput)->obj_attrs_section_type; -+ bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA); -+ frag_now_fix (); -+ p = frag_more (size); -+ bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); -+ -+ subsegs_finish_section (s); -+ relax_segment (seg_info (s)->frchainP->frch_root, s, 0); -+ size_seg (stdoutput, s, NULL); -+} -+ -+#include "struc-symbol.h" -+ -+/* Create a relocation against an entry in a GNU Build attribute section. */ -+ -+static void -+create_note_reloc (segT sec, -+ symbolS * sym, -+ bfd_size_type offset, -+ int reloc_type, -+ bfd_vma addend, -+ char * note) -+{ -+ struct reloc_list * reloc; -+ -+ reloc = XNEW (struct reloc_list); -+ -+ /* We create a .b type reloc as resolve_reloc_expr_symbols() has already been called. */ -+ reloc->u.b.sec = sec; -+ reloc->u.b.s = sym->bsym; -+ reloc->u.b.r.sym_ptr_ptr = & reloc->u.b.s; -+ reloc->u.b.r.address = offset; -+ reloc->u.b.r.addend = addend; -+ reloc->u.b.r.howto = bfd_reloc_type_lookup (stdoutput, reloc_type); -+ -+ if (reloc->u.b.r.howto == NULL) - { -- name = get_elf_backend_data (stdoutput)->obj_attrs_section; -- if (!name) -- name = ".gnu.attributes"; -- s = subseg_new (name, 0); -- elf_section_type (s) -- = get_elf_backend_data (stdoutput)->obj_attrs_section_type; -- bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA); -- frag_now_fix (); -- p = frag_more (size); -- bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); -- -- subsegs_finish_section (s); -- relax_segment (seg_info (s)->frchainP->frch_root, s, 0); -- size_seg (stdoutput, s, NULL); -+ as_bad (_("unable to create reloc for build note")); -+ return; -+ } -+ -+ reloc->file = N_(""); -+ reloc->line = 0; -+ -+ reloc->next = reloc_list; -+ reloc_list = reloc; -+ -+ /* For REL relocs, store the addend in the section. */ -+ if (! sec->use_rela_p -+ /* The SH target is a special case that uses RELA relocs -+ but still stores the addend in the word being relocated. */ -+ || strstr (bfd_get_target (stdoutput), "-sh") != NULL) -+ { -+ if (target_big_endian) -+ { -+ if (bfd_arch_bits_per_address (stdoutput) <= 32) -+ note[offset + 3] = addend; -+ else -+ note[offset + 7] = addend; -+ } -+ else -+ note[offset] = addend; - } - } --#endif -+ -+static void -+maybe_generate_build_notes (void) -+{ -+ segT sec; -+ char * note; -+ offsetT note_size; -+ offsetT desc_size; -+ offsetT desc2_offset; -+ int desc_reloc; -+ symbolS * sym; -+ -+ if (! flag_generate_build_notes -+ || bfd_get_section_by_name (stdoutput, -+ GNU_BUILD_ATTRS_SECTION_NAME) != NULL) -+ return; -+ -+ /* Create a GNU Build Attribute section. */ -+ sec = subseg_new (GNU_BUILD_ATTRS_SECTION_NAME, FALSE); -+ elf_section_type (sec) = SHT_NOTE; -+ bfd_set_section_flags (stdoutput, sec, -+ SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); -+ bfd_set_section_alignment (stdoutput, sec, 2); -+ -+ /* Create a version note. */ -+ if (bfd_arch_bits_per_address (stdoutput) <= 32) -+ { -+ note_size = 28; -+ desc_size = 8; /* Two 4-byte offsets. */ -+ desc2_offset = 24; -+ -+ /* FIXME: The BFD backend for the CRX target does not support the -+ BFD_RELOC_32, even though it really should. Likewise for the -+ CR16 target. So we have special case code here... */ -+ if (strstr (bfd_get_target (stdoutput), "-crx") != NULL) -+ desc_reloc = BFD_RELOC_CRX_NUM32; -+ else if (strstr (bfd_get_target (stdoutput), "-cr16") != NULL) -+ desc_reloc = BFD_RELOC_CR16_NUM32; -+ else -+ desc_reloc = BFD_RELOC_32; -+ } -+ else -+ { -+ note_size = 36; -+ desc_size = 16; /* Two 8-byte offsets. */ -+ desc2_offset = 28; -+ /* FIXME: The BFD backend for the IA64 target does not support the -+ BFD_RELOC_64, even though it really should. The HPPA backend -+ has a similar issue, although it does not support BFD_RELOCs at -+ all! So we have special case code to handle these targets. */ -+ if (strstr (bfd_get_target (stdoutput), "-ia64") != NULL) -+ desc_reloc = target_big_endian ? BFD_RELOC_IA64_DIR32MSB : BFD_RELOC_IA64_DIR32LSB; -+ else if (strstr (bfd_get_target (stdoutput), "-hppa") != NULL) -+ desc_reloc = 80; /* R_PARISC_DIR64. */ -+ else -+ desc_reloc = BFD_RELOC_64; -+ } -+ -+ frag_now_fix (); -+ note = frag_more (note_size); -+ memset (note, 0, note_size); -+ -+ if (target_big_endian) -+ { -+ note[3] = 8; /* strlen (name) + 1. */ -+ note[7] = desc_size; /* Two 8-byte offsets. */ -+ note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -+ note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; -+ } -+ else -+ { -+ note[0] = 8; /* strlen (name) + 1. */ -+ note[4] = desc_size; /* Two 8-byte offsets. */ -+ note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; -+ note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -+ } -+ -+ /* The a1 version number indicates that this note was -+ generated by the assembler and not the gcc annobin plugin. */ -+ memcpy (note + 12, "GA$3a1", 8); -+ -+ /* Find the first code section symbol. */ -+ for (sym = symbol_rootP; sym != NULL; sym = sym->sy_next) -+ if (sym->bsym != NULL -+ && sym->bsym->flags & BSF_SECTION_SYM -+ && sym->bsym->section != NULL -+ && sym->bsym->section->flags & SEC_CODE) -+ { -+ /* Found one - now create a relocation against this symbol. */ -+ create_note_reloc (sec, sym, 20, desc_reloc, 0, note); -+ break; -+ } -+ -+ /* Find the last code section symbol. */ -+ if (sym) -+ { -+ for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous) -+ if (sym->bsym != NULL -+ && sym->bsym->flags & BSF_SECTION_SYM -+ && sym->bsym->section != NULL -+ && sym->bsym->section->flags & SEC_CODE) -+ { -+ /* Create a relocation against the end of this symbol. */ -+ create_note_reloc (sec, sym, desc2_offset, desc_reloc, -+ bfd_get_section_size (sym->bsym->section), -+ note); -+ break; -+ } -+ } -+ /* else - if we were unable to find any code section symbols then -+ probably there is no code in the output. So leaving the start -+ and end values as zero in the note is OK. */ -+ -+ /* FIXME: Maybe add a note recording the assembler command line and version ? */ -+ -+ /* Install the note(s) into the section. */ -+ bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, note_size); -+ subsegs_finish_section (sec); -+ relax_segment (seg_info (sec)->frchainP->frch_root, sec, 0); -+ size_seg (stdoutput, sec, NULL); -+} -+#endif /* OBJ_ELF */ - - /* Write the object file. */ - -@@ -2052,6 +2227,11 @@ write_object_file (void) - resolve_local_symbol_values (); - resolve_reloc_expr_symbols (); - -+#ifdef OBJ_ELF -+ if (IS_ELF) -+ maybe_generate_build_notes (); -+#endif -+ - PROGRESS (1); - - #ifdef tc_frob_file_before_adjust -Only in binutils-2.30/gas: write.c.orig -Only in binutils-2.30: testsuite ---- /dev/null 2018-04-26 08:07:19.307057583 +0100 -+++ binutils-2.30/binutils/testsuite/binutils-all/note-5.d 2018-04-26 15:17:06.318427614 +0100 -@@ -0,0 +1,11 @@ -+#PROG: objcopy -+#as: --generate-missing-build-notes=yes -+#readelf: --notes --wide -+#name: assembler generated build notes -+#source: note-5.s -+ -+#... -+Displaying notes found in: .gnu.build.attributes -+[ ]+Owner[ ]+Data size[ ]+Description -+[ ]+GA\$3a1[ ]+0x000000(08|10)[ ]+OPEN[ ]+Applies to region from 0 to 0x.. \(note_5.s\) -+#... ---- /dev/null 2018-04-26 08:07:19.307057583 +0100 -+++ binutils-2.30/binutils/testsuite/binutils-all/note-5.s 2018-04-26 15:17:06.318427614 +0100 -@@ -0,0 +1,14 @@ -+ .text -+ .global note_5.s -+note_5.s: -+ .dc.l 2 -+ .dc.l 4 -+ .dc.l 6 -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 8 -+ .dc.l 8 -+ -\ No newline at end of file diff --git a/binutils-gas-input-matches-output.patch b/binutils-gas-input-matches-output.patch deleted file mode 100644 index 76eab57..0000000 --- a/binutils-gas-input-matches-output.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- binutils.orig/gas/as.c 2019-01-30 11:02:04.055574300 +0000 -+++ binutils-2.31.1/gas/as.c 2019-01-30 11:03:12.212050935 +0000 -@@ -1254,14 +1254,27 @@ main (int argc, char ** argv) - { - struct stat sib; - -- if (stat (argv[i], &sib) == 0) -+ /* Check that the input file and output file are different. */ -+ if (stat (argv[i], &sib) == 0 -+ && sib.st_ino == sob.st_ino -+ /* POSIX emulating systems may support stat() but if the -+ underlying file system does not support a file serial number -+ of some kind then they will return 0 for the inode. So -+ two files with an inode of 0 may not actually be the same. -+ On real POSIX systems no ordinary file will ever have an -+ inode of 0. */ -+ && sib.st_ino != 0 -+ /* Different files may have the same inode number if they -+ reside on different devices, so check the st_dev field as -+ well. */ -+ && sib.st_dev == sob.st_dev) - { -- if (sib.st_ino == sob.st_ino && sib.st_ino != 0) -- { -- /* Don't let as_fatal remove the output file! */ -- out_file_name = NULL; -- as_fatal (_("The input and output files must be distinct")); -- } -+ const char *saved_out_file_name = out_file_name; -+ -+ /* Don't let as_fatal remove the output file! */ -+ out_file_name = NULL; -+ as_fatal (_("The input '%s' and output '%s' files are the same"), -+ argv[i], saved_out_file_name); - } - } - } diff --git a/binutils-gold-discard-version-info.patch b/binutils-gold-discard-version-info.patch deleted file mode 100644 index 2279021..0000000 --- a/binutils-gold-discard-version-info.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff -rup binutils.orig/gold/options.h binutils-2.31.1/gold/options.h ---- binutils.orig/gold/options.h 2018-11-28 13:43:45.192094029 +0000 -+++ binutils-2.31.1/gold/options.h 2018-11-28 13:44:30.616758345 +0000 -@@ -1358,6 +1358,10 @@ class General_options - N_("Warn about duplicate common symbols"), - N_("Do not warn about duplicate common symbols")); - -+ DEFINE_bool(warn_drop_version, options::TWO_DASHES, '\0', false, -+ N_("Warn when discarding version information"), -+ N_("Do not warn when discarding version information")); -+ - DEFINE_bool_ignore(warn_constructors, options::TWO_DASHES, '\0', - N_("Ignored"), N_("Ignored")); - -diff -rup binutils.orig/gold/symtab.cc binutils-2.31.1/gold/symtab.cc ---- binutils.orig/gold/symtab.cc 2018-11-28 13:43:45.193094021 +0000 -+++ binutils-2.31.1/gold/symtab.cc 2018-11-28 13:45:13.479441595 +0000 -@@ -2623,11 +2623,12 @@ Symbol_table::set_dynsym_indexes(unsigne - versions->record_version(this, dynpool, sym); - else - { -- gold_warning(_("discarding version information for " -- "%s@%s, defined in unused shared library %s " -- "(linked with --as-needed)"), -- sym->name(), sym->version(), -- sym->object()->name().c_str()); -+ if (parameters->options().warn_drop_version()) -+ gold_warning(_("discarding version information for " -+ "%s@%s, defined in unused shared library %s " -+ "(linked with --as-needed)"), -+ sym->name(), sym->version(), -+ sym->object()->name().c_str()); - sym->clear_version(); - } - } diff --git a/binutils-gold-llvm-plugin.patch b/binutils-gold-llvm-plugin.patch deleted file mode 100644 index d6d3a7e..0000000 --- a/binutils-gold-llvm-plugin.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- binutils.orig/gold/resolve.cc 2018-03-22 16:52:11.746513638 +0000 -+++ binutils-2.30/gold/resolve.cc 2018-03-22 16:53:58.038192419 +0000 -@@ -265,10 +265,13 @@ Symbol_table::resolve(Sized_symbol - return; - - // Likewise for an absolute symbol defined twice with the same value. -+ // Plugin-symbols are always absolute with same value here, so ignore those. - if (!is_ordinary - && st_shndx == elfcpp::SHN_ABS - && !to_is_ordinary - && to_shndx == elfcpp::SHN_ABS -+ && object->pluginobj() == NULL -+ && to->object()->pluginobj() == NULL - && to->value() == sym.get_st_value()) - return; - diff --git a/binutils-ifunc-relocs-in-notes.patch b/binutils-ifunc-relocs-in-notes.patch deleted file mode 100644 index c31ef9f..0000000 --- a/binutils-ifunc-relocs-in-notes.patch +++ /dev/null @@ -1,296 +0,0 @@ -diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c ---- binutils.orig/bfd/elf32-i386.c 2018-03-09 14:43:05.324208873 +0000 -+++ binutils-2.30/bfd/elf32-i386.c 2018-03-09 14:43:23.158000456 +0000 -@@ -2202,12 +2202,19 @@ elf_i386_relocate_section (bfd *output_b - - if ((input_section->flags & SEC_ALLOC) == 0) - { -+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat -+ STT_GNU_IFUNC symbol as STT_FUNC. */ -+ if (elf_section_type (input_section) == SHT_NOTE) -+ goto skip_ifunc; - /* Dynamic relocs are not propagated for SEC_DEBUGGING - sections because such sections are not SEC_ALLOC and - thus ld.so will not process them. */ - if ((input_section->flags & SEC_DEBUGGING) != 0) - continue; -- abort (); -+ _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"), -+ input_bfd, input_section); -+ bfd_set_error (bfd_error_invalid_operation); -+ return FALSE; - } - - /* STT_GNU_IFUNC symbol must go through PLT. */ -@@ -2421,6 +2428,7 @@ do_ifunc_pointer: - } - } - -+ skip_ifunc: - resolved_to_zero = (eh != NULL - && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh)); - -diff -rup binutils.orig/bfd/elf32-s390.c binutils-2.30/bfd/elf32-s390.c ---- binutils.orig/bfd/elf32-s390.c 2018-03-09 14:43:05.325208861 +0000 -+++ binutils-2.30/bfd/elf32-s390.c 2018-03-09 14:43:31.353904647 +0000 -@@ -2601,6 +2601,9 @@ elf_s390_relocate_section (bfd *output_b - case R_390_8: - case R_390_16: - case R_390_32: -+ if ((input_section->flags & SEC_ALLOC) == 0) -+ break; -+ - if (h != NULL - && s390_is_ifunc_symbol_p (h) - && h->def_regular) -@@ -2662,9 +2665,6 @@ elf_s390_relocate_section (bfd *output_b - } - } - -- if ((input_section->flags & SEC_ALLOC) == 0) -- break; -- - if ((bfd_link_pic (info) - && (h == NULL - || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -Only in binutils-2.30/bfd: elf32-s390.c.orig -diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c ---- binutils.orig/bfd/elf64-s390.c 2018-03-09 14:43:05.341208674 +0000 -+++ binutils-2.30/bfd/elf64-s390.c 2018-03-09 14:43:31.354904635 +0000 -@@ -2559,6 +2559,9 @@ elf_s390_relocate_section (bfd *output_b - case R_390_32: - case R_390_64: - -+ if ((input_section->flags & SEC_ALLOC) == 0) -+ break; -+ - if (h != NULL - && s390_is_ifunc_symbol_p (h) - && h->def_regular) -@@ -2621,9 +2624,6 @@ elf_s390_relocate_section (bfd *output_b - } - } - -- if ((input_section->flags & SEC_ALLOC) == 0) -- break; -- - if ((bfd_link_pic (info) - && (h == NULL - || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT -Only in binutils-2.30/bfd: elf64-s390.c.orig -diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c ---- binutils.orig/bfd/elf64-x86-64.c 2018-03-09 14:43:05.344208639 +0000 -+++ binutils-2.30/bfd/elf64-x86-64.c 2018-03-09 14:43:23.161000420 +0000 -@@ -2499,12 +2499,19 @@ elf_x86_64_relocate_section (bfd *output - - if ((input_section->flags & SEC_ALLOC) == 0) - { -+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat -+ STT_GNU_IFUNC symbol as STT_FUNC. */ -+ if (elf_section_type (input_section) == SHT_NOTE) -+ goto skip_ifunc; - /* Dynamic relocs are not propagated for SEC_DEBUGGING - sections because such sections are not SEC_ALLOC and - thus ld.so will not process them. */ - if ((input_section->flags & SEC_DEBUGGING) != 0) - continue; -- abort (); -+ _bfd_error_handler (_("%B: error: relocation againt ifunc symbol in non-alloc section %A"), -+ input_bfd, input_section); -+ bfd_set_error (bfd_error_invalid_operation); -+ return FALSE; - } - - switch (r_type) -@@ -2722,6 +2729,7 @@ do_ifunc_pointer: - } - } - -+ skip_ifunc: - resolved_to_zero = (eh != NULL - && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh)); - -diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c ---- binutils.orig/bfd/elfnn-aarch64.c 2018-03-09 14:43:05.337208721 +0000 -+++ binutils-2.30/bfd/elfnn-aarch64.c 2018-03-09 14:43:31.355904624 +0000 -@@ -4987,6 +4987,11 @@ elfNN_aarch64_final_link_relocate (reloc - - if ((input_section->flags & SEC_ALLOC) == 0) - { -+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat -+ STT_GNU_IFUNC symbol as STT_FUNC. */ -+ if (elf_section_type (input_section) == SHT_NOTE) -+ goto skip_ifunc; -+ - /* Dynamic relocs are not propagated for SEC_DEBUGGING - sections because such sections are not SEC_ALLOC and - thus ld.so will not process them. */ -@@ -5180,6 +5185,7 @@ bad_ifunc_reloc: - } - } - -+ skip_ifunc: - resolved_to_zero = (h != NULL - && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)); - -Only in binutils-2.30/bfd: elfnn-aarch64.c.orig -diff -rup binutils.orig/bfd/elfxx-sparc.c binutils-2.30/bfd/elfxx-sparc.c ---- binutils.orig/bfd/elfxx-sparc.c 2018-03-09 14:43:05.333208768 +0000 -+++ binutils-2.30/bfd/elfxx-sparc.c 2018-03-09 14:43:31.355904624 +0000 -@@ -3026,7 +3026,13 @@ _bfd_sparc_elf_relocate_section (bfd *ou - - if ((input_section->flags & SEC_ALLOC) == 0 - || h->plt.offset == (bfd_vma) -1) -- abort (); -+ { -+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat -+ STT_GNU_IFUNC symbol as STT_FUNC. */ -+ if (elf_section_type (input_section) == SHT_NOTE) -+ goto skip_ifunc; -+ abort (); -+ } - - plt_sec = htab->elf.splt; - if (! plt_sec) -@@ -3130,6 +3136,7 @@ _bfd_sparc_elf_relocate_section (bfd *ou - } - } - -+ skip_ifunc: - eh = (struct _bfd_sparc_elf_link_hash_entry *) h; - resolved_to_zero = (eh != NULL - && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh)); -Only in binutils-2.30/bfd: elfxx-sparc.c.orig -diff -rup binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp ---- binutils.orig/ld/testsuite/ld-ifunc/ifunc.exp 2018-03-09 14:43:04.844214486 +0000 -+++ binutils-2.30/ld/testsuite/ld-ifunc/ifunc.exp 2018-03-09 14:43:31.355904624 +0000 -@@ -47,6 +47,9 @@ if ![check_shared_lib_support] { - return - } - -+# This test does not need a compiler... -+run_dump_test "ifuncmod5" -+ - # We need a working compiler. (Strictly speaking this is - # not true, we could use target specific assembler files). - if { [which $CC] == 0 } { -Only in binutils-2.30: testsuite ---- /dev/null 2018-03-09 07:59:09.608015200 +0000 -+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.s 2018-03-09 14:45:45.698334500 +0000 -@@ -0,0 +1,105 @@ -+ .file "ifuncmod5.c" -+ -+ .text -+ .type ifuncmod5.c, STT_NOTYPE -+ifuncmod5.c: -+ .size ifuncmod5.c, 0 -+ -+ .pushsection .gnu.build.attributes, "", %note -+ .balign 4 -+ .dc.l 8 -+ .dc.l 16 -+ .dc.l 0x100 -+ .asciz "GA$3p4" -+ .dc.a ifuncmod5.c -+ .dc.a ifuncmod5.c_end -+ .popsection -+ -+.Ltext0: -+#APP -+ .protected global -+ .type foo, %gnu_indirect_function -+ .type foo_hidden, %gnu_indirect_function -+ .type foo_protected, %gnu_indirect_function -+ .hidden foo_hidden -+ .protected foo_protected -+#NO_APP -+ .align 8 -+ .type one, %function -+one: -+ .dc.l 0 -+ .size one, .-one -+ .align 8 -+ -+.globl foo -+ .type foo, %function -+foo: -+ .dc.l 0 -+ .size foo, .-foo -+ -+ .pushsection .gnu.build.attributes -+ .dc.l 6 -+ .dc.l 16 -+ .dc.l 0x101 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 -+ .dc.b 0, 0 -+ .dc.a foo -+ .dc.a foo_end -+ .popsection -+ -+foo_end: -+ .align 8 -+.globl foo_hidden -+ .type foo_hidden, %function -+foo_hidden: -+ .dc.l 0 -+ .size foo_hidden, .-foo_hidden -+ -+ .pushsection .gnu.build.attributes -+ .dc.l 6 -+ .dc.l 16 -+ .dc.l 0x101 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 -+ .dc.b 0, 0 -+ .dc.a foo_hidden -+ .dc.a foo_hidden_end -+ .popsection -+ -+foo_hidden_end: -+ .align 8 -+ -+ .globl foo_protected -+ .type foo_protected, %function -+foo_protected: -+ .dc.l 0 -+ -+ .size foo_protected, .-foo_protected -+ -+ .pushsection .gnu.build.attributes -+ .dc.l 6 -+ .dc.l 16 -+ .dc.l 0x101 -+ .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0 -+ .dc.b 0, 0 -+ .dc.a foo_protected -+ .dc.a foo_protected_end -+ .popsection -+ -+foo_protected_end: -+ .globl global -+ -+ .data -+ .align 4 -+ .type global, %object -+ .size global, 4 -+global: -+ .long -1 -+ -+ .text -+ .Letext0: -+ -+ifuncmod5.c_end: -+ .type ifuncmod5.c_end, STT_NOTYPE -+ .size ifuncmod5.c_end, 0 -+ -+ ---- /dev/null 2018-03-09 07:59:09.608015200 +0000 -+++ binutils-2.30/ld/testsuite/ld-ifunc/ifuncmod5.d 2018-03-09 14:45:45.698334500 +0000 -@@ -0,0 +1,8 @@ -+# name: Reloc against IFUNC symbol in NOTE section -+# ld: -shared -+# nm: -p -+ -+# We do not actually care about the notes at the moment. -+# The purpose of this test is to make sure that the link completes successfully. -+#pass -+ diff --git a/binutils-linkonce-notes.patch b/binutils-linkonce-notes.patch deleted file mode 100644 index 3a01ec1..0000000 --- a/binutils-linkonce-notes.patch +++ /dev/null @@ -1,127 +0,0 @@ ---- binutils.orig/gas/write.c 2018-05-14 12:22:27.893671804 +0100 -+++ binutils-2.30/gas/write.c 2018-05-14 15:39:03.900509629 +0100 -@@ -1901,6 +1901,7 @@ maybe_generate_build_notes (void) - segT sec; - char * note; - offsetT note_size; -+ offsetT total_size; - offsetT desc_size; - offsetT desc2_offset; - int desc_reloc; -@@ -1918,7 +1919,8 @@ maybe_generate_build_notes (void) - SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); - bfd_set_section_alignment (stdoutput, sec, 2); - -- /* Create a version note. */ -+ /* Work out the size of the notes that we will create, -+ and the relocation we should use. */ - if (bfd_arch_bits_per_address (stdoutput) <= 32) - { - note_size = 28; -@@ -1952,65 +1954,59 @@ maybe_generate_build_notes (void) - desc_reloc = BFD_RELOC_64; - } - -- frag_now_fix (); -- note = frag_more (note_size); -- memset (note, 0, note_size); -+ /* We have to create a note for *each* code section. -+ Linker garbage collection might discard some. */ -+ total_size = 0; -+ note = NULL; - -- if (target_big_endian) -- { -- note[3] = 8; /* strlen (name) + 1. */ -- note[7] = desc_size; /* Two 8-byte offsets. */ -- note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -- note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; -- } -- else -- { -- note[0] = 8; /* strlen (name) + 1. */ -- note[4] = desc_size; /* Two 8-byte offsets. */ -- note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; -- note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -- } -- -- /* The a1 version number indicates that this note was -- generated by the assembler and not the gcc annobin plugin. */ -- memcpy (note + 12, "GA$3a1", 8); -- -- /* Find the first code section symbol. */ - for (sym = symbol_rootP; sym != NULL; sym = sym->sy_next) - if (sym->bsym != NULL - && sym->bsym->flags & BSF_SECTION_SYM - && sym->bsym->section != NULL -- && sym->bsym->section->flags & SEC_CODE) -+ /* Skip linkonce sections - we cannot these section symbols as they may disappear. */ -+ && (sym->bsym->section->flags & (SEC_CODE | SEC_LINK_ONCE)) == SEC_CODE -+ /* Not all linkonce sections are flagged... */ -+ && strncmp (S_GET_NAME (sym), ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) != 0) - { -- /* Found one - now create a relocation against this symbol. */ -- create_note_reloc (sec, sym, 20, desc_reloc, 0, note); -- break; -- } -+ /* Create a version note. */ -+ frag_now_fix (); -+ note = frag_more (note_size); -+ memset (note, 0, note_size); - -- /* Find the last code section symbol. */ -- if (sym) -- { -- for (sym = symbol_lastP; sym != NULL; sym = sym->sy_previous) -- if (sym->bsym != NULL -- && sym->bsym->flags & BSF_SECTION_SYM -- && sym->bsym->section != NULL -- && sym->bsym->section->flags & SEC_CODE) -+ if (target_big_endian) - { -- /* Create a relocation against the end of this symbol. */ -- create_note_reloc (sec, sym, desc2_offset, desc_reloc, -- bfd_get_section_size (sym->bsym->section), -- note); -- break; -+ note[3] = 8; /* strlen (name) + 1. */ -+ note[7] = desc_size; /* Two 8-byte offsets. */ -+ note[10] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -+ note[11] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; - } -- } -- /* else - if we were unable to find any code section symbols then -- probably there is no code in the output. So leaving the start -- and end values as zero in the note is OK. */ -+ else -+ { -+ note[0] = 8; /* strlen (name) + 1. */ -+ note[4] = desc_size; /* Two 8-byte offsets. */ -+ note[8] = NT_GNU_BUILD_ATTRIBUTE_OPEN & 0xff; -+ note[9] = NT_GNU_BUILD_ATTRIBUTE_OPEN >> 8; -+ } -+ -+ /* The a1 version number indicates that this note was -+ generated by the assembler and not the gcc annobin plugin. */ -+ memcpy (note + 12, "GA$3a1", 8); - -- /* FIXME: Maybe add a note recording the assembler command line and version ? */ -+ /* Create a relocation to install the start address of the note... */ -+ create_note_reloc (sec, sym, 20, desc_reloc, 0, note); -+ -+ /* ...and another one to install the end address. */ -+ create_note_reloc (sec, sym, desc2_offset, desc_reloc, -+ bfd_get_section_size (sym->bsym->section), -+ note); -+ -+ total_size += note_size; -+ /* FIXME: Maybe add a note recording the assembler command line and version ? */ -+ } - - /* Install the note(s) into the section. */ -- bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, note_size); -+ if (total_size) -+ bfd_set_section_contents (stdoutput, sec, (bfd_byte *) note, 0, total_size); - subsegs_finish_section (sec); - relax_segment (seg_info (sec)->frchainP->frch_root, sec, 0); - size_seg (stdoutput, sec, NULL); diff --git a/binutils-merge-attribute-sections.patch b/binutils-merge-attribute-sections.patch deleted file mode 100644 index 5dcd5e4..0000000 --- a/binutils-merge-attribute-sections.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -rup binutils.orig/gold/layout.cc binutils-2.31.1/gold/layout.cc ---- binutils.orig/gold/layout.cc 2018-07-27 11:49:15.188939352 +0100 -+++ binutils-2.31.1/gold/layout.cc 2018-07-27 11:50:03.984405949 +0100 -@@ -5429,6 +5429,7 @@ const Layout::Section_name_mapping Layou - MAPPING_INIT(".gnu.linkonce.armextab.", ".ARM.extab"), - MAPPING_INIT(".ARM.exidx", ".ARM.exidx"), - MAPPING_INIT(".gnu.linkonce.armexidx.", ".ARM.exidx"), -+ MAPPING_INIT(".gnu.build.attributes.", ".gnu.build.attributes"), - }; - - // Mapping for ".text" section prefixes with -z,keep-text-section-prefix. -diff -rup binutils.orig/ld/scripttempl/elf.sc binutils-2.31.1/ld/scripttempl/elf.sc ---- binutils.orig/ld/scripttempl/elf.sc 2018-07-30 10:48:58.409509857 +0100 -+++ binutils-2.31.1/ld/scripttempl/elf.sc 2018-07-30 10:49:09.267393364 +0100 -@@ -692,6 +692,8 @@ cat <bsym != NULL - && sym->bsym->flags & BSF_SECTION_SYM - && sym->bsym->section != NULL -- /* Skip linkonce sections - we cannot these section symbols as they may disappear. */ -+ /* Skip linkonce sections - we cannot use these section symbols as they may disappear. */ - && (sym->bsym->section->flags & (SEC_CODE | SEC_LINK_ONCE)) == SEC_CODE - /* Not all linkonce sections are flagged... */ - && strncmp (S_GET_NAME (sym), ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) != 0) -@@ -1993,10 +1993,10 @@ maybe_generate_build_notes (void) - memcpy (note + 12, "GA$3a1", 8); - - /* Create a relocation to install the start address of the note... */ -- create_note_reloc (sec, sym, 20, desc_reloc, 0, note); -+ create_note_reloc (sec, sym, total_size + 20, desc_reloc, 0, note); - - /* ...and another one to install the end address. */ -- create_note_reloc (sec, sym, desc2_offset, desc_reloc, -+ create_note_reloc (sec, sym, total_size + desc2_offset, desc_reloc, - bfd_get_section_size (sym->bsym->section), - note); - diff --git a/binutils-note-merge-improvements.patch b/binutils-note-merge-improvements.patch deleted file mode 100644 index 1acaee9..0000000 --- a/binutils-note-merge-improvements.patch +++ /dev/null @@ -1,62 +0,0 @@ ---- binutils.orig/binutils/objcopy.c 2018-08-06 09:11:02.053503486 +0100 -+++ binutils-2.30/binutils/objcopy.c 2018-08-06 09:11:23.296329566 +0100 -@@ -2174,7 +2174,7 @@ merge_gnu_build_notes (bfd * abfd, asect - 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 and whose address ranges coincide. -- IE - it there are gaps in the coverage of the notes, then these gaps -+ IE - if 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. -@@ -2182,16 +2182,48 @@ merge_gnu_build_notes (bfd * abfd, asect - its description field is empty then the nearest preceeding OPEN note - with a non-empty description field must also be preserved *OR* the - description field of the note must be changed to contain the starting -- address to which it refers. */ -+ address to which it refers. -+ 6. Notes with the same start and end address can be deleted. */ - for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++) - { - int note_type; - objcopy_internal_note * back; - objcopy_internal_note * prev_open_with_range = NULL; - -+ /* Rule 6 - delete 0-range notes. */ -+ if (pnote->start == pnote->end) -+ { -+ duplicate_found = TRUE; -+ pnote->note.type = 0; -+ continue; -+ } -+ - /* Rule 2 - preserve function notes. */ - if (! is_open_note (pnote)) -- continue; -+ { -+ int iter; -+ -+ /* Check to see if there is an identical previous function note. -+ This can happen with overlays for example. */ -+ for (iter = 0, back = pnote -1; back >= pnotes; back --) -+ { -+ if (back->start == pnote->start -+ && back->end == pnote->end -+ && back->note.namesz == pnote->note.namesz -+ && memcmp (back->note.namedata, pnote->note.namedata, pnote->note.namesz) == 0) -+ { -+ fprintf (stderr, "DUP FUNXC\n"); -+ duplicate_found = TRUE; -+ pnote->note.type = 0; -+ break; -+ } -+ -+ /* Don't scan too far back however. */ -+ if (iter ++ > 16) -+ break; -+ } -+ continue; -+ } - - note_type = pnote->note.namedata[attribute_type_byte]; - diff --git a/binutils-page-to-segment-assignment.patch b/binutils-page-to-segment-assignment.patch deleted file mode 100644 index c622d7c..0000000 --- a/binutils-page-to-segment-assignment.patch +++ /dev/null @@ -1,77 +0,0 @@ -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-local-ifunc-relocs.patch b/binutils-ppc64-local-ifunc-relocs.patch deleted file mode 100644 index b5637be..0000000 --- a/binutils-ppc64-local-ifunc-relocs.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- binutils.orig/bfd/elf64-ppc.c 2019-02-20 10:58:09.700552616 +0000 -+++ binutils-2.31.1/bfd/elf64-ppc.c 2019-02-20 10:59:15.989062349 +0000 -@@ -13530,7 +13530,8 @@ write_plt_relocs_for_local_syms (struct - } - - val = sym->st_value + ent->addend; -- val += PPC64_LOCAL_ENTRY_OFFSET (sym->st_other); -+ if (ELF_ST_TYPE (sym->st_info) != STT_GNU_IFUNC) -+ val += PPC64_LOCAL_ENTRY_OFFSET (sym->st_other); - if (sym_sec != NULL && sym_sec->output_section != NULL) - val += sym_sec->output_offset + sym_sec->output_section->vma; - diff --git a/binutils-revert-PowerPC-speculation-barriers.patch b/binutils-revert-PowerPC-speculation-barriers.patch deleted file mode 100644 index fe69cbf..0000000 --- a/binutils-revert-PowerPC-speculation-barriers.patch +++ /dev/null @@ -1,749 +0,0 @@ -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-s390-partial-relro.patch b/binutils-s390-partial-relro.patch deleted file mode 100644 index 83fd98a..0000000 --- a/binutils-s390-partial-relro.patch +++ /dev/null @@ -1,872 +0,0 @@ -diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.31.1/bfd/elf64-s390.c ---- binutils.orig/bfd/elf64-s390.c 2018-07-19 12:37:28.107030007 +0100 -+++ binutils-2.31.1/bfd/elf64-s390.c 2018-07-19 12:38:11.235548717 +0100 -@@ -481,7 +481,7 @@ elf_s390_is_local_label_name (bfd *abfd, - - #define RELA_ENTRY_SIZE sizeof (Elf64_External_Rela) - --/* The first three entries in a procedure linkage table are reserved, -+/* The first three entries in a global offset table are reserved, - and the initial contents are unimportant (we zero them out). - Subsequent entries look like this. See the SVR4 ABI 386 - supplement to see how this works. */ -@@ -511,8 +511,8 @@ elf_s390_is_local_label_name (bfd *abfd, - LG 1,0(1) # 6 bytes Load address from GOT in r1 - BCR 15,1 # 2 bytes Jump to address - RET1: BASR 1,0 # 2 bytes Return from GOT 1st time -- LGF 1,12(1) # 6 bytes Load offset in symbl table in r1 -- BRCL 15,-x # 6 bytes Jump to start of PLT -+ LGF 1,12(1) # 6 bytes Load rela.plt offset into r1 -+ BRCL 15,-x # 6 bytes Jump to first PLT entry - .long ? # 4 bytes offset into .rela.plt - - Total = 32 bytes per PLT entry -@@ -1605,8 +1605,7 @@ allocate_dynrelocs (struct elf_link_hash - /* Make room for this entry. */ - s->size += PLT_ENTRY_SIZE; - -- /* We also need to make an entry in the .got.plt section, which -- will be placed in the .got section by the linker script. */ -+ /* We also need to make an entry in the .got.plt section. */ - htab->elf.sgotplt->size += GOT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ -@@ -1831,6 +1830,20 @@ elf_s390_size_dynamic_sections (bfd *out - } - } - -+ if (htab->elf.sgot && s390_gotplt_after_got_p (info)) -+ { -+ /* _bfd_elf_create_got_section adds the got header size always -+ to .got.plt but we need it in .got if this section comes -+ first. */ -+ htab->elf.sgot->size += 3 * GOT_ENTRY_SIZE; -+ htab->elf.sgotplt->size -= 3 * GOT_ENTRY_SIZE; -+ -+ /* Make the _GLOBAL_OFFSET_TABLE_ symbol point to the .got -+ instead of .got.plt. */ -+ htab->elf.hgot->root.u.def.section = htab->elf.sgot; -+ htab->elf.hgot->root.u.def.value = 0; -+ } -+ - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) -@@ -2131,7 +2144,6 @@ elf_s390_relocate_section (bfd *output_b - bfd_boolean unresolved_reloc; - 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); -@@ -2172,7 +2184,7 @@ elf_s390_relocate_section (bfd *output_b - case R_390_PLTOFF16: - case R_390_PLTOFF32: - case R_390_PLTOFF64: -- relocation -= htab->elf.sgot->output_section->vma; -+ relocation -= s390_got_pointer (info); - break; - case R_390_GOTPLT12: - case R_390_GOTPLT16: -@@ -2192,10 +2204,10 @@ elf_s390_relocate_section (bfd *output_b - htab->elf.sgot->contents + - local_got_offsets[r_symndx]); - relocation = (local_got_offsets[r_symndx] + -- htab->elf.sgot->output_offset); -+ s390_got_offset (info)); - - if (r_type == R_390_GOTENT || r_type == R_390_GOTPLTENT) -- relocation += htab->elf.sgot->output_section->vma; -+ relocation += s390_got_pointer (info); - break; - } - default: -@@ -2254,25 +2266,23 @@ elf_s390_relocate_section (bfd *output_b - - if (s390_is_ifunc_symbol_p (h)) - { -+ /* Entry indices of .iplt and .igot.plt match -+ 1:1. No magic PLT first entry here. */ - plt_index = h->plt.offset / PLT_ENTRY_SIZE; -- relocation = (plt_index * GOT_ENTRY_SIZE + -- htab->elf.igotplt->output_offset); -- if (r_type == R_390_GOTPLTENT) -- relocation += htab->elf.igotplt->output_section->vma; -+ relocation = (plt_index * GOT_ENTRY_SIZE -+ + s390_gotplt_offset (info) -+ + htab->elf.igotplt->output_offset); - } - else - { -- /* Calc. index no. -- Current offset - size first entry / entry size. */ -- plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / -- PLT_ENTRY_SIZE; -- -- /* Offset in GOT is PLT index plus GOT headers(3) -- times 8, addr & GOT addr. */ -- relocation = (plt_index + 3) * GOT_ENTRY_SIZE; -- if (r_type == R_390_GOTPLTENT) -- relocation += htab->elf.sgot->output_section->vma; -+ plt_index = ((h->plt.offset - PLT_FIRST_ENTRY_SIZE) -+ / PLT_ENTRY_SIZE); -+ -+ relocation = (plt_index * GOT_ENTRY_SIZE -+ + s390_gotplt_offset (info)); - } -+ if (r_type == R_390_GOTPLTENT) -+ relocation += s390_got_pointer (info); - unresolved_reloc = FALSE; - break; - } -@@ -2286,7 +2296,7 @@ elf_s390_relocate_section (bfd *output_b - case R_390_GOTENT: - /* Relocation is to the entry for this symbol in the global - offset table. */ -- if (base_got == NULL) -+ if (htab->elf.sgot == NULL) - abort (); - - if (h != NULL) -@@ -2303,8 +2313,19 @@ elf_s390_relocate_section (bfd *output_b - { - /* No explicit GOT usage so redirect to the - got.iplt slot. */ -- base_got = htab->elf.igotplt; -- off = h->plt.offset / PLT_ENTRY_SIZE * GOT_ENTRY_SIZE; -+ relocation = (s390_gotplt_offset (info) -+ + htab->elf.igotplt->output_offset -+ + (h->plt.offset / PLT_ENTRY_SIZE -+ * GOT_ENTRY_SIZE)); -+ -+ /* For @GOTENT the relocation is against the offset between -+ the instruction and the symbols entry in the GOT and not -+ between the start of the GOT and the symbols entry. We -+ add the vma of the GOT to get the correct value. */ -+ if (r_type == R_390_GOTENT || r_type == R_390_GOTPLTENT) -+ relocation += s390_got_pointer (info); -+ -+ break; - } - else - { -@@ -2337,7 +2358,7 @@ elf_s390_relocate_section (bfd *output_b - else - { - bfd_put_64 (output_bfd, relocation, -- base_got->contents + off); -+ htab->elf.sgot->contents + off); - h->got.offset |= 1; - } - -@@ -2419,7 +2440,7 @@ elf_s390_relocate_section (bfd *output_b - if (off >= (bfd_vma) -2) - abort (); - -- relocation = base_got->output_offset + off; -+ relocation = s390_got_offset (info) + off; - - /* For @GOTENT the relocation is against the offset between - the instruction and the symbols entry in the GOT and not -@@ -2427,7 +2448,7 @@ elf_s390_relocate_section (bfd *output_b - add the vma of the GOT to get the correct value. */ - if ( r_type == R_390_GOTENT - || r_type == R_390_GOTPLTENT) -- relocation += base_got->output_section->vma; -+ relocation += s390_got_pointer (info); - - break; - -@@ -2445,22 +2466,17 @@ elf_s390_relocate_section (bfd *output_b - relocation = (htab->elf.iplt->output_section->vma - + htab->elf.iplt->output_offset - + h->plt.offset -- - htab->elf.sgot->output_section->vma); -+ - s390_got_pointer (info)); - goto do_relocation; - } - -- /* Note that sgot->output_offset is not involved in this -- calculation. We always want the start of .got. If we -- defined _GLOBAL_OFFSET_TABLE in a different way, as is -- permitted by the ABI, we might have to change this -- calculation. */ -- relocation -= htab->elf.sgot->output_section->vma; -+ relocation -= s390_got_pointer (info); - break; - - case R_390_GOTPC: - case R_390_GOTPCDBL: - /* Use global offset table as symbol value. */ -- relocation = htab->elf.sgot->output_section->vma; -+ relocation = s390_got_pointer (info); - unresolved_reloc = FALSE; - break; - -@@ -2509,7 +2525,7 @@ elf_s390_relocate_section (bfd *output_b - || h->plt.offset == (bfd_vma) -1 - || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h))) - { -- relocation -= htab->elf.sgot->output_section->vma; -+ relocation -= s390_got_pointer (info); - break; - } - -@@ -2517,12 +2533,12 @@ elf_s390_relocate_section (bfd *output_b - relocation = (htab->elf.iplt->output_section->vma - + htab->elf.iplt->output_offset - + h->plt.offset -- - htab->elf.sgot->output_section->vma); -+ - s390_got_pointer (info)); - else - relocation = (htab->elf.splt->output_section->vma - + htab->elf.splt->output_offset - + h->plt.offset -- - htab->elf.sgot->output_section->vma); -+ - s390_got_pointer (info)); - unresolved_reloc = FALSE; - break; - -@@ -3296,7 +3312,7 @@ elf_s390_finish_dynamic_symbol (bfd *out - if (h->plt.offset != (bfd_vma) -1) - { - bfd_vma plt_index; -- bfd_vma got_offset; -+ bfd_vma gotplt_offset; - Elf_Internal_Rela rela; - bfd_byte *loc; - -@@ -3325,18 +3341,25 @@ elf_s390_finish_dynamic_symbol (bfd *out - Current offset - size first entry / entry size. */ - plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE; - -- /* Offset in GOT is PLT index plus GOT headers(3) times 8, -- addr & GOT addr. */ -- got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; -+ /* The slots in the .got.plt correspond to the PLT slots in -+ the same order. */ -+ gotplt_offset = plt_index * GOT_ENTRY_SIZE; -+ -+ /* If .got.plt comes first it needs to contain the 3 header -+ entries. */ -+ if (!s390_gotplt_after_got_p (info)) -+ gotplt_offset += 3 * GOT_ENTRY_SIZE; - - /* Fill in the blueprint of a PLT. */ - memcpy (htab->elf.splt->contents + h->plt.offset, elf_s390x_plt_entry, - PLT_ENTRY_SIZE); - -- /* Fixup the relative address to the GOT entry */ -+ /* The first instruction in the PLT entry is a LARL loading -+ the address of the GOT slot. We write the 4 byte -+ immediate operand of the LARL instruction here. */ - bfd_put_32 (output_bfd, - (htab->elf.sgotplt->output_section->vma + -- htab->elf.sgotplt->output_offset + got_offset -+ htab->elf.sgotplt->output_offset + gotplt_offset - - (htab->elf.splt->output_section->vma + - htab->elf.splt->output_offset + - h->plt.offset))/2, -@@ -3356,12 +3379,12 @@ elf_s390_finish_dynamic_symbol (bfd *out - + htab->elf.splt->output_offset - + h->plt.offset - + 14), -- htab->elf.sgotplt->contents + got_offset); -+ htab->elf.sgotplt->contents + gotplt_offset); - - /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (htab->elf.sgotplt->output_section->vma - + htab->elf.sgotplt->output_offset -- + got_offset); -+ + gotplt_offset); - rela.r_info = ELF64_R_INFO (h->dynindx, R_390_JMP_SLOT); - rela.r_addend = 0; - loc = htab->elf.srelplt->contents + plt_index * -@@ -3568,8 +3591,8 @@ elf_s390_finish_dynamic_sections (bfd *o - continue; - - case DT_PLTGOT: -- s = htab->elf.sgotplt; -- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; -+ /* DT_PLTGOT matches _GLOBAL_OFFSET_TABLE_ */ -+ dyn.d_un.d_ptr = s390_got_pointer (info); - break; - - case DT_JMPREL: -@@ -3606,10 +3629,11 @@ elf_s390_finish_dynamic_sections (bfd *o - /* fill in blueprint for plt 0 entry */ - memcpy (htab->elf.splt->contents, elf_s390x_first_plt_entry, - PLT_FIRST_ENTRY_SIZE); -- /* Fixup relative address to start of GOT */ -+ /* The second instruction in the first PLT entry is a LARL -+ loading the GOT pointer. Fill in the LARL immediate -+ address. */ - bfd_put_32 (output_bfd, -- (htab->elf.sgotplt->output_section->vma -- + htab->elf.sgotplt->output_offset -+ (s390_got_pointer (info) - - htab->elf.splt->output_section->vma - - htab->elf.splt->output_offset - 6)/2, - htab->elf.splt->contents + 8); -@@ -3619,21 +3643,22 @@ elf_s390_finish_dynamic_sections (bfd *o - = PLT_ENTRY_SIZE; - } - -- if (htab->elf.sgotplt) -+ if (htab->elf.hgot && htab->elf.hgot->root.u.def.section) - { - /* Fill in the first three entries in the global offset table. */ -- if (htab->elf.sgotplt->size > 0) -+ if (htab->elf.hgot->root.u.def.section->size > 0) - { - bfd_put_64 (output_bfd, - (sdyn == NULL ? (bfd_vma) 0 - : sdyn->output_section->vma + sdyn->output_offset), -- htab->elf.sgotplt->contents); -+ htab->elf.hgot->root.u.def.section->contents); - /* One entry for shared object struct ptr. */ -- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 8); -+ bfd_put_64 (output_bfd, (bfd_vma) 0, -+ htab->elf.hgot->root.u.def.section->contents + 8); - /* One entry for _dl_runtime_resolve. */ -- bfd_put_64 (output_bfd, (bfd_vma) 0, htab->elf.sgotplt->contents + 16); -+ bfd_put_64 (output_bfd, (bfd_vma) 0, -+ htab->elf.hgot->root.u.def.section->contents + 16); - } -- - elf_section_data (htab->elf.sgot->output_section) - ->this_hdr.sh_entsize = 8; - } -diff -rup binutils.orig/bfd/elf-s390-common.c binutils-2.31.1/bfd/elf-s390-common.c ---- binutils.orig/bfd/elf-s390-common.c 2018-07-19 12:37:28.113029940 +0100 -+++ binutils-2.31.1/bfd/elf-s390-common.c 2018-07-19 12:38:11.235548717 +0100 -@@ -30,6 +30,87 @@ s390_is_ifunc_symbol_p (struct elf_link_ - return h->type == STT_GNU_IFUNC || eh->ifunc_resolver_address != 0; - } - -+/* Return true if .got.plt is supposed to be emitted after .got. */ -+ -+static inline bfd_boolean -+s390_gotplt_after_got_p (struct bfd_link_info *info) -+{ -+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info); -+ -+ if (!htab->elf.sgot || !htab->elf.sgotplt) -+ return TRUE; -+ -+ if (htab->elf.sgot->output_section == htab->elf.sgotplt->output_section) -+ { -+ if (htab->elf.sgot->output_offset < htab->elf.sgotplt->output_offset) -+ return TRUE; -+ } -+ else -+ { -+ if (htab->elf.sgot->output_section->vma -+ <= htab->elf.sgotplt->output_section->vma) -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+/* Return the value of the _GLOBAL_OFFSET_TABLE_ symbol. */ -+ -+static inline bfd_vma -+s390_got_pointer (struct bfd_link_info *info) -+{ -+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info); -+ bfd_vma got_pointer; -+ -+ BFD_ASSERT (htab && htab->elf.hgot); -+ -+ got_pointer = (htab->elf.hgot->root.u.def.section->output_section->vma -+ + htab->elf.hgot->root.u.def.section->output_offset); -+ /* Our ABI requires the GOT pointer to point at the very beginning -+ of the global offset table. */ -+ BFD_ASSERT (got_pointer -+ <= (htab->elf.sgot->output_section->vma -+ + htab->elf.sgot->output_offset)); -+ BFD_ASSERT (got_pointer -+ <= (htab->elf.sgotplt->output_section->vma -+ + htab->elf.sgotplt->output_offset)); -+ -+ return got_pointer; -+} -+ -+ -+/* Return the offset of the .got versus _GLOBAL_OFFSET_TABLE_. */ -+ -+static inline bfd_vma -+s390_got_offset (struct bfd_link_info *info) -+{ -+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info); -+ -+ /* The absolute address of the .got in the target image. */ -+ bfd_vma got_address = (htab->elf.sgot->output_section->vma -+ + htab->elf.sgot->output_offset); -+ -+ /* GOT offset must not be negative. */ -+ BFD_ASSERT (s390_got_pointer (info) <= got_address); -+ return got_address - s390_got_pointer (info); -+} -+ -+/* Return the offset of the .got.plt versus _GLOBAL_OFFSET_TABLE_. */ -+ -+static inline bfd_vma -+s390_gotplt_offset (struct bfd_link_info *info) -+{ -+ struct elf_s390_link_hash_table *htab = elf_s390_hash_table (info); -+ -+ /* The absolute address of the .got.plt in the target image. */ -+ bfd_vma gotplt_address = (htab->elf.sgotplt->output_section->vma -+ + htab->elf.sgotplt->output_offset); -+ -+ /* GOT offset must not be negative. */ -+ BFD_ASSERT (s390_got_pointer (info) <= gotplt_address); -+ return gotplt_address - s390_got_pointer (info); -+} -+ - /* Create sections needed by STT_GNU_IFUNC symbol. */ - - static bfd_boolean -diff -rup binutils.orig/ld/emulparams/elf64_s390.sh binutils-2.31.1/ld/emulparams/elf64_s390.sh ---- binutils.orig/ld/emulparams/elf64_s390.sh 2018-07-19 12:37:28.544025130 +0100 -+++ binutils-2.31.1/ld/emulparams/elf64_s390.sh 2018-07-19 12:38:11.235548717 +0100 -@@ -11,9 +11,12 @@ NOP=0x07070707 - TEMPLATE_NAME=elf32 - GENERATE_SHLIB_SCRIPT=yes - GENERATE_PIE_SCRIPT=yes -+GENERATE_RELRO_SCRIPT=yes - NO_SMALL_DATA=yes - EXTRA_EM_FILE=s390 - IREL_IN_PLT= -+SEPARATE_GOTPLT=0 -+test -z "$RELRO" && unset SEPARATE_GOTPLT - - # Treat a host that matches the target with the possible exception of "x" - # in the name as if it were native. -diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.31.1/ld/emultempl/elf32.em ---- binutils.orig/ld/emultempl/elf32.em 2018-07-19 12:37:28.549025074 +0100 -+++ binutils-2.31.1/ld/emultempl/elf32.em 2018-07-19 12:37:39.041907980 +0100 -@@ -2376,17 +2376,41 @@ echo ' && link_info.combrelo - echo ' && link_info.relro' >> e${EMULATION_NAME}.c - echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xdceo >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c - echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xdce >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xdco >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xdeo >> e${EMULATION_NAME}.c -+fi - fi - echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xde >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xdo >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_pie (&link_info)) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c - fi -@@ -2402,17 +2426,41 @@ echo ' && link_info.combrelo - echo ' && link_info.relro' >> e${EMULATION_NAME}.c - echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xsceo >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c - echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xsce >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xsco >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xseo >> e${EMULATION_NAME}.c -+fi - fi - echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c - echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xse >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xso >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (bfd_link_dll (&link_info)) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c - fi -@@ -2425,14 +2473,34 @@ echo ' ; else if (link_info.combreloc' - echo ' && link_info.relro' >> e${EMULATION_NAME}.c - echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xceo >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c - echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xce >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xco >> e${EMULATION_NAME}.c -+fi - echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c - fi --echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (link_info.separate_code' >> e${EMULATION_NAME}.c -+echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xeo >> e${EMULATION_NAME}.c -+fi -+echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.xe >> e${EMULATION_NAME}.c -+if test -n "$GENERATE_RELRO_SCRIPT" ; then -+echo ' ; else if (link_info.relro) return' >> e${EMULATION_NAME}.c -+sed $sc ldscripts/${EMULATION_NAME}.xo >> e${EMULATION_NAME}.c -+fi - echo ' ; else return' >> e${EMULATION_NAME}.c - sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c - echo '; }' >> e${EMULATION_NAME}.c -@@ -2471,6 +2539,21 @@ fragment < ldscripts/${EMULATION_NAME}.xe - -+if test -n "$GENERATE_RELRO_SCRIPT"; then -+ LD_FLAG= -+ RELRO=" " -+ ( echo "/* Script for -z relo: generate normal executables with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xo -+ LD_FLAG=textonly -+ ( echo "/* Script for -z separate-code -z relo: generate normal executables with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xeo -+ unset RELRO -+fi - LD_FLAG=n - DATA_ALIGNMENT=${DATA_ALIGNMENT_n} - ( echo "/* Script for -n: mix text and data on same page */" -@@ -353,6 +367,25 @@ if test -n "$GENERATE_COMBRELOC_SCRIPT"; - rm -f ${COMBRELOC} - COMBRELOC= - unset RELRO_NOW -+ if test -n "$GENERATE_RELRO_SCRIPT"; then -+ LD_FLAG=c -+ RELRO=" " -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xco.tmp -+ ( echo "/* Script for -z combreloc -z relro: combine and sort reloc sections */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xco -+ rm -f ${COMBRELOC} -+ LD_FLAG=ctextonly -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xceo.tmp -+ ( echo "/* Script for -z combreloc -z separate-code -z relro: combine and sort reloc sections */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xceo -+ rm -f ${COMBRELOC} -+ COMBRELOC= -+ unset RELRO -+ fi - fi - - if test -n "$GENERATE_SHLIB_SCRIPT"; then -@@ -370,6 +403,23 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; the - . ${CUSTOMIZER_SCRIPT} - . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc - ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xse -+ -+ if test -n "$GENERATE_RELRO_SCRIPT"; then -+ RELRO=" " -+ LD_FLAG=shared -+ ( -+ echo "/* Script for ld --shared -z relro: link shared library */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xso -+ LD_FLAG=sharedtextonly -+ ( -+ echo "/* Script for ld --shared -z relro -z separate-code: link shared library with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xseo -+ unset RELRO -+ fi - if test -n "$GENERATE_COMBRELOC_SCRIPT"; then - DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}} - LD_FLAG=cshared -@@ -401,8 +451,27 @@ if test -n "$GENERATE_SHLIB_SCRIPT"; the - . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc - ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xswe - rm -f ${COMBRELOC} -- COMBRELOC= - unset RELRO_NOW -+ -+ if test -n "$GENERATE_RELRO_SCRIPT"; then -+ LD_FLAG=wshared -+ RELRO=" " -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xsco.tmp -+ ( echo "/* Script for --shared -z combreloc -z relro: shared library, combine & sort relocs with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsco -+ rm -f ${COMBRELOC} -+ LD_FLAG=wsharedtextonly -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xsceo.tmp -+ ( echo "/* Script for --shared -z combreloc -z relro -z separate-code: shared library, combine & sort relocs with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xsceo -+ rm -f ${COMBRELOC} -+ unset RELRO -+ fi -+ COMBRELOC= - fi - unset CREATE_SHLIB - fi -@@ -422,6 +491,22 @@ if test -n "$GENERATE_PIE_SCRIPT"; then - . ${CUSTOMIZER_SCRIPT} - . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc - ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xde -+ if test -n "$GENERATE_RELRO_SCRIPT"; then -+ RELRO=" " -+ LD_FLAG=pie -+ ( -+ echo "/* Script for ld -pie -z relro: link position independent executable */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdo -+ LD_FLAG=pietextonly -+ ( -+ echo "/* Script for ld -pie -z relro -z separate-code: link position independent executable with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdeo -+ unset RELRO -+ fi - if test -n "$GENERATE_COMBRELOC_SCRIPT"; then - DATA_ALIGNMENT=${DATA_ALIGNMENT_sc-${DATA_ALIGNMENT}} - COMBRELOC=ldscripts/${EMULATION_NAME}.xdc.tmp -@@ -453,8 +538,28 @@ if test -n "$GENERATE_PIE_SCRIPT"; then - . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc - ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdwe - rm -f ${COMBRELOC} -- COMBRELOC= - unset RELRO_NOW -+ -+ if test -n "$GENERATE_RELRO_SCRIPT"; then -+ LD_FLAG=wpie -+ RELRO=" " -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdco.tmp -+ ( echo "/* Script for -pie -z combreloc -z relro: position independent executable, combine & sort relocs with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdco -+ rm -f ${COMBRELOC} -+ LD_FLAG=wpietextonly -+ COMBRELOC=ldscripts/${EMULATION_NAME}.xdceo.tmp -+ ( echo "/* Script for -pie -z combreloc -z relro -z separate-code: position independent executable, combine & sort relocs with separate code segment */" -+ . ${CUSTOMIZER_SCRIPT} -+ . ${srcdir}/scripttempl/${SCRIPT_NAME}.sc -+ ) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xdceo -+ rm -f ${COMBRELOC} -+ -+ unset RELRO -+ fi -+ COMBRELOC= - fi - unset CREATE_PIE - fi -Only in binutils.orig/ld/testsuite/ld-s390: gotreloc_64-1.dd -Only in binutils-2.31.1/ld/testsuite/ld-s390: gotreloc_64-norelro-1.dd -Only in binutils-2.31.1/ld/testsuite/ld-s390: gotreloc_64-relro-1.dd -diff -rup binutils.orig/ld/testsuite/ld-s390/s390.exp binutils-2.31.1/ld/testsuite/ld-s390/s390.exp ---- binutils.orig/ld/testsuite/ld-s390/s390.exp 2018-07-19 12:37:28.498025644 +0100 -+++ binutils-2.31.1/ld/testsuite/ld-s390/s390.exp 2018-07-19 12:38:11.236548705 +0100 -@@ -70,10 +70,15 @@ set s390xtests { - {{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd} - {objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}} - "tlsbin_64"} -- {"GOT: symbol address load from got to larl" -- "-shared -melf64_s390 --hash-style=sysv --version-script=gotreloc-1.ver" "" -+ {"GOT: norelro symbol address load from got to larl" -+ "-shared -melf64_s390 -z norelro --hash-style=sysv --version-script=gotreloc-1.ver" "" - "-m64" {gotreloc-1.s} -- {{objdump -dzrj.text gotreloc_64-1.dd}} -+ {{objdump -dzrj.text gotreloc_64-norelro-1.dd}} -+ "gotreloc_64-1"} -+ {"GOT: relro symbol address load from got to larl" -+ "-shared -melf64_s390 -z relro --hash-style=sysv --version-script=gotreloc-1.ver" "" -+ "-m64" {gotreloc-1.s} -+ {{objdump -dzrj.text gotreloc_64-relro-1.dd}} - "gotreloc_64-1"} - {"PLT: offset test" - "-shared -m elf64_s390 -dT pltoffset-1.ld" "" diff --git a/binutils-skip-dwo-search-if-not-needed.patch b/binutils-skip-dwo-search-if-not-needed.patch deleted file mode 100644 index 4369b78..0000000 --- a/binutils-skip-dwo-search-if-not-needed.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- 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-speed-up-objdump.patch b/binutils-speed-up-objdump.patch deleted file mode 100644 index fe92635..0000000 --- a/binutils-speed-up-objdump.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- binutils.orig/binutils/objdump.c 2018-03-05 17:04:19.901619738 +0000 -+++ binutils-2.29/binutils/objdump.c 2018-03-05 17:10:08.334643096 +0000 -@@ -664,9 +664,7 @@ slurp_dynamic_symtab (bfd *abfd) - static bfd_boolean - is_significant_symbol_name (const char * name) - { -- return strcmp (name, ".plt") == 0 -- || strcmp (name, ".got") == 0 -- || strcmp (name, ".plt.got") == 0; -+ return strncmp (name, ".plt", 4) == 0 || strcmp (name, ".got") == 0; - } - - /* Filter out (in place) symbols that are useless for disassembly. -@@ -937,6 +935,7 @@ find_symbol_for_address (bfd_vma vma, - asection *sec; - unsigned int opb; - bfd_boolean want_section; -+ long rel_count; - - if (sorted_symcount < 1) - return NULL; -@@ -1065,33 +1064,59 @@ find_symbol_for_address (bfd_vma vma, - and we have dynamic relocations available, then we can produce - a better result by matching a relocation to the address and - using the symbol associated with that relocation. */ -+ rel_count = aux->dynrelcount; - if (!want_section -- && aux->dynrelbuf != NULL - && sorted_syms[thisplace]->value != vma -+ && rel_count > 0 -+ && aux->dynrelbuf != NULL -+ && aux->dynrelbuf[0]->address <= vma -+ && aux->dynrelbuf[rel_count - 1]->address >= vma - /* If we have matched a synthetic symbol, then stick with that. */ - && (sorted_syms[thisplace]->flags & BSF_SYNTHETIC) == 0) - { -- long rel_count; -- arelent ** rel_pp; -+ arelent ** rel_low; -+ arelent ** rel_high; - -- for (rel_count = aux->dynrelcount, rel_pp = aux->dynrelbuf; -- rel_count--;) -+ rel_low = aux->dynrelbuf; -+ rel_high = rel_low + rel_count - 1; -+ while (rel_low <= rel_high) - { -- arelent * rel = rel_pp[rel_count]; -+ arelent ** rel_mid = &rel_low[(rel_high - rel_low) / 2]; -+ arelent * rel = *rel_mid; - -- if (rel->address == vma -- && rel->sym_ptr_ptr != NULL -- /* Absolute relocations do not provide a more helpful symbolic address. */ -- && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section)) -+ if (rel->address == vma) - { -- if (place != NULL) -- * place = thisplace; -- return * rel->sym_ptr_ptr; -+ /* Absolute relocations do not provide a more helpful -+ symbolic address. Find a non-absolute relocation -+ with the same address. */ -+ -+ arelent **rel_vma = rel_mid; -+ -+ for (rel_mid--; -+ rel_mid >= rel_low && rel_mid[0]->address == vma; -+ rel_mid--) -+ rel_vma = rel_mid; -+ -+ for (; rel_vma <= rel_high && rel_vma[0]->address == vma; -+ rel_vma++) -+ { -+ rel = *rel_vma; -+ if (rel->sym_ptr_ptr != NULL -+ && ! bfd_is_abs_section ((* rel->sym_ptr_ptr)->section)) -+ { -+ if (place != NULL) -+ * place = thisplace; -+ return * rel->sym_ptr_ptr; -+ } -+ } -+ break; - } - -- /* We are scanning backwards, so if we go below the target address -- we have failed. */ -- if (rel_pp[rel_count]->address < vma) -+ if (vma < rel->address) -+ rel_high = rel_mid; -+ else if (vma >= rel_mid[1]->address) -+ rel_low = rel_mid + 1; -+ else - break; - } - } diff --git a/binutils-strip-unknown-relocs.patch b/binutils-strip-unknown-relocs.patch deleted file mode 100644 index d8ecd84..0000000 --- a/binutils-strip-unknown-relocs.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff -rup binutils.orig/bfd/elf32-i386.c binutils-2.30/bfd/elf32-i386.c ---- binutils.orig/bfd/elf32-i386.c 2018-02-27 17:25:53.961140597 +0000 -+++ binutils-2.30/bfd/elf32-i386.c 2018-02-27 17:27:14.115133477 +0000 -@@ -383,7 +383,7 @@ elf_i386_rtype_to_howto (bfd *abfd, unsi - /* xgettext:c-format */ - _bfd_error_handler (_("%B: invalid relocation type %d"), - abfd, (int) r_type); -- indx = R_386_NONE; -+ return NULL; - } - /* PR 17512: file: 0f67f69d. */ - if (elf_howto_table [indx].type != r_type) -diff -rup binutils.orig/bfd/elf64-ppc.c binutils-2.30/bfd/elf64-ppc.c ---- binutils.orig/bfd/elf64-ppc.c 2018-02-27 17:25:53.969140496 +0000 -+++ binutils-2.30/bfd/elf64-ppc.c 2018-02-27 17:27:56.213604518 +0000 -@@ -2516,9 +2516,10 @@ ppc64_elf_info_to_howto (bfd *abfd, arel - /* xgettext:c-format */ - _bfd_error_handler (_("%B: invalid relocation type %d"), - abfd, (int) type); -- type = R_PPC64_NONE; -+ cache_ptr->howto = NULL; - } -- cache_ptr->howto = ppc64_elf_howto_table[type]; -+ else -+ cache_ptr->howto = ppc64_elf_howto_table[type]; - } - - /* Handle the R_PPC64_ADDR16_HA and similar relocs. */ -diff -rup binutils.orig/bfd/elf64-s390.c binutils-2.30/bfd/elf64-s390.c ---- binutils.orig/bfd/elf64-s390.c 2018-02-27 17:25:53.968140509 +0000 -+++ binutils-2.30/bfd/elf64-s390.c 2018-02-27 17:28:24.632247443 +0000 -@@ -372,9 +372,10 @@ elf_s390_info_to_howto (bfd *abfd ATTRIB - /* xgettext:c-format */ - _bfd_error_handler (_("%B: invalid relocation type %d"), - abfd, (int) r_type); -- r_type = R_390_NONE; -+ cache_ptr->howto = NULL; - } -- cache_ptr->howto = &elf_howto_table[r_type]; -+ else -+ cache_ptr->howto = &elf_howto_table[r_type]; - } - } - -diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c ---- binutils.orig/bfd/elf64-x86-64.c 2018-02-27 17:25:53.964140559 +0000 -+++ binutils-2.30/bfd/elf64-x86-64.c 2018-02-27 17:29:12.554645307 +0000 -@@ -284,7 +284,7 @@ elf_x86_64_rtype_to_howto (bfd *abfd, un - /* xgettext:c-format */ - _bfd_error_handler (_("%B: invalid relocation type %d"), - abfd, (int) r_type); -- r_type = R_X86_64_NONE; -+ return NULL; - } - i = r_type; - } -@@ -347,8 +347,6 @@ elf_x86_64_info_to_howto (bfd *abfd ATTR - && r_type != (unsigned int) R_X86_64_GNU_VTENTRY) - r_type &= ~R_X86_64_converted_reloc_bit; - cache_ptr->howto = elf_x86_64_rtype_to_howto (abfd, r_type); -- -- BFD_ASSERT (r_type == cache_ptr->howto->type || cache_ptr->howto->type == R_X86_64_NONE); - } - - /* Support for core dump NOTE sections. */ -diff -rup binutils.orig/bfd/elfcode.h binutils-2.30/bfd/elfcode.h ---- binutils.orig/bfd/elfcode.h 2018-02-27 17:25:53.964140559 +0000 -+++ binutils-2.30/bfd/elfcode.h 2018-02-27 17:26:57.234345581 +0000 -@@ -1474,6 +1474,12 @@ elf_slurp_reloc_table_from_section (bfd - (*ebd->elf_info_to_howto) (abfd, relent, &rela); - else - (*ebd->elf_info_to_howto_rel) (abfd, relent, &rela); -+ -+ if (relent->howto == NULL) -+ { -+ bfd_set_error (bfd_error_bad_value); -+ goto error_return; -+ } - } - - if (allocated != NULL) -diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c ---- binutils.orig/binutils/objcopy.c 2018-02-27 17:25:53.185150347 +0000 -+++ binutils-2.30/binutils/objcopy.c 2018-02-27 17:30:05.806976202 +0000 -@@ -3022,10 +3022,19 @@ copy_object (bfd *ibfd, bfd *obfd, const - haven't been set yet. mark_symbols_used_in_relocations will - ignore input sections which have no corresponding output - section. */ -+ bfd_set_error (bfd_error_no_error); - if (strip_symbols != STRIP_ALL) -- bfd_map_over_sections (ibfd, -- mark_symbols_used_in_relocations, -- isympp); -+ { -+ bfd_map_over_sections (ibfd, -+ mark_symbols_used_in_relocations, -+ isympp); -+ if (bfd_get_error () != bfd_error_no_error) -+ { -+ status = 1; -+ return FALSE; -+ } -+ } -+ - osympp = (asymbol **) xmalloc ((symcount + add_symbols + 1) * sizeof (asymbol *)); - symcount = filter_symbols (ibfd, obfd, osympp, isympp, symcount); - } diff --git a/binutils-x86-local-relocs.patch b/binutils-x86-local-relocs.patch deleted file mode 100644 index ffc74ee..0000000 --- a/binutils-x86-local-relocs.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- binutils.orig/bfd/elfxx-x86.c 2018-05-14 12:22:29.149657093 +0100 -+++ binutils-2.30/bfd/elfxx-x86.c 2018-05-14 12:25:16.244700009 +0100 -@@ -839,6 +839,33 @@ _bfd_x86_elf_compare_relocs (const void - return 0; - } - -+/* Mark symbol, NAME, as locally defined by linker if it is referenced -+ and not defined in a relocatable object file. */ -+ -+static void -+elf_x86_linker_defined (struct bfd_link_info *info, const char *name) -+{ -+ struct elf_link_hash_entry *h; -+ -+ h = elf_link_hash_lookup (elf_hash_table (info), name, -+ FALSE, FALSE, FALSE); -+ if (h == NULL) -+ return; -+ -+ while (h->root.type == bfd_link_hash_indirect) -+ h = (struct elf_link_hash_entry *) h->root.u.i.link; -+ -+ if (h->root.type == bfd_link_hash_new -+ || h->root.type == bfd_link_hash_undefined -+ || h->root.type == bfd_link_hash_undefweak -+ || h->root.type == bfd_link_hash_common -+ || (!h->def_regular && h->def_dynamic)) -+ { -+ elf_x86_hash_entry (h)->local_ref = 2; -+ elf_x86_hash_entry (h)->linker_def = 1; -+ } -+} -+ - bfd_boolean - _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info) - { -@@ -869,18 +896,16 @@ _bfd_x86_elf_link_check_relocs (bfd *abf - - /* "__ehdr_start" will be defined by linker as a hidden symbol - later if it is referenced and not defined. */ -- h = elf_link_hash_lookup (elf_hash_table (info), -- "__ehdr_start", -- FALSE, FALSE, FALSE); -- if (h != NULL -- && (h->root.type == bfd_link_hash_new -- || h->root.type == bfd_link_hash_undefined -- || h->root.type == bfd_link_hash_undefweak -- || h->root.type == bfd_link_hash_common)) -+ elf_x86_linker_defined (info, "__ehdr_start"); -+ -+ if (bfd_link_executable (info)) - { -- elf_x86_hash_entry (h)->local_ref = 2; -- elf_x86_hash_entry (h)->linker_def = 1; -- } -+ /* References to __bss_start, _end and _edata should be -+ locally resolved within executables. */ -+ elf_x86_linker_defined (info, "__bss_start"); -+ elf_x86_linker_defined (info, "_end"); -+ elf_x86_linker_defined (info, "_edata"); -+ } - } - } - diff --git a/binutils-x86-local-version.patch b/binutils-x86-local-version.patch deleted file mode 100644 index 8005120..0000000 --- a/binutils-x86-local-version.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c ---- binutils.orig/bfd/elf.c 2018-06-01 09:10:37.866552789 +0100 -+++ binutils-2.30/bfd/elf.c 2018-06-01 09:16:23.159605609 +0100 -@@ -707,11 +707,23 @@ setup_group (bfd *abfd, Elf_Internal_Shd - |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; - break; - } -- if (idx >= shnum) -+ if (idx < shnum) -+ { -+ dest->shdr = elf_elfsections (abfd)[idx]; -+ /* PR binutils/23199: All sections in a -+ section group should be marked with -+ SHF_GROUP. But some tools generate -+ broken objects without SHF_GROUP. Fix -+ them up here. */ -+ dest->shdr->sh_flags |= SHF_GROUP; -+ } -+ if (idx >= shnum -+ || dest->shdr->sh_type == SHT_GROUP) - { - _bfd_error_handler -- (_("%B: invalid SHT_GROUP entry"), abfd); -- idx = 0; -+ (_("%B: invalid entry in SHT_GROUP section [%u]"), -+ abfd, i); -+ dest->shdr = NULL; - } - dest->shdr = elf_elfsections (abfd)[idx]; - } -@@ -779,7 +791,8 @@ setup_group (bfd *abfd, Elf_Internal_Shd - idx = (Elf_Internal_Group *) shdr->contents; - n_elt = shdr->sh_size / 4; - while (--n_elt != 0) -- if ((s = (++idx)->shdr->bfd_section) != NULL -+ if ((++idx)->shdr != NULL -+ && (s = idx->shdr->bfd_section) != NULL - && elf_next_in_group (s) != NULL) - break; - if (n_elt != 0) -diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c ---- binutils.orig/bfd/elfxx-x86.c 2018-06-01 09:10:37.854552926 +0100 -+++ binutils-2.30/bfd/elfxx-x86.c 2018-06-01 09:21:10.570323575 +0100 -@@ -1976,7 +1976,13 @@ _bfd_x86_elf_link_symbol_references_loca - return TRUE; - } - -- eh->local_ref = 1; -+ /* Symbols created by HIDDEN and PROVIDE_HIDDEN assignments in linker -+ script aren't forced local here yet. bfd_hide_sym_by_version -+ can't be used to check if a versioned symbol is hidden. It has to -+ be syncd with _bfd_elf_link_assign_sym_version to get the correct -+ answer. */ -+ if (!h->root.ldscript_def && h->versioned == unversioned) -+ eh->local_ref = 1; - return FALSE; - } - diff --git a/binutils-x86-no-scale-8bit-displacements.patch b/binutils-x86-no-scale-8bit-displacements.patch deleted file mode 100644 index 2317bbd..0000000 --- a/binutils-x86-no-scale-8bit-displacements.patch +++ /dev/null @@ -1,38 +0,0 @@ -Only in binutils-2.31.1/gas: ChangeLog.orig -diff -rup binutils.orig/gas/config/tc-i386.c binutils-2.31.1/gas/config/tc-i386.c ---- binutils.orig/gas/config/tc-i386.c 2019-04-10 10:31:32.788961110 +0100 -+++ binutils-2.31.1/gas/config/tc-i386.c 2019-04-10 10:31:57.669774802 +0100 -@@ -7857,7 +7857,8 @@ output_disp (fragS *insn_start_frag, off - int size = disp_size (n); - offsetT val = i.op[n].disps->X_add_number; - -- val = offset_in_range (val >> i.memshift, size); -+ val = offset_in_range (val >> (size == 1 ? i.memshift : 0), -+ size); - p = frag_more (size); - md_number_to_chars (p, val, size); - } -Only in binutils-2.31.1/gas/config: tc-i386.c.orig -Only in binutils-2.31.1/gas/testsuite/gas/i386: evex-no-scale-32.d -Only in binutils-2.31.1/gas/testsuite/gas/i386: evex-no-scale-64.d -Only in binutils-2.31.1/gas/testsuite/gas/i386: evex-no-scale.s -diff -rup binutils.orig/gas/testsuite/gas/i386/i386.exp binutils-2.31.1/gas/testsuite/gas/i386/i386.exp ---- binutils.orig/gas/testsuite/gas/i386/i386.exp 2019-04-10 10:31:32.160965768 +0100 -+++ binutils-2.31.1/gas/testsuite/gas/i386/i386.exp 2019-04-10 10:31:57.670774795 +0100 -@@ -224,6 +224,7 @@ if [expr ([istarget "i*86-*-*"] || [ist - run_dump_test "evex-lig512-intel" - run_dump_test "evex-wig1" - run_dump_test "evex-wig1-intel" -+ run_dump_test "evex-no-scale-32" - run_dump_test "sse2avx" - run_list_test "inval-avx" "-al" - run_list_test "inval-avx512f" "-al" -@@ -733,6 +734,7 @@ if [expr ([istarget "i*86-*-*"] || [ista - run_dump_test "x86-64-evex-lig512-intel" - run_dump_test "x86-64-evex-wig1" - run_dump_test "x86-64-evex-wig1-intel" -+ run_dump_test "evex-no-scale-64" - run_dump_test "x86-64-sse2avx" - run_list_test "x86-64-inval-avx" "-al" - run_list_test "x86-64-inval-avx512f" "-al" -Only in binutils-2.31.1/gas/testsuite/gas/i386: i386.exp.orig diff --git a/cross-binutils-2.25-fixup-for-sh64.patch b/cross-binutils-2.25-fixup-for-sh64.patch deleted file mode 100644 index a9d8f88..0000000 --- a/cross-binutils-2.25-fixup-for-sh64.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- binutils-2.24/bfd/elf64-sh64.c.old -+++ binutils-2.24/bfd/elf64-sh64.c -@@ -2894,6 +2894,10 @@ static void - sh64_elf64_final_write_processing (bfd *abfd, - bfd_boolean linker ATTRIBUTE_UNUSED) - { -+ /* PR 17288: Make sure that the SH5 flag is set. */ -+ if (elf_elfheader (abfd)->e_flags == 0) -+ elf_elfheader (abfd)->e_flags |= EF_SH5; -+ - /* FIXME: Perhaps we shouldn't do this if the entry address was supplied - numerically, but we currently lack the infrastructure to recognize - that: The entry symbol, and info whether it is numeric or a symbol diff --git a/cross-binutils.spec b/cross-binutils.spec index baed621..934da2a 100644 --- a/cross-binutils.spec +++ b/cross-binutils.spec @@ -64,8 +64,8 @@ Summary: A GNU collection of cross-compilation binary utilities Name: %{cross}-binutils -Version: 2.31.1 -Release: 3%{?dist} +Version: 2.32 +Release: 1%{?dist} License: GPLv3+ URL: https://sourceware.org/binutils @@ -96,7 +96,7 @@ Patch02: binutils-2.25-version.patch # Purpose: Exports the demangle.h header file (associated with the libiberty # sources) with the binutils-devel rpm. # Lifetime: Permanent. This is a RHEL/Fedora specific patch. -Patch03: binutils-2.31-export-demangle.h.patch +Patch03: binutils-export-demangle.h.patch # Purpose: Disables the check in the BFD library's bfd.h header file that # config.h has been included before the bfd.h header. See BZ @@ -109,11 +109,6 @@ Patch03: binutils-2.31-export-demangle.h.patch # order. Patch04: binutils-2.22.52.0.4-no-config-h-check.patch -# Purpose: Import H.J.Lu's Kernel LTO patch. -# Lifetime: Permanent, but needs continual updating. -# FIXME: Try removing.... -# Patch05: binutils-2.26-lto.patch - # Purpose: Include the filename concerned in readelf error messages. This # makes readelf's output more helpful when it is run on multiple # input files. @@ -121,7 +116,7 @@ Patch04: binutils-2.22.52.0.4-no-config-h-check.patch # making it better (IMHO) but also potentially breaking tools that # depend upon readelf's current format. Hence it remains a local # patch. -Patch06: binutils-2.29-filename-in-error-messages.patch +Patch05: binutils-2.29-filename-in-error-messages.patch # Purpose: Disable an x86/x86_64 optimization that moves functions from the # PLT into the GOTPLT for faster access. This optimization is @@ -129,7 +124,7 @@ Patch06: binutils-2.29-filename-in-error-messages.patch # as ltrace and LD_AUDIT. See BZs 1452111 and 1333481. # Lifetime: Permanent. But it should not be. # FIXME: Replace with a configure time option. -Patch07: binutils-2.29-revert-PLT-elision.patch +Patch06: binutils-2.29-revert-PLT-elision.patch # Purpose: Changes readelf so that when it displays extra information about # a symbol, this information is placed at the end of the line. @@ -137,128 +132,64 @@ Patch07: binutils-2.29-revert-PLT-elision.patch # FIXME: The proper fix would be to update the scripts that are expecting # a fixed output from readelf. But it seems that some of them are # no longer being maintained. -Patch08: binutils-readelf-other-sym-info.patch +Patch07: binutils-readelf-other-sym-info.patch # Purpose: Do not create PLT entries for AARCH64 IFUNC symbols referenced in # debug sections. # Lifetime: Permanent. # FIXME: Find related bug. Decide on permanency. -Patch09: binutils-2.27-aarch64-ifunc.patch - -# Purpose: Fix linker testsuite failures -# Lifetime: Fixed in 2.32 (probably) -Patch10: binutils-fix-testsuite-failures.patch - -# Purpose: Revert fix for PR 23161 which was placing unversioned section -# symbols (_edata, _end, __bss_start) into shared libraries. -# See also PR 23499 and BZ 1614920 -# Lifetime: Fixed in 2.32 -# Patch11: binutils-do-not-provide-shared-section-symbols.patch -Patch11: binutils-clear-version-info.patch - -# Purpose: Stop gold from complaining about relocs in the .gnu.build.attribute -# section that reference symbols in discarded sections. -# Lifetime: Fixed in 2.32 (maybe) -Patch12: binutils-gold-ignore-discarded-note-relocs.patch - -# Purpose: Improve partial relro support for 64-bit s/390. -# Lifetime: Fixed in 2.32 -Patch13: binutils-s390-partial-relro.patch - -# Purpose: Merge .gnu.build.attribute sections into a single section. -# Lifetime: Fixed in 2.32 -Patch14: binutils-merge-attribute-sections.patch - -# Purpose: Improve objcopy's --merge-notes option. -# Lifetime: Fixed in 2.32 -Patch15: binutils-note-merge-improvements.patch - -# Purpose: Detect and report corrupt symbol version information. -# Lifetime: Fixed in 2.32 -Patch16: binutils-detect-corrupt-sym-version-info.patch - -# Purpose: Delay the evaluation of linker script constants until -# after the configuration options have been set. -# Lifetime: Fixed in 2.32 -Patch17: binutils-delay-ld-script-constant-eval.patch - -# Purpose: Stop readelf's reports of gaps in build notes - they are unreliable. -# Lifetime: Unknown. -Patch18: binutils-disable-readelf-gap-reports.patch +Patch08: binutils-2.27-aarch64-ifunc.patch # Purpose: Stop the binutils from statically linking with libstdc++. # Lifetime: Permanent. -Patch20: binutils-do-not-link-with-static-libstdc++.patch +Patch09: binutils-do-not-link-with-static-libstdc++.patch # Purpose: Add a .attach_to_group pseudo-op to the assembler for # use by the annobin gcc plugin. # Lifetime: Permanent. -Patch21: binutils-attach-to-group.patch +Patch10: binutils-attach-to-group.patch -# Purpose: Fix a potential buffer overrun when parsing a corrupt ELF file. -# Lifetime: Fixed in 2.32. -Patch22: binutils-CVE-2018-17358.patch +# Purpose: Stop gold from complaining about relocs in the .gnu.build.attribute +# section that reference symbols in discarded sections. +# Lifetime: Fixed in 2.33 (maybe) +Patch11: binutils-gold-ignore-discarded-note-relocs.patch # Purpose: Allow OS specific sections in section groups. -# Lifetime: Might be fixed in 2.32 -Patch23: binutils-special-sections-in-groups.patch - -# Purpose: Stop gold from issuing warnings about dropped version -# information, unless explicitly requested otherwise. -# Lifetime: Fixed in 2.32 -Patch24: binutils-gold-discard-version-info.patch - -# Purpose: Fix a memory leak reading minisymbols. -# Lifetime: Fixed in 2.32 -Patch25: binutils-CVE-2018-20002.patch - -# Purpose: Fix assembler check for an output file matching an input file. -# Lifetime: Fixed in 2.32 -Patch26: binutils-gas-input-matches-output.patch - -# Purpose: Ensure that decompressed sections have the correct alignment. -# Lifetime: Fixed in 2.32 -Patch27: binutils-alignment-of-decompressed-sections.patch +# Lifetime: Might be fixed in 2.33 +Patch12: binutils-special-sections-in-groups.patch -# Purpose: Correct the generation of relocations for local ifuncs on PowerPC64 -# Lifetime: Fixed in 2.32 -Patch28: binutils-ppc64-local-ifunc-relocs.patch +# Purpose: Fix linker testsuite failures. +# Lifetime: Fixed in 2.33 (possibly) +Patch13: binutils-fix-testsuite-failures.patch # Purpose: Improve objdump's handling of corrupt input files. # Lifetime: Fixed in 2.33 -Patch29: binutils-CVE-2019-9073.patch +Patch14: binutils-CVE-2019-9073.patch # Purpose: Stop illegal memory access parsing corrupt PE files. # Lifetime: Fixed in 2.33 -Patch30: binutils-CVE-2019-9074.patch +Patch15: binutils-CVE-2019-9074.patch # Purpose: Stop illegal memory access parsing corrupt archives. # Lifetime: Fixed in 2.33 -Patch31: binutils-CVE-2019-9075.patch +Patch16: binutils-CVE-2019-9075.patch # Purpose: Stop illegal memory access parsing a corrupt MIPS binary. # Lifetime: Fixed in 2.33 -Patch32: binutils-CVE-2019-9077.patch +Patch17: binutils-CVE-2019-9077.patch # Purpose: Stop a seg-fault when disassembling an EFI binary. # Lifetime: Fixed in 2.33 -Patch33: binutils-disassembling-efi-files.patch - -# Purpose: Fix a bug handling 8-bit displacements in some x86 insns. -# Lifetime: Fixed in 2.32 -Patch34: binutils-x86-no-scale-8bit-displacements.patch +Patch18: binutils-disassembling-efi-files.patch # Purpose: Fix a stack exhaustion problem in libiberty's name demangling code. # Lifetime: Fixed in 2.33 -Patch35: binutils-CVE-2019-9071.patch +Patch19: binutils-CVE-2019-9071.patch # Purpose: Have the GOLD linker for AArch64 generate PLT entries for MOVW_ABS # relocations if necessary. # Lifetime: Fixed in 2.33 -Patch36: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch - -# NOTE!!! Don't add cross-binutils patches here as "binutils-xxx". Name them -# cross-binutils-xxx instead! +Patch20: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch #---------------------------------------------------------------------------- @@ -269,12 +200,6 @@ BuildRequires: /usr/bin/pod2man BuildRequires: gcc, perl, sed, coreutils BuildRequires: findutils -# Required for: ld-bootstrap/bootstrap.exp bootstrap with --static -# It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array -Conflicts: gcc-c++ < 4.0.0 -%ifarch ia64 -Obsoletes: gnupro <= 1117-1 -%endif Provides: bundled(libiberty) %description @@ -293,7 +218,6 @@ converting addresses to file and line). %package -n %{cross}-binutils-common Summary: Cross-build binary utility documentation and translation files BuildArch: noarch -Obsoletes: binutils-sh64-linux-gnu < 2.27-1 %description -n %{cross}-binutils-common Documentation, manual pages and translation files for cross-build binary image generation, manipulation and query tools. @@ -376,6 +300,7 @@ cd %{srcdir} %patch02 -p1 %patch03 -p1 %patch04 -p1 +%patch05 -p1 %patch06 -p1 %patch07 -p1 %patch08 -p1 @@ -389,23 +314,8 @@ cd %{srcdir} %patch16 -p1 %patch17 -p1 %patch18 -p1 +%patch19 -p1 %patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -670,8 +580,6 @@ cd .. # ############################################################################### %install -rm -rf %{buildroot} - function install_bin () { cpu=${1%%%%-*} build_dir=$cpu @@ -825,8 +733,8 @@ cd - # ############################################################################### %files -n %{cross}-binutils-common -f files.cross +%license %{srcdir}/COPYING* %doc %{srcdir}/README -%doc %{srcdir}/COPYING* %{_mandir}/man1/%{cross}-* %global do_files() \ @@ -878,6 +786,9 @@ cd - %do_files xtensa-linux-gnu %{build_xtensa} %changelog +* Sun May 26 2019 Peter Robinson 2.32-1 +- Sync with binutils-2.32-14 + * Sun May 26 2019 Peter Robinson 2.31.1-3 - Sync with binutils-2.31.1-31 diff --git a/sources b/sources index 0bdce94..b061c92 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (binutils-2.31.1.tar.xz) = 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 +SHA512 (binutils-2.32.tar.xz) = d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a