public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] binutils: update to 2.25.1
@ 2016-04-04  5:24 Marcel Lorenz
  2016-04-04  5:24 ` [PATCH 2/2] grub: fix build fail Marcel Lorenz
  2016-04-04 11:51 ` [PATCH 1/2] binutils: update to 2.25.1 Arne Fitzenreiter
  0 siblings, 2 replies; 5+ messages in thread
From: Marcel Lorenz @ 2016-04-04  5:24 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 57641 bytes --]

Signed-off-by: Marcel Lorenz <marcel.lorenz(a)ipfire.org>

---
 config/rootfiles/common/armv5tel/binutils          | 108 +++++--
 config/rootfiles/common/i586/binutils              |  12 +-
 config/rootfiles/common/x86_64/binutils            |  12 +-
 lfs/binutils                                       |  12 +-
 ...=> binutils-2.25.1-pt-pax-flags-20150727.patch} | 336 ++++++++++-----------
 src/patches/binutils_generate-gnu-hash.patch       |  56 ++++
 .../binutils_ld-poison-system-directories.patch    | 330 ++++++++++++++++++++
 7 files changed, 646 insertions(+), 220 deletions(-)
 rename src/patches/{binutils-2.24-pt-pax-flags-20131231.patch => binutils-2.25.1-pt-pax-flags-20150727.patch} (77%)
 create mode 100644 src/patches/binutils_generate-gnu-hash.patch
 create mode 100644 src/patches/binutils_ld-poison-system-directories.patch

diff --git a/config/rootfiles/common/armv5tel/binutils b/config/rootfiles/common/armv5tel/binutils
index 6fcd5ba..bceda99 100644
--- a/config/rootfiles/common/armv5tel/binutils
+++ b/config/rootfiles/common/armv5tel/binutils
@@ -19,51 +19,93 @@
 #usr/include/bfdlink.h
 #usr/include/dis-asm.h
 #usr/include/libiberty.h
+#usr/include/plugin-api.h
 #usr/include/symcat.h
 #usr/lib/ldscripts
-#usr/lib/ldscripts/armelf_linux_eabi.x
-#usr/lib/ldscripts/armelf_linux_eabi.xbn
-#usr/lib/ldscripts/armelf_linux_eabi.xc
-#usr/lib/ldscripts/armelf_linux_eabi.xd
-#usr/lib/ldscripts/armelf_linux_eabi.xdc
-#usr/lib/ldscripts/armelf_linux_eabi.xdw
-#usr/lib/ldscripts/armelf_linux_eabi.xn
-#usr/lib/ldscripts/armelf_linux_eabi.xr
-#usr/lib/ldscripts/armelf_linux_eabi.xs
-#usr/lib/ldscripts/armelf_linux_eabi.xsc
-#usr/lib/ldscripts/armelf_linux_eabi.xsw
-#usr/lib/ldscripts/armelf_linux_eabi.xu
-#usr/lib/ldscripts/armelf_linux_eabi.xw
-#usr/lib/ldscripts/armelfb_linux_eabi.x
-#usr/lib/ldscripts/armelfb_linux_eabi.xbn
-#usr/lib/ldscripts/armelfb_linux_eabi.xc
-#usr/lib/ldscripts/armelfb_linux_eabi.xd
-#usr/lib/ldscripts/armelfb_linux_eabi.xdc
-#usr/lib/ldscripts/armelfb_linux_eabi.xdw
-#usr/lib/ldscripts/armelfb_linux_eabi.xn
-#usr/lib/ldscripts/armelfb_linux_eabi.xr
-#usr/lib/ldscripts/armelfb_linux_eabi.xs
-#usr/lib/ldscripts/armelfb_linux_eabi.xsc
-#usr/lib/ldscripts/armelfb_linux_eabi.xsw
-#usr/lib/ldscripts/armelfb_linux_eabi.xu
-#usr/lib/ldscripts/armelfb_linux_eabi.xw
-usr/lib/libbfd-2.24.so
+#usr/lib/ldscripts/elf32_x86_64.x
+#usr/lib/ldscripts/elf32_x86_64.xbn
+#usr/lib/ldscripts/elf32_x86_64.xc
+#usr/lib/ldscripts/elf32_x86_64.xd
+#usr/lib/ldscripts/elf32_x86_64.xdc
+#usr/lib/ldscripts/elf32_x86_64.xdw
+#usr/lib/ldscripts/elf32_x86_64.xn
+#usr/lib/ldscripts/elf32_x86_64.xr
+#usr/lib/ldscripts/elf32_x86_64.xs
+#usr/lib/ldscripts/elf32_x86_64.xsc
+#usr/lib/ldscripts/elf32_x86_64.xsw
+#usr/lib/ldscripts/elf32_x86_64.xu
+#usr/lib/ldscripts/elf32_x86_64.xw
+#usr/lib/ldscripts/elf_i386.x
+#usr/lib/ldscripts/elf_i386.xbn
+#usr/lib/ldscripts/elf_i386.xc
+#usr/lib/ldscripts/elf_i386.xd
+#usr/lib/ldscripts/elf_i386.xdc
+#usr/lib/ldscripts/elf_i386.xdw
+#usr/lib/ldscripts/elf_i386.xn
+#usr/lib/ldscripts/elf_i386.xr
+#usr/lib/ldscripts/elf_i386.xs
+#usr/lib/ldscripts/elf_i386.xsc
+#usr/lib/ldscripts/elf_i386.xsw
+#usr/lib/ldscripts/elf_i386.xu
+#usr/lib/ldscripts/elf_i386.xw
+#usr/lib/ldscripts/elf_k1om.x
+#usr/lib/ldscripts/elf_k1om.xbn
+#usr/lib/ldscripts/elf_k1om.xc
+#usr/lib/ldscripts/elf_k1om.xd
+#usr/lib/ldscripts/elf_k1om.xdc
+#usr/lib/ldscripts/elf_k1om.xdw
+#usr/lib/ldscripts/elf_k1om.xn
+#usr/lib/ldscripts/elf_k1om.xr
+#usr/lib/ldscripts/elf_k1om.xs
+#usr/lib/ldscripts/elf_k1om.xsc
+#usr/lib/ldscripts/elf_k1om.xsw
+#usr/lib/ldscripts/elf_k1om.xu
+#usr/lib/ldscripts/elf_k1om.xw
+#usr/lib/ldscripts/elf_l1om.x
+#usr/lib/ldscripts/elf_l1om.xbn
+#usr/lib/ldscripts/elf_l1om.xc
+#usr/lib/ldscripts/elf_l1om.xd
+#usr/lib/ldscripts/elf_l1om.xdc
+#usr/lib/ldscripts/elf_l1om.xdw
+#usr/lib/ldscripts/elf_l1om.xn
+#usr/lib/ldscripts/elf_l1om.xr
+#usr/lib/ldscripts/elf_l1om.xs
+#usr/lib/ldscripts/elf_l1om.xsc
+#usr/lib/ldscripts/elf_l1om.xsw
+#usr/lib/ldscripts/elf_l1om.xu
+#usr/lib/ldscripts/elf_l1om.xw
+#usr/lib/ldscripts/elf_x86_64.x
+#usr/lib/ldscripts/elf_x86_64.xbn
+#usr/lib/ldscripts/elf_x86_64.xc
+#usr/lib/ldscripts/elf_x86_64.xd
+#usr/lib/ldscripts/elf_x86_64.xdc
+#usr/lib/ldscripts/elf_x86_64.xdw
+#usr/lib/ldscripts/elf_x86_64.xn
+#usr/lib/ldscripts/elf_x86_64.xr
+#usr/lib/ldscripts/elf_x86_64.xs
+#usr/lib/ldscripts/elf_x86_64.xsc
+#usr/lib/ldscripts/elf_x86_64.xsw
+#usr/lib/ldscripts/elf_x86_64.xu
+#usr/lib/ldscripts/elf_x86_64.xw
+#usr/lib/ldscripts/i386linux.x
+#usr/lib/ldscripts/i386linux.xbn
+#usr/lib/ldscripts/i386linux.xn
+#usr/lib/ldscripts/i386linux.xr
+#usr/lib/ldscripts/i386linux.xu
+usr/lib/libbfd-2.25.1.so
 #usr/lib/libbfd.a
 #usr/lib/libbfd.la
-#usr/lib/libbfd.so
-#usr/lib/libiberty.a
-usr/lib/libopcodes-2.24.so
+usr/lib/libbfd.so
+usr/lib/libopcodes-2.25.1.so
 #usr/lib/libopcodes.a
 #usr/lib/libopcodes.la
-#usr/lib/libopcodes.so
+usr/lib/libopcodes.so
 #usr/share/info/as.info
 #usr/share/info/bfd.info
 #usr/share/info/binutils.info
-#usr/share/info/configure.info
 #usr/share/info/dir
 #usr/share/info/gprof.info
 #usr/share/info/ld.info
-#usr/share/info/standards.info
 #usr/share/man/man1/addr2line.1
 #usr/share/man/man1/ar.1
 #usr/share/man/man1/as.1
diff --git a/config/rootfiles/common/i586/binutils b/config/rootfiles/common/i586/binutils
index 5f4c113..bceda99 100644
--- a/config/rootfiles/common/i586/binutils
+++ b/config/rootfiles/common/i586/binutils
@@ -19,6 +19,7 @@
 #usr/include/bfdlink.h
 #usr/include/dis-asm.h
 #usr/include/libiberty.h
+#usr/include/plugin-api.h
 #usr/include/symcat.h
 #usr/lib/ldscripts
 #usr/lib/ldscripts/elf32_x86_64.x
@@ -91,23 +92,20 @@
 #usr/lib/ldscripts/i386linux.xn
 #usr/lib/ldscripts/i386linux.xr
 #usr/lib/ldscripts/i386linux.xu
-usr/lib/libbfd-2.24.so
+usr/lib/libbfd-2.25.1.so
 #usr/lib/libbfd.a
 #usr/lib/libbfd.la
-#usr/lib/libbfd.so
-#usr/lib/libiberty.a
-usr/lib/libopcodes-2.24.so
+usr/lib/libbfd.so
+usr/lib/libopcodes-2.25.1.so
 #usr/lib/libopcodes.a
 #usr/lib/libopcodes.la
-#usr/lib/libopcodes.so
+usr/lib/libopcodes.so
 #usr/share/info/as.info
 #usr/share/info/bfd.info
 #usr/share/info/binutils.info
-#usr/share/info/configure.info
 #usr/share/info/dir
 #usr/share/info/gprof.info
 #usr/share/info/ld.info
-#usr/share/info/standards.info
 #usr/share/man/man1/addr2line.1
 #usr/share/man/man1/ar.1
 #usr/share/man/man1/as.1
diff --git a/config/rootfiles/common/x86_64/binutils b/config/rootfiles/common/x86_64/binutils
index bb0bf9b..bceda99 100644
--- a/config/rootfiles/common/x86_64/binutils
+++ b/config/rootfiles/common/x86_64/binutils
@@ -19,6 +19,7 @@
 #usr/include/bfdlink.h
 #usr/include/dis-asm.h
 #usr/include/libiberty.h
+#usr/include/plugin-api.h
 #usr/include/symcat.h
 #usr/lib/ldscripts
 #usr/lib/ldscripts/elf32_x86_64.x
@@ -91,23 +92,20 @@
 #usr/lib/ldscripts/i386linux.xn
 #usr/lib/ldscripts/i386linux.xr
 #usr/lib/ldscripts/i386linux.xu
-#usr/lib/libbfd-2.24.so
+usr/lib/libbfd-2.25.1.so
 #usr/lib/libbfd.a
 #usr/lib/libbfd.la
-#usr/lib/libbfd.so
-#usr/lib/libiberty.a
-#usr/lib/libopcodes-2.24.so
+usr/lib/libbfd.so
+usr/lib/libopcodes-2.25.1.so
 #usr/lib/libopcodes.a
 #usr/lib/libopcodes.la
-#usr/lib/libopcodes.so
+usr/lib/libopcodes.so
 #usr/share/info/as.info
 #usr/share/info/bfd.info
 #usr/share/info/binutils.info
-#usr/share/info/configure.info
 #usr/share/info/dir
 #usr/share/info/gprof.info
 #usr/share/info/ld.info
-#usr/share/info/standards.info
 #usr/share/man/man1/addr2line.1
 #usr/share/man/man1/ar.1
 #usr/share/man/man1/as.1
diff --git a/lfs/binutils b/lfs/binutils
index 5afaeec..781f1be 100644
--- a/lfs/binutils
+++ b/lfs/binutils
@@ -24,10 +24,10 @@
 
 include Config
 
-VER        = 2.24
+VER        = 2.25.1
 
 THISAPP    = binutils-$(VER)
-DL_FILE    = $(THISAPP).tar.bz2
+DL_FILE    = $(THISAPP).tar.gz
 DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
@@ -92,7 +92,7 @@ objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = e0f71a7b2ddab0f8612336ac81d9636b
+$(DL_FILE)_MD5 = ace2b75f6240f566a6c42a1bdacf30bf
 
 install : $(TARGET)
 
@@ -121,8 +121,10 @@ $(subst %,%_MD5,$(objects)) :
 
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
-	@rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils-2.24-pt-pax-flags-20131231.patch
+	@rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils-2.25.1-pt-pax-flags-20150727.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils_ld-poison-system-directories.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/binutils_generate-gnu-hash.patch
 
 	@mkdir $(DIR_SRC)/binutils-build
 
diff --git a/src/patches/binutils-2.24-pt-pax-flags-20131231.patch b/src/patches/binutils-2.25.1-pt-pax-flags-20150727.patch
similarity index 77%
rename from src/patches/binutils-2.24-pt-pax-flags-20131231.patch
rename to src/patches/binutils-2.25.1-pt-pax-flags-20150727.patch
index cfb2035..c20d1e8 100644
--- a/src/patches/binutils-2.24-pt-pax-flags-20131231.patch
+++ b/src/patches/binutils-2.25.1-pt-pax-flags-20150727.patch
@@ -1,6 +1,6 @@
---- binutils-2.24/bfd/elf-bfd.h
-+++ binutils-2.24/bfd/elf-bfd.h
-@@ -1577,6 +1577,9 @@ struct elf_obj_tdata
+--- binutils-2.25.1/bfd/elf-bfd.h
++++ binutils-2.25.1/bfd/elf-bfd.h
+@@ -1558,6 +1558,9 @@ struct output_elf_obj_tdata
    /* Segment flags for the PT_GNU_STACK segment.  */
    unsigned int stack_flags;
  
@@ -10,7 +10,7 @@
    /* This is set to TRUE if the object was created by the backend
       linker.  */
    bfd_boolean linker;
-@@ -1707,6 +1707,7 @@
+@@ -1703,6 +1706,7 @@ struct elf_obj_tdata
  #define elf_eh_frame_hdr(bfd)	(elf_tdata(bfd) -> o->eh_frame_hdr)
  #define elf_linker(bfd)		(elf_tdata(bfd) -> o->linker)
  #define elf_stack_flags(bfd)	(elf_tdata(bfd) -> o->stack_flags)
@@ -18,9 +18,9 @@
  #define elf_shstrtab(bfd)	(elf_tdata(bfd) -> o->strtab_ptr)
  #define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
  #define elf_symtab_shndx(bfd)	(elf_tdata(bfd) -> symtab_shndx_section)
---- binutils-2.24/bfd/elf.c
-+++ binutils-2.24/bfd/elf.c
-@@ -1158,6 +1158,7 @@ get_segment_type (unsigned int p_type)
+--- binutils-2.25.1/bfd/elf.c
++++ binutils-2.25.1/bfd/elf.c
+@@ -1151,6 +1151,7 @@ get_segment_type (unsigned int p_type)
      case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
      case PT_GNU_STACK: pt = "STACK"; break;
      case PT_GNU_RELRO: pt = "RELRO"; break;
@@ -28,7 +28,7 @@
      default: pt = NULL; break;
      }
    return pt;
-@@ -2477,6 +2478,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index)
+@@ -2498,6 +2499,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index)
      case PT_GNU_RELRO:
        return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro");
  
@@ -38,7 +38,7 @@
      default:
        /* Check for any processor-specific program segment types.  */
        bed = get_elf_backend_data (abfd);
-@@ -3551,6 +3555,11 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
+@@ -3590,6 +3594,11 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
        ++segs;
      }
  
@@ -50,7 +50,7 @@
    for (s = abfd->sections; s != NULL; s = s->next)
      {
        if ((s->flags & SEC_LOAD) != 0
-@@ -4153,6 +4162,20 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
+@@ -4226,6 +4235,20 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
  	    }
  	}
  
@@ -69,9 +69,9 @@
 +    }
 +
        free (sections);
-       elf_tdata (abfd)->segment_map = mfirst;
+       elf_seg_map (abfd) = mfirst;
      }
-@@ -5417,7 +5440,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
+@@ -5584,7 +5607,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
         6. PT_TLS segment includes only SHF_TLS sections.
         7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
         8. PT_DYNAMIC should not contain empty sections at the beginning
@@ -81,7 +81,7 @@
  #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed)		\
    ((((segment->p_paddr							\
        ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr)	\
-@@ -5425,6 +5449,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
+@@ -5592,6 +5616,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
       && (section->flags & SEC_ALLOC) != 0)				\
      || IS_NOTE (segment, section))					\
     && segment->p_type != PT_GNU_STACK					\
@@ -89,9 +89,9 @@
     && (segment->p_type != PT_TLS					\
         || (section->flags & SEC_THREAD_LOCAL))				\
     && (segment->p_type == PT_LOAD					\
---- binutils-2.24/bfd/elflink.c
-+++ binutils-2.24/bfd/elflink.c
-@@ -5545,17 +5545,30 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
+--- binutils-2.25.1/bfd/elflink.c
++++ binutils-2.25.1/bfd/elflink.c
+@@ -5563,18 +5563,31 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
        && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
      return FALSE;
  
@@ -124,8 +124,8 @@
 +      elf_pax_flags (output_bfd) |= PF_NOEMUTRAMP;
        for (inputobj = info->input_bfds;
  	   inputobj;
- 	   inputobj = inputobj->link_next)
-@@ -5567,7 +5581,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
+ 	   inputobj = inputobj->link.next)
+@@ -5601,7 +5601,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
  	  if (s)
  	    {
  	      if (s->flags & SEC_CODE)
@@ -138,9 +138,9 @@
  	      notesec = s;
  	    }
  	  else if (bed->default_execstack)
---- binutils-2.24/binutils/readelf.c
-+++ binutils-2.24/binutils/readelf.c
-@@ -2740,6 +2740,7 @@ get_segment_type (unsigned long p_type)
+--- binutils-2.25.1/binutils/readelf.c
++++ binutils-2.25.1/binutils/readelf.c
+@@ -3262,6 +3262,7 @@ get_segment_type (unsigned long p_type)
  			return "GNU_EH_FRAME";
      case PT_GNU_STACK:	return "GNU_STACK";
      case PT_GNU_RELRO:  return "GNU_RELRO";
@@ -148,9 +148,9 @@
  
      default:
        if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
---- binutils-2.24/include/bfdlink.h
-+++ binutils-2.24/include/bfdlink.h
-@@ -322,6 +322,14 @@ struct bfd_link_info
+--- binutils-2.25.1/include/bfdlink.h
++++ binutils-2.25.1/include/bfdlink.h
+@@ -339,6 +339,14 @@ struct bfd_link_info
    /* TRUE if PT_GNU_RELRO segment should be created.  */
    unsigned int relro: 1;
  
@@ -165,9 +165,9 @@
    /* TRUE if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
       should be created.  */
    unsigned int eh_frame_hdr: 1;
---- binutils-2.24/include/elf/common.h
-+++ binutils-2.24/include/elf/common.h
-@@ -429,6 +429,7 @@
+--- binutils-2.25.1/include/elf/common.h
++++ binutils-2.25.1/include/elf/common.h
+@@ -434,6 +434,7 @@
  #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
  #define PT_GNU_STACK	(PT_LOOS + 0x474e551) /* Stack flags */
  #define PT_GNU_RELRO	(PT_LOOS + 0x474e552) /* Read-only after relocation */
@@ -175,7 +175,7 @@
  
  /* Program segment permissions, in program header p_flags field.  */
  
-@@ -439,6 +440,21 @@
+@@ -444,6 +445,21 @@
  #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
  #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
  
@@ -197,9 +197,9 @@
  /* Values for section header, sh_type field.  */
  
  #define SHT_NULL	0		/* Section header table entry unused */
---- binutils-2.24/ld/emultempl/elf32.em
-+++ binutils-2.24/ld/emultempl/elf32.em
-@@ -2285,6 +2285,16 @@ fragment <<EOF
+--- binutils-2.25.1/ld/emultempl/elf32.em
++++ binutils-2.25.1/ld/emultempl/elf32.em
+@@ -2276,6 +2276,16 @@ fragment <<EOF
  	  link_info.noexecstack = TRUE;
  	  link_info.execstack = FALSE;
  	}
@@ -216,7 +216,7 @@
  EOF
  if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
  fragment <<EOF
-@@ -2368,6 +2378,8 @@ fragment <<EOF
+@@ -2395,6 +2405,8 @@ fragment <<EOF
    -z defs                     Report unresolved symbols in object files.\n"));
    fprintf (file, _("\
    -z execstack                Mark executable as requiring executable stack\n"));
@@ -225,7 +225,7 @@
  EOF
  
  if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
-@@ -2391,6 +2403,8 @@ fragment <<EOF
+@@ -2439,6 +2451,8 @@ fi
  fragment <<EOF
    fprintf (file, _("\
    -z noexecstack              Mark executable as not requiring executable stack\n"));
@@ -234,9 +234,9 @@
  EOF
  if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
  fragment <<EOF
---- binutils-2.24/ld/ldgram.y
-+++ binutils-2.24/ld/ldgram.y
-@@ -1119,6 +1119,8 @@ phdr_type:
+--- binutils-2.25.1/ld/ldgram.y
++++ binutils-2.25.1/ld/ldgram.y
+@@ -1235,6 +1235,8 @@ phdr_type:
  			    $$ = exp_intop (0x6474e550);
  			  else if (strcmp (s, "PT_GNU_STACK") == 0)
  			    $$ = exp_intop (0x6474e551);
@@ -245,8 +245,8 @@
  			  else
  			    {
  			      einfo (_("\
---- binutils-2.24/ld/testsuite/ld-alpha/tlsbin.rd
-+++ binutils-2.24/ld/testsuite/ld-alpha/tlsbin.rd
+--- binutils-2.25.1/ld/testsuite/ld-alpha/tlsbin.rd
++++ binutils-2.25.1/ld/testsuite/ld-alpha/tlsbin.rd
 @@ -35,13 +35,14 @@ There are [0-9]+ program headers, starting at offset [0-9]+
  
  Program Headers:
@@ -263,8 +263,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 3 entries:
---- binutils-2.24/ld/testsuite/ld-alpha/tlsbinr.rd
-+++ binutils-2.24/ld/testsuite/ld-alpha/tlsbinr.rd
+--- binutils-2.25.1/ld/testsuite/ld-alpha/tlsbinr.rd
++++ binutils-2.25.1/ld/testsuite/ld-alpha/tlsbinr.rd
 @@ -42,6 +42,7 @@ Program Headers:
   +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ RWE 0x10000
   +DYNAMIC +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ RW +0x8
@@ -273,8 +273,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
---- binutils-2.24/ld/testsuite/ld-alpha/tlspic.rd
-+++ binutils-2.24/ld/testsuite/ld-alpha/tlspic.rd
+--- binutils-2.25.1/ld/testsuite/ld-alpha/tlspic.rd
++++ binutils-2.25.1/ld/testsuite/ld-alpha/tlspic.rd
 @@ -38,6 +38,7 @@ Program Headers:
   +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ RWE 0x10000
   +DYNAMIC +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ RW +0x8
@@ -283,59 +283,59 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 7 entries:
---- binutils-2.24/ld/testsuite/ld-elf/eh1.d
-+++ binutils-2.24/ld/testsuite/ld-elf/eh1.d
-@@ -22,11 +22,11 @@ Contents of the .eh_frame section:
+--- binutils-2.25.1/ld/testsuite/ld-elf/eh1.d
++++ binutils-2.25.1/ld/testsuite/ld-elf/eh1.d
+@@ -23,11 +23,11 @@ Contents of the .eh_frame section:
    DW_CFA_nop
    DW_CFA_nop
  
--0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078..0+400078
--  DW_CFA_advance_loc: 0 to 0+400078
-+0+0018 0+001c 0+001c FDE cie=0+0000 pc=([0-9a-f]+)..\1
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078\.\.0+400090
+-  DW_CFA_advance_loc: 8 to 0+400080
++0+0018 0+001c 0+001c FDE cie=0+0000 pc=[0-9a-f.]+
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_offset: 16
    DW_CFA_offset: r6 \(rbp\) at cfa-16
--  DW_CFA_advance_loc: 0 to 0+400078
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-  DW_CFA_advance_loc: 8 to 0+400088
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_register: r6 \(rbp\)
  
  0+0038 ZERO terminator
---- binutils-2.24/ld/testsuite/ld-elf/eh2.d
-+++ binutils-2.24/ld/testsuite/ld-elf/eh2.d
-@@ -22,11 +22,11 @@ Contents of the .eh_frame section:
+--- binutils-2.25.1/ld/testsuite/ld-elf/eh2.d
++++ binutils-2.25.1/ld/testsuite/ld-elf/eh2.d
+@@ -23,11 +23,11 @@ Contents of the .eh_frame section:
    DW_CFA_nop
    DW_CFA_nop
  
--0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078..0+400078
--  DW_CFA_advance_loc: 0 to 0+400078
-+0+0018 0+001c 0+001c FDE cie=0+0000 pc=([0-9a-f]+)..\1
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078\.\.0+400090
+-  DW_CFA_advance_loc: 8 to 0+400080
++0+0018 0+001c 0+001c FDE cie=0+0000 pc=[0-9a-f.]+
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_offset: 16
    DW_CFA_offset: r6 \(rbp\) at cfa-16
--  DW_CFA_advance_loc: 0 to 0+400078
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-  DW_CFA_advance_loc: 8 to 0+400088
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_register: r6 \(rbp\)
  
  0+0038 ZERO terminator
---- binutils-2.24/ld/testsuite/ld-elf/eh3.d
-+++ binutils-2.24/ld/testsuite/ld-elf/eh3.d
-@@ -22,11 +22,11 @@ Contents of the .eh_frame section:
+--- binutils-2.25.1/ld/testsuite/ld-elf/eh3.d
++++ binutils-2.25.1/ld/testsuite/ld-elf/eh3.d
+@@ -23,11 +23,11 @@ Contents of the .eh_frame section:
    DW_CFA_nop
    DW_CFA_nop
  
--0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078..0+400078
--  DW_CFA_advance_loc: 0 to 0+400078
-+0+0018 0+001c 0+001c FDE cie=0+0000 pc=([0-9a-f]+)..\1
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+400078\.\.0+400090
+-  DW_CFA_advance_loc: 8 to 0+400080
++0+0018 0+001c 0+001c FDE cie=0+0000 pc=[0-9a-f.]+)
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_offset: 16
    DW_CFA_offset: r6 \(rbp\) at cfa-16
--  DW_CFA_advance_loc: 0 to 0+400078
-+  DW_CFA_advance_loc: 0 to [0-9a-f]+
+-  DW_CFA_advance_loc: 8 to 0+400088
++  DW_CFA_advance_loc: 8 to [0-9a-f]+
    DW_CFA_def_cfa_register: r6 \(rbp\)
  
  0+0038 ZERO terminator
---- binutils-2.24/ld/testsuite/ld-elf/orphan-region.d
-+++ binutils-2.24/ld/testsuite/ld-elf/orphan-region.d
+--- binutils-2.25.1/ld/testsuite/ld-elf/orphan-region.d
++++ binutils-2.25.1/ld/testsuite/ld-elf/orphan-region.d
 @@ -15,7 +15,9 @@
  Program Headers:
    Type.*
@@ -346,8 +346,8 @@
    Segment Sections...
     00     .text .rodata .moredata *
 +   01 +
---- binutils-2.24/ld/testsuite/ld-i386/tlsbin.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlsbin.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlsbin.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlsbin.rd
 @@ -44,6 +44,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -364,8 +364,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 9 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-i386/tlsbindesc.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlsbindesc.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlsbindesc.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlsbindesc.rd
 @@ -42,6 +42,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -382,8 +382,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 9 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-i386/tlsdesc.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlsdesc.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlsdesc.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlsdesc.rd
 @@ -39,6 +39,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -400,8 +400,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-i386/tlsgdesc.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlsgdesc.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlsgdesc.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlsgdesc.rd
 @@ -36,12 +36,14 @@ Program Headers:
   +LOAD.*
   +LOAD.*
@@ -417,8 +417,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-i386/tlsnopic.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlsnopic.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlsnopic.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlsnopic.rd
 @@ -37,6 +37,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -435,8 +435,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 20 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-i386/tlspic.rd
-+++ binutils-2.24/ld/testsuite/ld-i386/tlspic.rd
+--- binutils-2.25.1/ld/testsuite/ld-i386/tlspic.rd
++++ binutils-2.25.1/ld/testsuite/ld-i386/tlspic.rd
 @@ -40,6 +40,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -453,8 +453,8 @@
  
  Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 26 entries:
   Offset +Info +Type +Sym.Value +Sym. Name
---- binutils-2.24/ld/testsuite/ld-ia64/merge1.d
-+++ binutils-2.24/ld/testsuite/ld-ia64/merge1.d
+--- binutils-2.25.1/ld/testsuite/ld-ia64/merge1.d
++++ binutils-2.25.1/ld/testsuite/ld-ia64/merge1.d
 @@ -4,7 +4,7 @@
  #objdump: -d
  
@@ -464,8 +464,8 @@
  [ 	]*[a-f0-9]+:	0b 60 80 02 00 24 	\[MMI\]       addl r12=32,r1;;
  [ 	]*[a-f0-9]+:	c0 c0 04 00 48 00 	            addl r12=24,r1
  [ 	]*[a-f0-9]+:	00 00 04 00       	            nop.i 0x0;;
---- binutils-2.24/ld/testsuite/ld-ia64/merge2.d
-+++ binutils-2.24/ld/testsuite/ld-ia64/merge2.d
+--- binutils-2.25.1/ld/testsuite/ld-ia64/merge2.d
++++ binutils-2.25.1/ld/testsuite/ld-ia64/merge2.d
 @@ -4,7 +4,7 @@
  #objdump: -d
  
@@ -475,8 +475,8 @@
  [ 	]*[a-f0-9]+:	0b 60 80 02 00 24 	\[MMI\]       addl r12=32,r1;;
  [ 	]*[a-f0-9]+:	c0 c0 04 00 48 00 	            addl r12=24,r1
  [ 	]*[a-f0-9]+:	00 00 04 00       	            nop.i 0x0;;
---- binutils-2.24/ld/testsuite/ld-ia64/merge3.d
-+++ binutils-2.24/ld/testsuite/ld-ia64/merge3.d
+--- binutils-2.25.1/ld/testsuite/ld-ia64/merge3.d
++++ binutils-2.25.1/ld/testsuite/ld-ia64/merge3.d
 @@ -4,7 +4,7 @@
  #objdump: -d
  
@@ -486,8 +486,8 @@
  [ 	]*[a-f0-9]+:	0b 60 80 02 00 24 	\[MMI\]       addl r12=32,r1;;
  [ 	]*[a-f0-9]+:	c0 40 05 00 48 00 	            addl r12=40,r1
  [ 	]*[a-f0-9]+:	00 00 04 00       	            nop.i 0x0;;
---- binutils-2.24/ld/testsuite/ld-ia64/merge4.d
-+++ binutils-2.24/ld/testsuite/ld-ia64/merge4.d
+--- binutils-2.25.1/ld/testsuite/ld-ia64/merge4.d
++++ binutils-2.25.1/ld/testsuite/ld-ia64/merge4.d
 @@ -4,7 +4,7 @@
  #objdump: -d
  
@@ -497,8 +497,8 @@
  [ 	]*[a-f0-9]+:	0b 60 80 02 00 24 	\[MMI\]       addl r12=32,r1;;
  [ 	]*[a-f0-9]+:	c0 40 05 00 48 00 	            addl r12=40,r1
  [ 	]*[a-f0-9]+:	00 00 04 00       	            nop.i 0x0;;
---- binutils-2.24/ld/testsuite/ld-ia64/merge5.d
-+++ binutils-2.24/ld/testsuite/ld-ia64/merge5.d
+--- binutils-2.25.1/ld/testsuite/ld-ia64/merge5.d
++++ binutils-2.25.1/ld/testsuite/ld-ia64/merge5.d
 @@ -4,7 +4,7 @@
  #objdump: -d
  
@@ -508,8 +508,8 @@
  [ 	]*[a-f0-9]+:	0b 60 80 02 00 24 	\[MMI\]       addl r12=32,r1;;
  [ 	]*[a-f0-9]+:	c0 40 05 00 48 00 	            addl r12=40,r1
  [ 	]*[a-f0-9]+:	00 00 04 00       	            nop.i 0x0;;
---- binutils-2.24/ld/testsuite/ld-ia64/tlsbin.rd
-+++ binutils-2.24/ld/testsuite/ld-ia64/tlsbin.rd
+--- binutils-2.25.1/ld/testsuite/ld-ia64/tlsbin.rd
++++ binutils-2.25.1/ld/testsuite/ld-ia64/tlsbin.rd
 @@ -36,13 +36,14 @@ There are [0-9]+ program headers, starting at offset [0-9]+
  
  Program Headers:
@@ -527,8 +527,8 @@
   +IA_64_UNWIND .* R +0x8
  #...
  
---- binutils-2.24/ld/testsuite/ld-ia64/tlspic.rd
-+++ binutils-2.24/ld/testsuite/ld-ia64/tlspic.rd
+--- binutils-2.25.1/ld/testsuite/ld-ia64/tlspic.rd
++++ binutils-2.25.1/ld/testsuite/ld-ia64/tlspic.rd
 @@ -40,6 +40,7 @@ Program Headers:
   +LOAD +0x0+1[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+0[0-9a-f]+ 0x0+0[0-9a-f]+ RW +0x10000
   +DYNAMIC +0x0+1[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+140 0x0+140 RW +0x8
@@ -537,23 +537,23 @@
   +IA_64_UNWIND +0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ 0x0+18 0x0+18 R +0x8
  #...
  
---- binutils-2.24/ld/testsuite/ld-mips-elf/multi-got-no-shared.d
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/multi-got-no-shared.d
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/multi-got-no-shared.d
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/multi-got-no-shared.d
 @@ -8,9 +8,9 @@
  .*: +file format.*
  
  Disassembly of section \.text:
--004000b0 <[^>]*> 3c1c0043 	lui	gp,0x43
--004000b4 <[^>]*> 279c9ff0 	addiu	gp,gp,-24592
--004000b8 <[^>]*> afbc0008 	sw	gp,8\(sp\)
-+004000d0 <[^>]*> 3c1c0043 	lui	gp,0x43
-+004000d4 <[^>]*> 279c9ff0 	addiu	gp,gp,-24592
-+004000d8 <[^>]*> afbc0008 	sw	gp,8\(sp\)
+-004000f0 <[^>]*> 3c1c0043 	lui	gp,0x43
+-004000f4 <[^>]*> 279c9ff0 	addiu	gp,gp,-24592
+-004000f8 <[^>]*> afbc0008 	sw	gp,8\(sp\)
++00400110 <[^>]*> 3c1c0043 	lui	gp,0x43
++00400114 <[^>]*> 279c9ff0 	addiu	gp,gp,-24592
++00400118 <[^>]*> afbc0008 	sw	gp,8\(sp\)
  #...
- 00408d60 <[^>]*> 3c1c0043 	lui	gp,0x43
- 00408d64 <[^>]*> 279c2c98 	addiu	gp,gp,11416
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.sd
+ 00408da0 <[^>]*> 3c1c0043 	lui	gp,0x43
+ 00408da4 <[^>]*> 279c2c98 	addiu	gp,gp,11416
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-3a.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is DYN \(Shared object file\)
@@ -566,7 +566,7 @@
 @@ -9,6 +9,7 @@ Program Headers:
   * LOAD * [^ ]+ * 0x0+00000 * 0x0+00000 [^ ]+ * [^ ]+ * R E * 0x.*
   * LOAD * [^ ]+ * 0x0+10000 * 0x0+10000 [^ ]+ * [^ ]+ * RW  * 0x.*
-  * DYNAMIC * [^ ]+ * 0x0+00400 * 0x0+00400 .*
+  * DYNAMIC * [^ ]+ * 0x0+00400 * 0x0+00400 [^ ]+ * [^ ]+ * R  * 0x.*
 + * PAX_FLAGS +0x0+ 0x0+ 0x0+ 0x0+ 0x0+ +0x[48]
   * NULL * .*
  
@@ -576,8 +576,8 @@
   *0*3 * \.dynamic *
   *0*4 *
 + *0*5 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -600,8 +600,8 @@
   *0*6 *\.dynamic *
   *0*7 *
 + *0*8 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -624,8 +624,8 @@
   *0*6 * \.dynamic *
   *0*7 *
 + *0*8 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -648,8 +648,8 @@
   *0*6 * \.dynamic *
   *0*7 *
 + *0*8 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -672,8 +672,8 @@
   *0*6 * \.dynamic *
   *0*7 *
 + *0*8 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -696,8 +696,8 @@
   *0*5 * \.dynamic *
   *0*6 *
 + *0*7 *
---- binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.sd
-+++ binutils-2.24/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.sd
+--- binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.sd
++++ binutils-2.25.1/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.sd
 @@ -1,7 +1,7 @@
  
  Elf file type is EXEC \(Executable file\)
@@ -720,8 +720,8 @@
   *0*6 * \.dynamic *
   *0*7 *
 + *0*8 *
---- binutils-2.24/ld/testsuite/ld-powerpc/tlsexe32.r
-+++ binutils-2.24/ld/testsuite/ld-powerpc/tlsexe32.r
+--- binutils-2.25.1/ld/testsuite/ld-powerpc/tlsexe32.r
++++ binutils-2.25.1/ld/testsuite/ld-powerpc/tlsexe32.r
 @@ -33,13 +33,14 @@ There are [0-9]+ program headers, starting at offset [0-9]+
  
  Program Headers:
@@ -732,7 +732,7 @@
 + +INTERP +0x000([0-9a-f]{3}) 0x01800\1 0x01800\1 0x00011 0x00011 R +0x1
   +\[Requesting program interpreter: .*\]
   +LOAD .* R E 0x10000
-  +LOAD .* RWE 0x10000
+  +LOAD .* RW +0x10000
   +DYNAMIC .* RW +0x4
   +TLS .* 0x0001c 0x00038 R +0x4
 + +PAX_FLAGS +0x0+ 0x0+ 0x0+ 0x0+ 0x0+ +0x[48]
@@ -747,10 +747,10 @@
  
  Relocation section '\.rela\.dyn' at offset .* contains 2 entries:
   Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-powerpc/tlsso32.r
-+++ binutils-2.24/ld/testsuite/ld-powerpc/tlsso32.r
+--- binutils-2.25.1/ld/testsuite/ld-powerpc/tlsso32.r
++++ binutils-2.25.1/ld/testsuite/ld-powerpc/tlsso32.r
 @@ -35,6 +35,7 @@ Program Headers:
-  +LOAD .* RWE 0x10000
+  +LOAD .* RW +0x10000
   +DYNAMIC .* RW +0x4
   +TLS .* 0x0+1c 0x0+38 R +0x4
 + +PAX_FLAGS +0x0+ 0x0+ 0x0+ 0x0+ 0x0+ +0x[48]
@@ -769,18 +769,18 @@
  [0-9a-f ]+R_PPC_TPREL16 +0+30 +le0 \+ 0
  [0-9a-f ]+R_PPC_TPREL16_HA +0+34 +le1 \+ 0
  [0-9a-f ]+R_PPC_TPREL16_LO +0+34 +le1 \+ 0
--[0-9a-f ]+R_PPC_TPREL16 +0+103d0 +\.tdata \+ 103e4
--[0-9a-f ]+R_PPC_TPREL16_HA +0+103d0 +\.tdata \+ 103e8
--[0-9a-f ]+R_PPC_TPREL16_LO +0+103d0 +\.tdata \+ 103e8
-+[0-9a-f ]+R_PPC_TPREL16 +0+103[df]0 +\.tdata \+ 10[0-9a-f]{3}
-+[0-9a-f ]+R_PPC_TPREL16_HA +0+103[df]0 +\.tdata \+ 10[0-9a-f]{3}
-+[0-9a-f ]+R_PPC_TPREL16_LO +0+103[df]0 +\.tdata \+ 10[0-9a-f]{3}
+-[0-9a-f ]+R_PPC_TPREL16 +0+10430 +\.tdata \+ 10444
+-[0-9a-f ]+R_PPC_TPREL16_HA +0+10430 +\.tdata \+ 10448
+-[0-9a-f ]+R_PPC_TPREL16_LO +0+10430 +\.tdata \+ 10448
++[0-9a-f ]+R_PPC_TPREL16 +0+104[34]0 +\.tdata \+ 10[0-9a-f]{3}
++[0-9a-f ]+R_PPC_TPREL16_HA +0+104[34]0 +\.tdata \+ 10[0-9a-f]{3}
++[0-9a-f ]+R_PPC_TPREL16_LO +0+104[34]0 +\.tdata \+ 10[0-9a-f]{3}
  [0-9a-f ]+R_PPC_DTPMOD32 +0
  [0-9a-f ]+R_PPC_DTPREL32 +0
  [0-9a-f ]+R_PPC_DTPMOD32 +0
---- binutils-2.24/ld/testsuite/ld-s390/tlsbin.rd
-+++ binutils-2.24/ld/testsuite/ld-s390/tlsbin.rd
-@@ -36,6 +36,7 @@ There are [0-9]+ program headers, starting at offset [0-9]+
+--- binutils-2.25.1/ld/testsuite/ld-s390/tlsbin.rd
++++ binutils-2.25.1/ld/testsuite/ld-s390/tlsbin.rd
+@@ -43,6 +43,7 @@ Program Headers:
   +LOAD .* RW +0x1000
   +DYNAMIC .* RW +0x4
   +TLS .* 0x0+60 0x0+a0 R +0x20
@@ -796,9 +796,9 @@
  
  Relocation section '.rela.dyn' at offset .* contains 4 entries:
   Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-s390/tlsbin_64.rd
-+++ binutils-2.24/ld/testsuite/ld-s390/tlsbin_64.rd
-@@ -36,6 +36,7 @@ There are [0-9]+ program headers, starting at offset [0-9]+
+--- binutils-2.25.1/ld/testsuite/ld-s390/tlsbin_64.rd
++++ binutils-2.25.1/ld/testsuite/ld-s390/tlsbin_64.rd
+@@ -43,6 +43,7 @@ Program Headers:
   +LOAD .* RW +0x1000
   +DYNAMIC .* RW +0x8
   +TLS .* 0x0+60 0x0+a0 R +0x20
@@ -814,8 +814,8 @@
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
   +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-s390/tlspic.rd
-+++ binutils-2.24/ld/testsuite/ld-s390/tlspic.rd
+--- binutils-2.25.1/ld/testsuite/ld-s390/tlspic.rd
++++ binutils-2.25.1/ld/testsuite/ld-s390/tlspic.rd
 @@ -39,6 +39,7 @@ Program Headers:
   +LOAD .* RW +0x1000
   +DYNAMIC .* RW +0x4
@@ -832,8 +832,8 @@
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
   Offset +Info +Type +Sym.Value +Sym. Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-s390/tlspic_64.rd
-+++ binutils-2.24/ld/testsuite/ld-s390/tlspic_64.rd
+--- binutils-2.25.1/ld/testsuite/ld-s390/tlspic_64.rd
++++ binutils-2.25.1/ld/testsuite/ld-s390/tlspic_64.rd
 @@ -39,6 +39,7 @@ Program Headers:
   +LOAD .* RW +0x1000
   +DYNAMIC .* RW +0x8
@@ -850,8 +850,8 @@
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
   +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-sh/tlsbin-2.d
-+++ binutils-2.24/ld/testsuite/ld-sh/tlsbin-2.d
+--- binutils-2.25.1/ld/testsuite/ld-sh/tlsbin-2.d
++++ binutils-2.25.1/ld/testsuite/ld-sh/tlsbin-2.d
 @@ -44,6 +44,7 @@ Program Headers:
   +LOAD.*
   +DYNAMIC.*
@@ -868,8 +868,8 @@
  
  Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
   Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-sh/tlspic-2.d
-+++ binutils-2.24/ld/testsuite/ld-sh/tlspic-2.d
+--- binutils-2.25.1/ld/testsuite/ld-sh/tlspic-2.d
++++ binutils-2.25.1/ld/testsuite/ld-sh/tlspic-2.d
 @@ -32,7 +32,7 @@ Key to Flags:
  
  Elf file type is DYN \(Shared object file\)
@@ -895,8 +895,8 @@
  
  Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 10 entries:
   Offset +Info +Type +Sym\.Value +Sym\. Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-sparc/gotop32.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/gotop32.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/gotop32.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/gotop32.rd
 @@ -31,6 +31,7 @@ Program Headers:
   +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x10000
   +LOAD +0x0+2000 0x0+12000 0x0+12000 0x0+2000 0x0+2000 RW +0x10000
@@ -905,8 +905,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/gotop64.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/gotop64.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/gotop64.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/gotop64.rd
 @@ -31,6 +31,7 @@ Program Headers:
   +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x100000
   +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+2000 0x0+2000 RW +0x100000
@@ -915,8 +915,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunbin32.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunbin32.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunbin32.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunbin32.rd
 @@ -30,13 +30,14 @@ There are [0-9]+ program headers, starting at offset [0-9]+
  
  Program Headers:
@@ -934,8 +934,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunbin64.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunbin64.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunbin64.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunbin64.rd
 @@ -30,13 +30,14 @@ There are [0-9]+ program headers, starting at offset [0-9]+
  
  Program Headers:
@@ -953,8 +953,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunnopic32.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunnopic32.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunnopic32.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunnopic32.rd
 @@ -32,6 +32,7 @@ Program Headers:
   +LOAD .* RW +0x10000
   +DYNAMIC .* RW +0x4
@@ -963,8 +963,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 12 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunnopic64.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunnopic64.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunnopic64.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunnopic64.rd
 @@ -32,6 +32,7 @@ Program Headers:
   +LOAD .* RW +0x100000
   +DYNAMIC .* RW +0x8
@@ -973,8 +973,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunpic32.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunpic32.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunpic32.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunpic32.rd
 @@ -36,6 +36,7 @@ Program Headers:
   +LOAD +0x0+2000 0x0+12000 0x0+12000 0x0+184 0x0+184 RWE 0x10000
   +DYNAMIC +0x0+2060 0x0+12060 0x0+12060 0x0+98 0x0+98 RW +0x4
@@ -983,8 +983,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
---- binutils-2.24/ld/testsuite/ld-sparc/tlssunpic64.rd
-+++ binutils-2.24/ld/testsuite/ld-sparc/tlssunpic64.rd
+--- binutils-2.25.1/ld/testsuite/ld-sparc/tlssunpic64.rd
++++ binutils-2.25.1/ld/testsuite/ld-sparc/tlssunpic64.rd
 @@ -36,6 +36,7 @@ Program Headers:
   +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+3a0 0x0+3a0 RWE 0x100000
   +DYNAMIC +0x0+2060 0x0+102060 0x0+102060 0x0+130 0x0+130 RW +0x8
@@ -993,8 +993,8 @@
  #...
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
---- binutils-2.24/ld/testsuite/ld-x86-64/tlsgdesc.rd
-+++ binutils-2.24/ld/testsuite/ld-x86-64/tlsgdesc.rd
+--- binutils-2.25.1/ld/testsuite/ld-x86-64/tlsgdesc.rd
++++ binutils-2.25.1/ld/testsuite/ld-x86-64/tlsgdesc.rd
 @@ -36,12 +36,14 @@ Program Headers:
   +LOAD.*
   +LOAD.*
@@ -1010,8 +1010,8 @@
  
  Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 8 entries:
   +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
---- binutils-2.24/ld/testsuite/ld-x86-64/tlspic.rd
-+++ binutils-2.24/ld/testsuite/ld-x86-64/tlspic.rd
+--- binutils-2.25.1/ld/testsuite/ld-x86-64/tlspic.rd
++++ binutils-2.25.1/ld/testsuite/ld-x86-64/tlspic.rd
 @@ -40,6 +40,7 @@ Program Headers:
   +LOAD +0x0+131a 0x0+20131a 0x0+20131a 0x0+246 0x0+246 RW +0x200000
   +DYNAMIC +0x0+1380 0x0+201380 0x0+201380 0x0+130 0x0+130 RW +0x8
diff --git a/src/patches/binutils_generate-gnu-hash.patch b/src/patches/binutils_generate-gnu-hash.patch
new file mode 100644
index 0000000..7bfc769
--- /dev/null
+++ b/src/patches/binutils_generate-gnu-hash.patch
@@ -0,0 +1,56 @@
+--- a/ld/emultempl/elf32.em
++++ b/ld/emultempl/elf32.em
+@@ -103,6 +103,19 @@
+ gld${EMULATION_NAME}_before_parse (void)
+ {
+   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
++EOF
++# Enable gnu hash by default for Linux (non-mips) targets.
++# This has been supported since glibc-2.5.
++case ${target} in
++  mips*) ;;
++  *-*-linux-* | *-*-gnu*)
++    fragment <<EOF
++  link_info.emit_hash = FALSE;
++  link_info.emit_gnu_hash = TRUE;
++EOF
++    ;;
++esac
++fragment <<EOF
+   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
+   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
+   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
+
+From 4826dc786682aaa0b51fd337edd0775296a82e93 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier(a)gentoo.org>
+Date: Sun, 3 Feb 2013 01:21:52 -0500
+Subject: [PATCH] gold: change default hash style to gnu
+
+Glibc first added .gnu.hash support to glibc-2.5 (released 29 Sep 2006),
+and gold was first released after that.  Let's default the gnu hash style
+to the new "gnu" rather than the classic sysv.
+
+Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
+
+2012-02-03  Mike Frysinger  <vapier(a)gentoo.org>
+
+	* options.h (General_options): Change default to gnu for hash_style.
+---
+ gold/options.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gold/options.h b/gold/options.h
+index c138fa2..4698ebd 100644
+--- a/gold/options.h
++++ b/gold/options.h
+@@ -809,7 +809,7 @@ class General_options
+ 		N_("Min fraction of empty buckets in dynamic hash"),
+ 		N_("FRACTION"));
+ 
+-  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv",
++  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu",
+ 	      N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
+ 	      {"sysv", "gnu", "both"});
+ 
+-- 
+1.8.0.2
diff --git a/src/patches/binutils_ld-poison-system-directories.patch b/src/patches/binutils_ld-poison-system-directories.patch
new file mode 100644
index 0000000..694fd5a
--- /dev/null
+++ b/src/patches/binutils_ld-poison-system-directories.patch
@@ -0,0 +1,330 @@
+From a83726f28779f99f17697e15b2ff8b69767f6fc7 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier(a)chromium.org>
+Date: Wed, 20 May 2015 07:09:14 -0400
+Subject: [PATCH] gold/ld: add support for poisoned system directories
+
+This is based on the old CodeSourcery patch written by Joseph Myers to add
+support to the link for detecting & rejecting bad -L paths when using a
+cross-compiler.  The differences here:
+* The command line flags are always available.
+* We can turn on & off the warning via the command line.
+* The configure option controls the default warning behavior.
+* Add support for gold.
+
+It is not currently upstream, nor has it been submitted at all.  There are
+no plans to do so currently either.
+
+BUG=chromium:488360
+TEST=`cbuildbot chromiumos-sdk` passes  # tests arm/amd64/mipsel/x86
+TEST=`cbuildbot panther_moblab-full whirlwind-release` pass
+TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures
+TEST=x86_64-cros-linux-gnu-ld throws warnings when using -L/lib (gold & bfd)
+
+Reviewed-on: https://chromium-review.googlesource.com/272083
+---
+ gold/options.cc | 33 +++++++++++++++++++++++++++++++++
+ gold/options.h  |  7 +++++++
+ ld/config.in    |  3 +++
+ ld/configure    | 14 ++++++++++++++
+ ld/configure.ac | 10 ++++++++++
+ ld/ld.h         |  7 +++++++
+ ld/ld.texinfo   | 18 ++++++++++++++++++
+ ld/ldfile.c     | 16 ++++++++++++++++
+ ld/ldlex.h      |  3 +++
+ ld/ldmain.c     |  7 +++++++
+ ld/lexsup.c     | 24 ++++++++++++++++++++++++
+ 11 files changed, 142 insertions(+)
+
+diff --git a/gold/options.cc b/gold/options.cc
+index 6b49459..0e26bb3 100644
+--- a/gold/options.cc
++++ b/gold/options.cc
+@@ -1201,6 +1201,39 @@ General_options::finalize()
+   // in the path, as appropriate.
+   this->add_sysroot();
+ 
++  // Now check if library_path is poisoned.
++  if (this->warn_poison_system_directories())
++    {
++      std::vector<std::string> bad_paths;
++
++      bad_paths.push_back("/lib");
++      // TODO: This check is disabled for now due to a bunch of packages that
++      // use libtool and relink with -L/usr/lib paths (albeit after the right
++      // sysroot path).  Once those are fixed we can enable.
++      // We also need to adjust it so it only rejects one or two levels deep.
++      // Gcc's internal paths also live below /usr/lib.
++      // http://crbug.com/488360
++      // bad_paths.push_back("/usr/lib");
++      bad_paths.push_back("/usr/local/lib");
++      bad_paths.push_back("/usr/X11R6/lib");
++
++      for (std::vector<std::string>::const_iterator b = bad_paths.begin();
++	   b != bad_paths.end();
++	   ++b)
++	for (Dir_list::iterator p = this->library_path_.value.begin();
++	     p != this->library_path_.value.end();
++	     ++p)
++	  if (!p->name().compare(0, b->size(), *b))
++	    {
++	      if (this->error_poison_system_directories())
++		gold_fatal(_("library search path \"%s\" is unsafe for "
++			     "cross-compilation"), p->name().c_str());
++	      else
++		gold_warning(_("library search path \"%s\" is unsafe for "
++			       "cross-compilation"), p->name().c_str());
++	    }
++    }
++
+   // --dynamic-list overrides -Bsymbolic and -Bsymbolic-functions.
+   if (this->have_dynamic_list())
+     {
+diff --git a/gold/options.h b/gold/options.h
+index 29e19af..f0d6200 100644
+--- a/gold/options.h
++++ b/gold/options.h
+@@ -1206,6 +1206,13 @@ class General_options
+   DEFINE_bool(warn_multiple_gp, options::TWO_DASHES, '\0', false,
+ 	      N_("Ignored"), NULL);
+ 
++  DEFINE_bool(warn_poison_system_directories, options::TWO_DASHES, '\0', false,
++	      N_("Warn for -L options using system directories"),
++	      N_("Do not warn for -L options using system directories"));
++  DEFINE_bool(error_poison_system_directories, options::TWO_DASHES, '\0', false,
++	      N_("Give an error for -L options using system directories"),
++	      NULL);
++
+   DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true,
+ 	      N_("Warn when skipping an incompatible library"),
+ 	      N_("Don't warn when skipping an incompatible library"));
+diff --git a/ld/config.in b/ld/config.in
+index f4a8a23..eec1187 100644
+--- a/ld/config.in
++++ b/ld/config.in
+@@ -11,6 +11,9 @@
+    language is requested. */
+ #undef ENABLE_NLS
+ 
++/* Define to warn for use of native system library directories */
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++
+ /* Additional extension a shared object might have. */
+ #undef EXTRA_SHLIB_EXTENSION
+ 
+diff --git a/ld/configure b/ld/configure
+index 63d17e2..eafcf9f 100755
+--- a/ld/configure
++++ b/ld/configure
+@@ -774,6 +774,7 @@ with_lib_path
+ enable_targets
+ enable_64_bit_bfd
+ with_sysroot
++enable_poison_system_directories
+ enable_gold
+ enable_got
+ enable_werror
+@@ -1429,6 +1430,8 @@ Optional Features:
+   --disable-largefile     omit support for large files
+   --enable-targets        alternative target configurations
+   --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
++  --enable-poison-system-directories
++                          warn for use of native system library directories
+   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
+   --enable-got=<type>     GOT handling scheme (target, single, negative,
+                           multigot)
+@@ -4339,7 +4342,18 @@ else
+ fi
+ 
+ 
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++  enableval=$enable_poison_system_directories;
++else
++  enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
+ 
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
+ 
+ # Check whether --enable-got was given.
+ if test "${enable_got+set}" = set; then :
+diff --git a/ld/configure.ac b/ld/configure.ac
+index 2af3dfc..ec33ac8 100644
+--- a/ld/configure.ac
++++ b/ld/configure.ac
+@@ -87,6 +87,16 @@ AC_SUBST(use_sysroot)
+ AC_SUBST(TARGET_SYSTEM_ROOT)
+ AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+ 
++AC_ARG_ENABLE([poison-system-directories],
++         AS_HELP_STRING([--enable-poison-system-directories],
++                [warn for use of native system library directories]),,
++         [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++  AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++       [1],
++       [Define to warn for use of native system library directories])
++fi
++
+ dnl Use --enable-gold to decide if this linker should be the default.
+ dnl "install_as_default" is set to false if gold is the default linker.
+ dnl "installed_linker" is the installed BFD linker name.
+diff --git a/ld/ld.h b/ld/ld.h
+index 4acb721..fe93731 100644
+--- a/ld/ld.h
++++ b/ld/ld.h
+@@ -180,6 +180,13 @@ typedef struct {
+   /* If TRUE we'll just print the default output on stdout.  */
+   bfd_boolean print_output_format;
+ 
++  /* If TRUE warn for uses of system directories when cross linking.  */
++  bfd_boolean warn_poison_system_directories;
++
++  /* If TRUE (default FALSE) give an error for uses of system
++     directories when cross linking instead of a warning.  */
++  bfd_boolean error_poison_system_directories;
++
+   /* Big or little endian as set on command line.  */
+   enum endian_enum endian;
+ 
+diff --git a/ld/ld.texinfo b/ld/ld.texinfo
+index 988e2d7..b2cecd4 100644
+--- a/ld/ld.texinfo
++++ b/ld/ld.texinfo
+@@ -2175,6 +2175,24 @@ string identifying the original linked file does not change.
+ 
+ Passing @code{none} for @var{style} disables the setting from any
+ @code{--build-id} options earlier on the command line.
++
++(a)kindex --warn-poison-system-directories
++(a)item --warn-poison-system-directories
++Warn for @option{-L} options using system directories such as
++(a)file{/usr/lib} when cross linking.  This option is intended for use
++in environments that want to detect and reject incorrect link settings.
++
++(a)kindex --no-warn-poison-system-directories
++(a)item --no-warn-poison-system-directories
++Do not warn for @option{-L} options using system directories such as
++(a)file{/usr/lib} when cross linking.  This option is intended for use
++in chroot environments when such directories contain the correct
++libraries for the target system rather than the host.
++
++(a)kindex --error-poison-system-directories
++(a)item --error-poison-system-directories
++Give an error instead of a warning for @option{-L} options using
++system directories when cross linking.
+ @end table
+ 
+ @c man end
+diff --git a/ld/ldfile.c b/ld/ldfile.c
+index 16baef8..0fa60d0 100644
+--- a/ld/ldfile.c
++++ b/ld/ldfile.c
+@@ -116,6 +116,26 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
+     new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
+   else
+     new_dirs->name = xstrdup (name);
++
++  if (command_line.warn_poison_system_directories
++      && (!strncmp (name, "/lib", 4)
++      /* TODO: This check is disabled for now due to a bunch of packages that
++       * use libtool and relink with -L/usr/lib paths (albeit after the right
++       * sysroot path).  Once those are fixed we can enable.
++       * We also need to adjust it so it only rejects one or two levels deep.
++       * Gcc's internal paths also live below /usr/lib.
++       * http://crbug.com/488360  */
++	  /* || !strncmp (name, "/usr/lib", 8) */
++	  || !strncmp (name, "/usr/local/lib", 14)
++	  || !strncmp (name, "/usr/X11R6/lib", 14)))
++    {
++      if (command_line.error_poison_system_directories)
++	einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
++	         "cross-compilation\n"), name);
++      else
++	einfo (_("%P: warning: library search path \"%s\" is unsafe for "
++	         "cross-compilation\n"), name);
++    }
+ }
+ 
+ /* Try to open a BFD for a lang_input_statement.  */
+diff --git a/ld/ldlex.h b/ld/ldlex.h
+index 99f4282..1395a32 100644
+--- a/ld/ldlex.h
++++ b/ld/ldlex.h
+@@ -138,6 +138,9 @@ enum option_values
+   OPTION_PRINT_OUTPUT_FORMAT,
+   OPTION_PRINT_SYSROOT,
+   OPTION_IGNORE_UNRESOLVED_SYMBOL,
++  OPTION_WARN_POISON_SYSTEM_DIRECTORIES,
++  OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES,
++  OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
+   OPTION_PUSH_STATE,
+   OPTION_POP_STATE,
+ };
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index 6a53667..0d40fa3 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -266,6 +266,13 @@ main (int argc, char **argv)
+   command_line.warn_mismatch = TRUE;
+   command_line.warn_search_mismatch = TRUE;
+   command_line.check_section_addresses = -1;
++  command_line.warn_poison_system_directories =
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++    TRUE;
++#else
++    FALSE;
++#endif
++  command_line.error_poison_system_directories = FALSE;
+ 
+   /* We initialize DEMANGLING based on the environment variable
+      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
+diff --git a/ld/lexsup.c b/ld/lexsup.c
+index 2f71750..1c6f5aa 100644
+--- a/ld/lexsup.c
++++ b/ld/lexsup.c
+@@ -507,6 +507,18 @@ static const struct ld_option ld_options[] =
+     OPTION_IGNORE_UNRESOLVED_SYMBOL},
+     '\0', N_("SYMBOL"),
+     N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
++  { {"warn-poison-system-directories", no_argument, NULL,
++     OPTION_WARN_POISON_SYSTEM_DIRECTORIES},
++    '\0', NULL, N_("Warn for -L options using system directories"),
++    TWO_DASHES },
++  { {"no-warn-poison-system-directories", no_argument, NULL,
++     OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES},
++    '\0', NULL, N_("Do not warn for -L options using system directories"),
++    TWO_DASHES },
++  { {"error-poison-system-directories", no_argument, NULL,
++     OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
++    '\0', NULL, N_("Give an error for -L options using system directories"),
++    TWO_DASHES },
+   { {"push-state", no_argument, NULL, OPTION_PUSH_STATE},
+     '\0', NULL, N_("Push state of flags governing input file handling"),
+     TWO_DASHES },
+@@ -1442,6 +1454,18 @@ parse_args (unsigned argc, char **argv)
+               einfo (_("%P%X: --hash-size needs a numeric argument\n"));
+           }
+           break;
++
++   case OPTION_WARN_POISON_SYSTEM_DIRECTORIES:
++     command_line.warn_poison_system_directories = TRUE;
++     break;
++
++   case OPTION_NO_WARN_POISON_SYSTEM_DIRECTORIES:
++     command_line.warn_poison_system_directories = FALSE;
++     break;
++
++   case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
++     command_line.error_poison_system_directories = TRUE;
++     break;
+ 
+ 	case OPTION_PUSH_STATE:
+ 	  input_flags.pushed = xmemdup (&input_flags,
+
+-- 
+2.4.1
+
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] grub: fix build fail
  2016-04-04  5:24 [PATCH 1/2] binutils: update to 2.25.1 Marcel Lorenz
@ 2016-04-04  5:24 ` Marcel Lorenz
  2016-04-04 11:51 ` [PATCH 1/2] binutils: update to 2.25.1 Arne Fitzenreiter
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Lorenz @ 2016-04-04  5:24 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Signed-off-by: Marcel Lorenz <marcel.lorenz(a)ipfire.org>

---
 lfs/grub | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lfs/grub b/lfs/grub
index ba74408..72b9551 100644
--- a/lfs/grub
+++ b/lfs/grub
@@ -100,8 +100,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	install -m 644 $(DIR_SRC)/config/grub2/default /etc/default/grub
 
 	# Disable hardening.
-	paxctl -mpes /usr/sbin/grub-bios-setup /usr/sbin/grub-probe
-	paxctl -mpexs /usr/bin/grub-script-check
+	paxctl -mpesc /usr/sbin/grub-bios-setup /usr/sbin/grub-probe
+	paxctl -mpexsc /usr/bin/grub-script-check
 
 	# We don't need to install unifont just to generate a grub2 compatible
 	# font archive for the graphical boot menu. The following command only
-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] binutils: update to 2.25.1
  2016-04-04  5:24 [PATCH 1/2] binutils: update to 2.25.1 Marcel Lorenz
  2016-04-04  5:24 ` [PATCH 2/2] grub: fix build fail Marcel Lorenz
@ 2016-04-04 11:51 ` Arne Fitzenreiter
  2016-04-05  5:21   ` Marcel Lorenz
  1 sibling, 1 reply; 5+ messages in thread
From: Arne Fitzenreiter @ 2016-04-04 11:51 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

On 2016-04-04 07:24, Marcel Lorenz wrote:
> Signed-off-by: Marcel Lorenz <marcel.lorenz(a)ipfire.org>
> 
The arm rootfiles contain intel files now! This patch is broken.

Toolchain parts are really critical and should intensive tested on
all arches before changing.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] binutils: update to 2.25.1
  2016-04-04 11:51 ` [PATCH 1/2] binutils: update to 2.25.1 Arne Fitzenreiter
@ 2016-04-05  5:21   ` Marcel Lorenz
  2016-04-05 11:10     ` Michael Tremer
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Lorenz @ 2016-04-05  5:21 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Hi,

sorry, can't test ARM. Have no Hardware. Can you correct the rootfile 
for me?
On i586, i have no problems with 2.25.1

Marcel

Am 2016-04-04 13:51, schrieb Arne Fitzenreiter:
> On 2016-04-04 07:24, Marcel Lorenz wrote:
>> Signed-off-by: Marcel Lorenz <marcel.lorenz(a)ipfire.org>
>> 
> The arm rootfiles contain intel files now! This patch is broken.
> 
> Toolchain parts are really critical and should intensive tested on
> all arches before changing.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] binutils: update to 2.25.1
  2016-04-05  5:21   ` Marcel Lorenz
@ 2016-04-05 11:10     ` Michael Tremer
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Tremer @ 2016-04-05 11:10 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

On Tue, 2016-04-05 at 07:21 +0200, Marcel Lorenz wrote:
> Hi,
> 
> sorry, can't test ARM. Have no Hardware. Can you correct the rootfile 
> for me?
> On i586, i have no problems with 2.25.1

There must still be issues when you have to modify lfs/grub to insert PaX
headers into the ELF header. That should not be necessary at all.

-Michael

> 
> Marcel
> 
> Am 2016-04-04 13:51, schrieb Arne Fitzenreiter:
> > 
> > On 2016-04-04 07:24, Marcel Lorenz wrote:
> > > 
> > > Signed-off-by: Marcel Lorenz <marcel.lorenz(a)ipfire.org>
> > > 
> > The arm rootfiles contain intel files now! This patch is broken.
> > 
> > Toolchain parts are really critical and should intensive tested on
> > all arches before changing.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-05 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04  5:24 [PATCH 1/2] binutils: update to 2.25.1 Marcel Lorenz
2016-04-04  5:24 ` [PATCH 2/2] grub: fix build fail Marcel Lorenz
2016-04-04 11:51 ` [PATCH 1/2] binutils: update to 2.25.1 Arne Fitzenreiter
2016-04-05  5:21   ` Marcel Lorenz
2016-04-05 11:10     ` Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox