diff --git a/binutils-2.29-revert-PLT-elision.patch b/binutils-2.29-revert-PLT-elision.patch index ac1eeaf..c5478f0 100644 --- a/binutils-2.29-revert-PLT-elision.patch +++ b/binutils-2.29-revert-PLT-elision.patch @@ -44,18 +44,6 @@ diff -rup binutils.orig/ld/testsuite/ld-i386/pr19636-2e.d binutils-2.29.1/ld/tes Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name #... -diff -rup binutils.orig/ld/testsuite/ld-i386/pr20830.d binutils-2.29.1/ld/testsuite/ld-i386/pr20830.d ---- binutils.orig/ld/testsuite/ld-i386/pr20830.d 2017-11-15 13:32:39.332065299 +0000 -+++ binutils-2.29.1/ld/testsuite/ld-i386/pr20830.d 2017-11-15 15:04:43.205165384 +0000 -@@ -19,7 +19,7 @@ Contents of the .eh_frame section: - DW_CFA_offset: r8 \(eip\) at cfa-4 - DW_CFA_nop - DW_CFA_nop -- -+#pass - 0+18 00000010 0000001c FDE cie=00000000 pc=00000188..00000193 - DW_CFA_nop - DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d --- binutils.orig/ld/testsuite/ld-x86-64/pltgot-1.d 2017-11-15 13:32:39.415064300 +0000 +++ binutils-2.29.1/ld/testsuite/ld-x86-64/pltgot-1.d 2017-11-15 15:08:39.333375801 +0000 @@ -119,7 +107,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a.d binutils-2.29.1/ld/tes DW_CFA_nop +#pass - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000238..0000000000000244 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830a-now.d --- binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d 2017-11-15 13:32:39.413064324 +0000 @@ -130,7 +118,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830a-now.d binutils-2.29.1/ld DW_CFA_nop +#pass - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000238..0000000000000244 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b.d --- binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d 2017-11-15 13:32:39.413064324 +0000 @@ -142,7 +130,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b.d binutils-2.29.1/ld/tes - +#pass + - 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000188..0000000000000194 + 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr20830b-now.d @@ -155,7 +143,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr20830b-now.d binutils-2.29.1/ld - +#pass + - 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000188..0000000000000194 + 0+18 0000000000000010 0000001c FDE cie=00000000 pc=0000000000000138..0000000000000144 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a.d @@ -168,7 +156,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a.d binutils-2.29.1/ld/tes - +#pass + - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000238..0000000000000244 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038a-now.d @@ -181,7 +169,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038a-now.d binutils-2.29.1/ld - +#pass + - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000238..0000000000000244 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001c8..00000000000001d4 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b.d @@ -193,7 +181,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b.d binutils-2.29.1/ld/tes DW_CFA_nop +#pass - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000248..000000000000024d + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038b-now.d --- binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d 2017-11-15 13:32:39.416064288 +0000 @@ -205,7 +193,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038b-now.d binutils-2.29.1/ld - +#pass + - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000248..000000000000024d + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=00000000000001d8..00000000000001dd DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c.d @@ -218,7 +206,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c.d binutils-2.29.1/ld/tes - +#pass + - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000290..00000000000002a1 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.29.1/ld/testsuite/ld-x86-64/pr21038c-now.d @@ -231,7 +219,7 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/pr21038c-now.d binutils-2.29.1/ld - +#pass + - 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000290..00000000000002a1 + 0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000220..0000000000000231 DW_CFA_nop DW_CFA_nop diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/testsuite/ld-x86-64/tlspic2.rd @@ -265,3 +253,14 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/tlspic2.rd binutils-2.29.1/ld/tes /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it here if it is defined and referenced in a non-shared object. */ if (h->type == STT_GNU_IFUNC +--- binutils.orig/ld/testsuite/ld-i386/pr20830.d 2018-07-09 09:49:51.277239857 +0100 ++++ binutils-2.30.90/ld/testsuite/ld-i386/pr20830.d 2018-07-09 10:32:41.113356733 +0100 +@@ -19,7 +19,7 @@ Contents of the .eh_frame section: + DW_CFA_offset: r8 \(eip\) at cfa-4 + DW_CFA_nop + DW_CFA_nop +- ++#pass + 0+18 00000010 0000001c FDE cie=00000000 pc=00000128..00000133 + DW_CFA_nop + DW_CFA_nop diff --git a/binutils-2.31-export-demangle.h.patch b/binutils-2.31-export-demangle.h.patch new file mode 100644 index 0000000..e59f393 --- /dev/null +++ b/binutils-2.31-export-demangle.h.patch @@ -0,0 +1,33 @@ +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-17358.patch b/binutils-CVE-2018-17358.patch new file mode 100644 index 0000000..fd91fda --- /dev/null +++ b/binutils-CVE-2018-17358.patch @@ -0,0 +1,101 @@ +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-attach-to-group.patch b/binutils-attach-to-group.patch new file mode 100644 index 0000000..7bb5348 --- /dev/null +++ b/binutils-attach-to-group.patch @@ -0,0 +1,68 @@ +diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c +--- binutils.orig/gas/config/obj-elf.c 2018-09-24 17:50:06.974172867 +0100 ++++ binutils-2.30/gas/config/obj-elf.c 2018-09-25 15:19:33.559830794 +0100 +@@ -82,9 +82,11 @@ static void obj_elf_gnu_attribute (int); + static void obj_elf_tls_common (int); + static void obj_elf_lcomm (int); + static void obj_elf_struct (int); ++static void obj_elf_attach_to_group (int); + + static const pseudo_typeS elf_pseudo_table[] = + { ++ {"attach_to_group", obj_elf_attach_to_group, 0}, + {"comm", obj_elf_common, 0}, + {"common", obj_elf_common, 1}, + {"ident", obj_elf_ident, 0}, +@@ -1007,6 +1009,27 @@ obj_elf_section_name (void) + return name; + } + ++static void ++obj_elf_attach_to_group (int dummy ATTRIBUTE_UNUSED) ++{ ++ const char * gname = obj_elf_section_name (); ++ ++ if (gname == NULL) ++ { ++ as_warn ("group name not parseable"); ++ return; ++ } ++ ++ if (elf_group_name (now_seg)) ++ { ++ as_warn ("already has a group"); ++ return; ++ } ++ ++ elf_group_name (now_seg) = xstrdup (gname); ++ elf_section_flags (now_seg) |= SHF_GROUP; ++} ++ + void + obj_elf_section (int push) + { +diff -rup binutils.orig/gas/doc/as.texinfo binutils-2.30/gas/doc/as.texinfo +--- binutils.orig/gas/doc/as.texi 2018-09-24 17:50:06.984172788 +0100 ++++ binutils-2.30/gas/doc/as.texi 2018-09-25 15:19:43.557748972 +0100 +@@ -4407,6 +4407,7 @@ Some machine configurations provide addi + * Altmacro:: @code{.altmacro} + * Ascii:: @code{.ascii "@var{string}"}@dots{} + * Asciz:: @code{.asciz "@var{string}"}@dots{} ++* Attach_to_group:: @code{.attach_to_group @var{name}} + * Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}} + * Bundle directives:: @code{.bundle_align_mode @var{abs-expr}}, etc + * Byte:: @code{.byte @var{expressions}} +@@ -4703,6 +4704,12 @@ trailing zero byte) into consecutive add + @code{.asciz} is just like @code{.ascii}, but each string is followed by + a zero byte. The ``z'' in @samp{.asciz} stands for ``zero''. + ++@node Attach_to_group ++@section @code{.attach_to_group @var{name}} ++Attaches the current section to the named group. This is like declaring ++the section with the @code{G} attribute, but can be done after the section ++has been created. ++ + @node Balign + @section @code{.balign[wl] @var{abs-expr}, @var{abs-expr}, @var{abs-expr}} + + diff --git a/binutils-clear-version-info.patch b/binutils-clear-version-info.patch new file mode 100644 index 0000000..d5d5c20 --- /dev/null +++ b/binutils-clear-version-info.patch @@ -0,0 +1,21 @@ +--- 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-delay-ld-script-constant-eval.patch b/binutils-delay-ld-script-constant-eval.patch new file mode 100644 index 0000000..ff20b6a --- /dev/null +++ b/binutils-delay-ld-script-constant-eval.patch @@ -0,0 +1,196 @@ +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 new file mode 100644 index 0000000..dc7cf17 --- /dev/null +++ b/binutils-detect-corrupt-sym-version-info.patch @@ -0,0 +1,52 @@ +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 new file mode 100644 index 0000000..cee63ba --- /dev/null +++ b/binutils-disable-readelf-gap-reports.patch @@ -0,0 +1,16 @@ +--- 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-do-not-link-with-static-libstdc++.patch b/binutils-do-not-link-with-static-libstdc++.patch new file mode 100644 index 0000000..49d46c2 --- /dev/null +++ b/binutils-do-not-link-with-static-libstdc++.patch @@ -0,0 +1,83 @@ +diff -rup binutils.orig/configure binutils-2.30/configure +--- binutils.orig/configure 2018-09-24 17:50:06.967172922 +0100 ++++ binutils-2.30/configure 2018-09-24 17:51:16.648624865 +0100 +@@ -4996,49 +4996,6 @@ if test -z "$LD"; then + fi + fi + +-# Check whether -static-libstdc++ -static-libgcc is supported. +-have_static_libs=no +-if test "$GCC" = yes; then +- saved_LDFLAGS="$LDFLAGS" +- +- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc" +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -static-libstdc++ -static-libgcc" >&5 +-$as_echo_n "checking whether g++ accepts -static-libstdc++ -static-libgcc... " >&6; } +- ac_ext=cpp +-ac_cpp='$CXXCPP $CPPFLAGS' +-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +- +- +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) +-#error -static-libstdc++ not implemented +-#endif +-int main() {} +-_ACEOF +-if ac_fn_cxx_try_link "$LINENO"; then : +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +-$as_echo "yes" >&6; }; have_static_libs=yes +-else +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +-$as_echo "no" >&6; } +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- ac_ext=c +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +-ac_compiler_gnu=$ac_cv_c_compiler_gnu +- +- +- LDFLAGS="$saved_LDFLAGS" +-fi +- +- + + + if test -n "$ac_tool_prefix"; then +diff -rup binutils.orig/configure.ac binutils-2.30/configure.ac +--- binutils.orig/configure.ac 2018-09-24 17:50:07.241170767 +0100 ++++ binutils-2.30/configure.ac 2018-09-24 17:50:29.908992486 +0100 +@@ -1288,26 +1288,6 @@ if test -z "$LD"; then + fi + fi + +-# Check whether -static-libstdc++ -static-libgcc is supported. +-have_static_libs=no +-if test "$GCC" = yes; then +- saved_LDFLAGS="$LDFLAGS" +- +- LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc" +- AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc]) +- AC_LANG_PUSH(C++) +- AC_LINK_IFELSE([AC_LANG_SOURCE([ +-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) +-#error -static-libstdc++ not implemented +-#endif +-int main() {}])], +- [AC_MSG_RESULT([yes]); have_static_libs=yes], +- [AC_MSG_RESULT([no])]) +- AC_LANG_POP(C++) +- +- LDFLAGS="$saved_LDFLAGS" +-fi +- + ACX_PROG_GNAT + ACX_PROG_CMP_IGNORE_INITIAL + diff --git a/binutils-fix-testsuite-failures.patch b/binutils-fix-testsuite-failures.patch index 6ec4151..b8a1a56 100644 --- a/binutils-fix-testsuite-failures.patch +++ b/binutils-fix-testsuite-failures.patch @@ -321,17 +321,6 @@ diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/ # 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/pr14207.d 2018-05-31 16:14:12.614540068 +0100 -+++ binutils-2.30/ld/testsuite/ld-x86-64/pr14207.d 2018-06-01 11:02:02.438444359 +0100 -@@ -13,7 +13,7 @@ Program Headers: - LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001c8 0x0001c8 R 0x200000 - LOAD 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x000c.8 RW 0x200000 - DYNAMIC 0x000b.0 0x0000000000200b.0 0x0000000000200b.0 0x0001.0 0x0001.0 RW 0x8 -- GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.8 0x0004.8 R 0x1 -+ GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.. 0x0004.8 R 0x1 - - Section to Segment mapping: - Segment Sections... --- 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 @@ @@ -480,39 +469,6 @@ diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/ 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/tls.exp 2018-05-31 16:14:12.665539507 +0100 -+++ binutils-2.30/ld/testsuite/ld-elf/tls.exp 2018-06-01 14:17:13.223211181 +0100 -@@ -37,15 +37,18 @@ if { [which $CC] == 0 } { - return - } - --run_ld_link_tests [list \ -- [list \ -- "Build pr22263-1" \ -- "-pie -e _start -z text" \ -- "" \ -- "" \ -- { pr22263-1a.c pr22263-1b.c } \ -- {{readelf -r pr22263-1.rd}} \ -- "pr22263-1" \ -- "-fPIE -O2" \ -- ] \ --] -+# The s390x system compiler miscompiles these tests. -+if { ! [istarget s390x-*-*] } { -+ run_ld_link_tests [list \ -+ [list \ -+ "Build pr22263-1" \ -+ "-pie -e _start -z text" \ -+ "" \ -+ "" \ -+ { pr22263-1a.c pr22263-1b.c } \ -+ {{readelf -r pr22263-1.rd}} \ -+ "pr22263-1" \ -+ "-fPIE -O2" \ -+ ] \ -+ ] -+} --- 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 { @@ -681,3 +637,21 @@ diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/ 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 --git a/binutils-gold-ignore-discarded-note-relocs.patch b/binutils-gold-ignore-discarded-note-relocs.patch new file mode 100644 index 0000000..b354fa4 --- /dev/null +++ b/binutils-gold-ignore-discarded-note-relocs.patch @@ -0,0 +1,10 @@ +--- binutils.orig/gold/target-reloc.h 2018-07-12 11:37:24.894494658 +0100 ++++ binutils-2.30.90/gold/target-reloc.h 2018-07-12 15:38:50.049083904 +0100 +@@ -136,6 +136,7 @@ class Default_comdat_behavior + if (Layout::is_debug_info_section(name)) + return CB_PRETEND; + if (strcmp(name, ".eh_frame") == 0 ++ || strncmp(name, ".gnu.build.attributes", 21) == 0 // FIXME: We should really be checking the section type for ST_NOTE... + || strcmp(name, ".gcc_except_table") == 0) + return CB_IGNORE; + return CB_ERROR; diff --git a/binutils-merge-attribute-sections.patch b/binutils-merge-attribute-sections.patch new file mode 100644 index 0000000..5dcd5e4 --- /dev/null +++ b/binutils-merge-attribute-sections.patch @@ -0,0 +1,23 @@ +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 <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-s390-partial-relro.patch b/binutils-s390-partial-relro.patch new file mode 100644 index 0000000..83fd98a --- /dev/null +++ b/binutils-s390-partial-relro.patch @@ -0,0 +1,872 @@ +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-special-sections-in-groups.patch b/binutils-special-sections-in-groups.patch new file mode 100644 index 0000000..7de5a93 --- /dev/null +++ b/binutils-special-sections-in-groups.patch @@ -0,0 +1,27 @@ +--- binutils.orig/bfd/elf.c 2018-10-19 11:42:10.107277490 +0100 ++++ binutils-2.31.1/bfd/elf.c 2018-10-19 11:44:33.607105801 +0100 +@@ -830,7 +830,13 @@ setup_group (bfd *abfd, Elf_Internal_Shd + } + } + +- if (elf_group_name (newsect) == NULL) ++ if (elf_group_name (newsect) == NULL ++ /* OS specific sections might be in a group (eg ARM's ARM_EXIDX section) ++ but they will not have been added to the group because they do not ++ have contents that the ELF code in the BFD library knows how to ++ process. This is OK though - we rely upon the target backends to ++ handle these sections for us. */ ++ && hdr->sh_type < SHT_LOOS) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: no group info for section '%pA'"), +@@ -936,7 +942,8 @@ _bfd_elf_setup_sections (bfd *abfd) + else if (idx->shdr->bfd_section) + elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section; + else if (idx->shdr->sh_type != SHT_RELA +- && idx->shdr->sh_type != SHT_REL) ++ && idx->shdr->sh_type != SHT_REL ++ && idx->shdr->sh_type < SHT_LOOS) + { + /* There are some unknown sections in the group. */ + _bfd_error_handler diff --git a/cross-binutils.spec b/cross-binutils.spec index cbbef4f..2da338a 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.30 -Release: 6%{?dist} +Version: 2.31.1 +Release: 1%{?dist} License: GPLv3+ Group: Development/Tools URL: https://sourceware.org/binutils @@ -97,7 +97,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.22.52.0.1-export-demangle.h.patch +Patch03: binutils-2.31-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 @@ -113,7 +113,7 @@ 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 +# 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 @@ -146,152 +146,63 @@ Patch08: binutils-readelf-other-sym-info.patch # FIXME: Find related bug. Decide on permanency. Patch09: binutils-2.27-aarch64-ifunc.patch -# Purpose: Remove support for inserting PowerPC Speculation Barrier -# instructions from the linker. (It has been deprecated in -# favour of a hardware fix). -# Lifetime: Fixed in 2.30.1 and/or 2.31. -Patch10: binutils-revert-PowerPC-speculation-barriers.patch - -# Purpose: Stop readelf/objdump for searching for DWO links unless -# explicitly requested by the user. -# Lifetime: Fixed in 2.30.1 and/or 2.31. -Patch11: binutils-skip-dwo-search-if-not-needed.patch - -# Purpose: Fix a bug in the BFD linker's layout algorithm which ended up -# placing executable and non-executable pages in the same segment. -# Lifetime: Fixed in 2.30.1 and/or 2.31. -Patch12: binutils-page-to-segment-assignment.patch - -# Purpose: Fix a bug in ld for linking against AARCH64 UEFI -# Lifetime: Fixed in 2.30.1 and/or 2.31 -Patch13: binutils-2.30-allow_R_AARCH64-symbols.patch - -# Purpose: Stop strip from replacing unknown relocs with null relocs. Make -# it return an error status and not strip the file instead. -# Lifetime: Fixed in 2.31. -Patch14: binutils-strip-unknown-relocs.patch - -# Purpose: Improves objdump's function for locating a symbol to match a -# given address, so that it uses a binary chop algorithm. -# Lifetime: Fixed in 2.31. -Patch15: binutils-speed-up-objdump.patch - -# Purpose: Ignore duplicate indirect symbols generated by GOLD. +# 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 + +# Purpose: Stop the binutils from statically linking with libstdc++. # Lifetime: Permanent. -# FIXME: This problem needs to be resolved in the FSF sources, but the -# GOLD maintainers seem to be reluctant to address the issue. -Patch16: binutils-2.28-ignore-gold-duplicates.patch - -# Purpose: Treat relocs against STT_GNU_IFUNC symbols in note sections as -# if they were relocs against STT_FUNC symbols instead. -# Lifetime: Fixed in 2.31. -Patch17: binutils-ifunc-relocs-in-notes.patch - -# Purpose: Do not discard debug only object files created by GCC v8's -# LTO wrapper. -# Lifetime: Fixed in 2.31. -Patch18: binutils-debug-section-marking.patch - -# Purpose: Fix the GOLD linker's handling of PROTECTED symbols from the -# LLVM plugin. -# Lifetime: Fixed in 2.31 (probably - check...). -Patch19: binutils-gold-llvm-plugin.patch - -# Purpose: Enhance the assembler so that it will automatically generate -# GNU Build attribute notes if none are present in the inputs. -# Lifetime: Fixed in 2.31 -Patch20: binutils-gas-build-notes.patch - -# Purpose: Fix a seg-fault triggered by running objdump on a corrupt AOUT -# format file. -# Lifetime: Fixed in 2.31 -Patch21: binutils-CVE-2018-7642.patch - -# Purpose: Fix a seg-fault triggered by running readelf or objdump on a -# file containing corrupt DWARF debug information. -# Lifetime: Fixed in 2.31 -Patch22: binutils-CVE-2018-7643.patch - -# Purpose: Fix a seg-fault triggered by running objdump on a corrupt COFF -# format file. -# Lifetime: Fixed in 2.31 -Patch23: binutils-CVE-2018-7208.patch - -# Purpose: Fix a seg-fault triggered by running readelf or objdump on a -# file containing corrupt DWARF debug information. -# Lifetime: Fixed in 2.31 -Patch24: binutils-CVE-2018-10372.patch - -# Purpose: Fix another seg-fault triggered by running readelf or objdump on a -# file containing corrupt DWARF debug information. -# Lifetime: Fixed in 2.31 -Patch25: binutils-CVE-2018-10373.patch - -# Purpose: Fix a seg-fault triggered by running objcopy on a corrupt ELF -# file. -# Lifetime: Fixed in 2.31 -Patch26: binutils-CVE-2018-7570.patch - -# Purpose: Fix a seg-fault triggered by running objcopy on a large ELF -# file on a 32-bit host machine. -# Lifetime: Fixed in 2.31 -Patch27: binutils-CVE-2018-6323.patch - -# Purpose: Fix a seg-fault triggered by running nm on a corrupt ELF file. -# Lifetime: Fixed in 2.31 -Patch28: binutils-CVE-2018-6759.patch - -# Purpose: Fix a seg-fault triggered by running nm on a file containing -# corrupt DWARF information. -# Lifetime: Fixed in 2.31 -Patch29: binutils-CVE-2018-7569.patch - -# Purpose: Fix a seg-fault triggered by running nm on a file containing -# corrupt DWARF information. -# Lifetime: Fixed in 2.31 -Patch30: binutils-CVE-2018-7568.patch - -# Purpose: Fix a seg-fault triggered by running objcopy on a corrupt -# PE format file. -# Lifetime: Fixed in 2.31 -Patch31: binutils-CVE-2018-10534.patch - -# Purpose: Fix a seg-fault triggered by running objcopy on a corrupt -# ELF format file. -# Lifetime: Fixed in 2.31 -Patch32: binutils-CVE-2018-10535.patch - -# Purpose: Have the x86 linker resolve relocations against the _end, -# __bss_start and -edata symbols locally. -# Lifetime: Fixed in 2.31 -Patch33: binutils-x86-local-relocs.patch - -# Purpose: Stop the assembler from generating GNU build notes against -# linkonce sections. -# Lifetime: Fixed in 2.31 -Patch34: binutils-linkonce-notes.patch - -# Purpose: Fix a seg-fault triggered by running objcopy on a corrupt -# PE format file. -# Lifetime: Fixed in 2.31 -Patch35: binutils-CVE-2018-8945.patch - -# Purpose: Fix handling of local version symbols by the x86 linker. -# Lifetime: Fixed in 2.31 -Patch36: binutils-x86-local-version.patch +Patch20: binutils-do-not-link-with-static-libstdc++.patch -# Purpose: Fix linker testsuite failures -# Lifetime: Fixed in 2.31 (probably) -Patch37: binutils-fix-testsuite-failures.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 -# Purpose: Correct warning messages about incompatible PowerPC IEEE -# long double sizes in different binaries. -# Lifetime: Fixed in 2.31. -Patch38: binutils-PowerPC-IEEE-long-double-warnings.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: Fix the generation of relocations for assembler generated notes. -# Lifetime: Fixed in 2.31. -Patch39: binutils-missing-notes.patch +# Purpose: Allow OS specific sections in section groups. +# Lifetime: Might be fixed in 2.32 +Patch23: binutils-special-sections-in-groups.patch # NOTE!!! Don't add cross-binutils patches here as "binutils-xxx". Name them # cross-binutils-xxx instead! @@ -412,12 +323,10 @@ Cross-build binary image generation, manipulation and query tools. \ %global srcdir binutils-%{version} %setup -q -n %{srcdir} -c cd %{srcdir} -#%patch00 -p1 -b .latest-git~ %patch01 -p1 %patch02 -p1 %patch03 -p1 %patch04 -p1 -%patch05 -p1 %patch06 -p1 %patch07 -p1 %patch08 -p1 @@ -431,27 +340,11 @@ 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 -%patch37 -p1 -%patch38 -p1 -%patch39 -p1 + # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -581,7 +474,7 @@ function config_target () { CARGS= case $target in i?86*|sparc*|ppc*|powerpc*|s390*|sh*|arm*) - CARGS="$CARGS --enable-64-bit-bfd --enable-targets=x86_64-pep" + CARGS="$CARGS --enable-64-bit-bfd" ;; esac @@ -590,8 +483,13 @@ function config_target () { ;; esac - case $target in ppc*|powerpc*) - CARGS="$CARGS --enable-targets=spu,powerpc-linux,ppc64le-linux-gnu,ppcle-linux-gnu" + case $target in ppc*|ppc64*) + CARGS="$CARGS --enable-targets=spu" + ;; + esac + + case $target in ppc64-*) + CARGS="$CARGS --enable-targets=powerpc64le-linux" ;; esac @@ -601,6 +499,17 @@ function config_target () { ;; esac + case $target in x86_64*|i?86*|arm*|aarch64*) + CARGS="$CARGS --enable-targets=x86_64-pep" + ;; + esac + +%if %{default_relro} + CARGS="$CARGS --enable-relro=yes" +%else + CARGS="$CARGS --enable-relro=no" +%endif + mkdir $build_dir cd $build_dir @@ -648,8 +557,8 @@ function config_target () { --enable-generate-build-notes=no \ %endif --enable-lto \ - --enable-relro=yes \ $CARGS \ + --enable-plugins \ --with-bugurl=http://bugzilla.redhat.com/bugzilla/ cd .. } @@ -908,6 +817,9 @@ cd - %do_files xtensa-linux-gnu %{build_xtensa} %changelog +* Tue Nov 6 2018 Tom Callaway - 2.31.1-1 +- update to 2.31.1 + * Thu Jul 12 2018 Fedora Release Engineering - 2.30-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild diff --git a/sources b/sources index 2813680..0bdce94 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (binutils-2.30.tar.xz) = e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839 +SHA512 (binutils-2.31.1.tar.xz) = 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30