binutils/binutils: fixup version strings
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Sep 11 18:26:12 2011 +0200 (2011-09-11)
changeset 26637179903f8d2e
parent 2662 e7266674d492
child 2664 346263a07115
binutils/binutils: fixup version strings

Recently, all binutils versions have been renamed after a GPL compliance
issue was found and fixed in binutils;
http://sourceware.org/ml/binutils/2011-08/msg00198.html

Old versions are no-longer available since the rename (eg. 2.19 has been
superseeded by 2.19.1, and only 2.19.1a was regenerated).

Remove now-missing versions.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/binutils/binutils.in
patches/binutils/2.19/100-ppc64-pie.patch
patches/binutils/2.19/110-RPATH_ENVVAR-smack.patch
patches/binutils/2.19/120-sh-targets.patch
patches/binutils/2.19/130-check_ldrunpath_length.patch
patches/binutils/2.19/140-pt-pax-flags-20081101.patch
patches/binutils/2.19/150-warn-textrel.patch
patches/binutils/2.19/160-use-new-ld-dtags.patch
patches/binutils/2.19/170-use-relro.patch
patches/binutils/2.19/180-libiberty-pic.patch
patches/binutils/2.20/100-ppc64-pie.patch
patches/binutils/2.20/110-RPATH_ENVVAR-smack.patch
patches/binutils/2.20/120-sh-targets.patch
patches/binutils/2.20/130-ld-sysroot.patch
patches/binutils/2.20/140-check_ldrunpath_length.patch
patches/binutils/2.20/150-pt-pax-flags-20090909.patch
patches/binutils/2.20/160-amd64-32bit-path.patch
patches/binutils/2.20/170-warn-textrel.patch
patches/binutils/2.20/180-only-use-new-ld-dtags.patch.disabled
patches/binutils/2.20/190-use-new-ld-dtags.patch
patches/binutils/2.20/200-document-new-dtags-behaviour.patch
patches/binutils/2.20/220-use-relro.patch
patches/binutils/2.20/230-libiberty-pic.patch
patches/binutils/2.20/240-ld_makefile.patch
patches/binutils/2.20/250-arm-eabi-conf.patch
patches/binutils/2.20/260-arm-non-empty-know.patch
patches/binutils/2.20/270-better_file_error.patch
patches/binutils/2.20/280-unexport_LD_LIBRARY_PATH.patch
patches/binutils/2.20/290-ld-stub-crash.patch
patches/binutils/2.20/300-mips64-defaultemul.patch
     1.1 --- a/config/binutils/binutils.in	Sun Sep 11 18:28:45 2011 +0200
     1.2 +++ b/config/binutils/binutils.in	Sun Sep 11 18:26:12 2011 +0200
     1.3 @@ -8,32 +8,16 @@
     1.4  # Don't remove next line
     1.5  # CT_INSERT_VERSION_BELOW
     1.6  
     1.7 -config BINUTILS_V_2_21
     1.8 -    bool
     1.9 -    depends on EXPERIMENTAL
    1.10 -    prompt "2.21"
    1.11 -    select BINUTILS_2_21_or_later
    1.12 -
    1.13  config BINUTILS_V_2_20_1
    1.14      bool
    1.15      prompt "2.20.1"
    1.16      select BINUTILS_2_20_or_later
    1.17  
    1.18 -config BINUTILS_V_2_20
    1.19 -    bool
    1.20 -    prompt "2.20"
    1.21 -    select BINUTILS_2_20_or_later
    1.22 -
    1.23  config BINUTILS_V_2_19_1
    1.24      bool
    1.25      prompt "2.19.1"
    1.26      select BINUTILS_2_19_or_later
    1.27  
    1.28 -config BINUTILS_V_2_19
    1.29 -    bool
    1.30 -    prompt "2.19"
    1.31 -    select BINUTILS_2_19_or_later
    1.32 -
    1.33  config BINUTILS_V_2_18
    1.34      bool
    1.35      prompt "2.18"
    1.36 @@ -55,11 +39,8 @@
    1.37      string
    1.38  # Don't remove next line
    1.39  # CT_INSERT_VERSION_STRING_BELOW
    1.40 -    default "2.21" if BINUTILS_V_2_21
    1.41      default "2.20.1" if BINUTILS_V_2_20_1
    1.42 -    default "2.20" if BINUTILS_V_2_20
    1.43      default "2.19.1" if BINUTILS_V_2_19_1
    1.44 -    default "2.19" if BINUTILS_V_2_19
    1.45      default "2.18" if BINUTILS_V_2_18
    1.46      default "2.17" if BINUTILS_V_2_17
    1.47      default "2.16.1" if BINUTILS_V_2_16_1
     2.1 --- a/patches/binutils/2.19/100-ppc64-pie.patch	Sun Sep 11 18:28:45 2011 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,20 +0,0 @@
     2.4 -Original patch from Gentoo:
     2.5 -gentoo/src/patchsets/binutils/2.19/03_all_binutils-2.15.92.0.2-ppc64-pie.patch
     2.6 -
     2.7 -diff -durN binutils-2.19.orig/bfd/elf64-ppc.c binutils-2.19/bfd/elf64-ppc.c
     2.8 ---- binutils-2.19.orig/bfd/elf64-ppc.c	2008-10-09 14:18:24.000000000 +0200
     2.9 -+++ binutils-2.19/bfd/elf64-ppc.c	2008-11-23 16:16:11.000000000 +0100
    2.10 -@@ -11294,7 +11294,12 @@
    2.11 - 	      else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
    2.12 - 		       && !is_opd
    2.13 - 		       && r_type != R_PPC64_TOC)
    2.14 --		outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
    2.15 -+		{
    2.16 -+		  outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
    2.17 -+		  if (h->elf.dynindx == -1
    2.18 -+		      && h->elf.root.type == bfd_link_hash_undefweak)
    2.19 -+		  memset (&outrel, 0, sizeof outrel);
    2.20 -+		}
    2.21 - 	      else
    2.22 - 		{
    2.23 - 		  /* This symbol is local, or marked to become local,
     3.1 --- a/patches/binutils/2.19/110-RPATH_ENVVAR-smack.patch	Sun Sep 11 18:28:45 2011 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,17 +0,0 @@
     3.4 -Original patch from Gentoo:
     3.5 -gentoo/src/patchsets/binutils/2.19/08_all_binutils-RPATH_ENVVAR-smack.patch
     3.6 -
     3.7 -http://sourceware.org/ml/binutils/2007-07/msg00401.html
     3.8 -http://sourceware.org/bugzilla/show_bug.cgi?id=4970
     3.9 -
    3.10 -diff -durN binutils-2.19.orig/configure binutils-2.19/configure
    3.11 ---- binutils-2.19.orig/configure	2008-09-04 04:18:16.000000000 +0200
    3.12 -+++ binutils-2.19/configure	2008-11-23 16:22:02.000000000 +0100
    3.13 -@@ -5601,6 +5601,7 @@
    3.14 -   *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
    3.15 -   *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
    3.16 - esac
    3.17 -+RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
    3.18 - 
    3.19 - # On systems where the dynamic library environment variable is PATH,
    3.20 - if test "$RPATH_ENVVAR" = PATH; then
     4.1 --- a/patches/binutils/2.19/120-sh-targets.patch	Sun Sep 11 18:28:45 2011 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,52 +0,0 @@
     4.4 -Original patch from Gentoo:
     4.5 -gentoo/src/patchsets/binutils/2.19/12_all_sh-targets.patch
     4.6 -
     4.7 -r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
     4.8 -
     4.9 -Likewise, binutils has no idea about any of these new targets either, so we
    4.10 -fix that up too.. now we're able to actually build a real toolchain for
    4.11 -sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
    4.12 -inept targets than that one, really. Go look, I promise).
    4.13 -
    4.14 -diff -durN binutils-2.19.orig/configure binutils-2.19/configure
    4.15 ---- binutils-2.19.orig/configure	2008-11-23 16:23:44.000000000 +0100
    4.16 -+++ binutils-2.19/configure	2008-11-23 16:23:57.000000000 +0100
    4.17 -@@ -2281,7 +2281,7 @@
    4.18 -   am33_2.0-*-linux*)
    4.19 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
    4.20 -     ;;
    4.21 --  sh-*-linux*)
    4.22 -+  sh*-*-linux*)
    4.23 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
    4.24 -     ;;
    4.25 -   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
    4.26 -@@ -2606,7 +2606,7 @@
    4.27 -   romp-*-*)
    4.28 -     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
    4.29 -     ;;
    4.30 --  sh-*-* | sh64-*-*)
    4.31 -+  sh*-*-* | sh64-*-*)
    4.32 -     case "${host}" in
    4.33 -       i[3456789]86-*-vsta) ;; # don't add gprof back in
    4.34 -       i[3456789]86-*-go32*) ;; # don't add gprof back in
    4.35 -diff -durN binutils-2.19.orig/configure.ac binutils-2.19/configure.ac
    4.36 ---- binutils-2.19.orig/configure.ac	2008-10-16 15:45:42.000000000 +0200
    4.37 -+++ binutils-2.19/configure.ac	2008-11-23 16:23:57.000000000 +0100
    4.38 -@@ -530,7 +530,7 @@
    4.39 -   am33_2.0-*-linux*)
    4.40 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
    4.41 -     ;;
    4.42 --  sh-*-linux*)
    4.43 -+  sh*-*-linux*)
    4.44 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
    4.45 -     ;;    
    4.46 -   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
    4.47 -@@ -855,7 +855,7 @@
    4.48 -   romp-*-*)
    4.49 -     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
    4.50 -     ;;
    4.51 --  sh-*-* | sh64-*-*)
    4.52 -+  sh*-*-* | sh64-*-*)
    4.53 -     case "${host}" in
    4.54 -       i[[3456789]]86-*-vsta) ;; # don't add gprof back in
    4.55 -       i[[3456789]]86-*-go32*) ;; # don't add gprof back in
     5.1 --- a/patches/binutils/2.19/130-check_ldrunpath_length.patch	Sun Sep 11 18:28:45 2011 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,31 +0,0 @@
     5.4 -Original patch from Gentoo:
     5.5 -gentoo/src/patchsets/binutils/2.19/42_all_012_check_ldrunpath_length.patch
     5.6 -
     5.7 -Originaly from Debian:
     5.8 -## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
     5.9 -##
    5.10 -## All lines beginning with `## DP:' are a description of the patch.
    5.11 -## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
    5.12 -## DP: cases where -rpath isn't specified. (#151024)
    5.13 -
    5.14 -diff -durN binutils-2.19.orig/ld/emultempl/elf32.em binutils-2.19/ld/emultempl/elf32.em
    5.15 ---- binutils-2.19.orig/ld/emultempl/elf32.em	2008-09-07 06:02:31.000000000 +0200
    5.16 -+++ binutils-2.19/ld/emultempl/elf32.em	2008-11-23 16:25:51.000000000 +0100
    5.17 -@@ -1219,6 +1219,8 @@
    5.18 - 	      && command_line.rpath == NULL)
    5.19 - 	    {
    5.20 - 	      lib_path = (const char *) getenv ("LD_RUN_PATH");
    5.21 -+	      if ((lib_path) && (strlen (lib_path) == 0))
    5.22 -+		  lib_path = NULL;
    5.23 - 	      if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
    5.24 - 						      force))
    5.25 - 		break;
    5.26 -@@ -1404,6 +1406,8 @@
    5.27 -   rpath = command_line.rpath;
    5.28 -   if (rpath == NULL)
    5.29 -     rpath = (const char *) getenv ("LD_RUN_PATH");
    5.30 -+  if ((rpath) && (strlen (rpath) == 0))
    5.31 -+      rpath = NULL;
    5.32 -   if (! (bfd_elf_size_dynamic_sections
    5.33 - 	 (link_info.output_bfd, command_line.soname, rpath,
    5.34 - 	  command_line.filter_shlib,
     6.1 --- a/patches/binutils/2.19/140-pt-pax-flags-20081101.patch	Sun Sep 11 18:28:45 2011 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,249 +0,0 @@
     6.4 -Original patch from Gentoo:
     6.5 -gentoo/src/patchsets/binutils/2.19/63_all_binutils-2.19-pt-pax-flags-20081101.patch
     6.6 -
     6.7 -diff -durN binutils-2.19.orig/bfd/elf-bfd.h binutils-2.19/bfd/elf-bfd.h
     6.8 ---- binutils-2.19.orig/bfd/elf-bfd.h	2008-08-21 01:28:58.000000000 +0200
     6.9 -+++ binutils-2.19/bfd/elf-bfd.h	2008-11-23 16:31:09.000000000 +0100
    6.10 -@@ -1526,6 +1526,9 @@
    6.11 -   /* Segment flags for the PT_GNU_STACK segment.  */
    6.12 -   unsigned int stack_flags;
    6.13 - 
    6.14 -+  /* Segment flags for the PT_PAX_FLAGS segment.  */
    6.15 -+  unsigned int pax_flags;
    6.16 -+
    6.17 -   /* Symbol version definitions in external objects.  */
    6.18 -   Elf_Internal_Verdef *verdef;
    6.19 - 
    6.20 -diff -durN binutils-2.19.orig/bfd/elf.c binutils-2.19/bfd/elf.c
    6.21 ---- binutils-2.19.orig/bfd/elf.c	2008-10-09 14:18:23.000000000 +0200
    6.22 -+++ binutils-2.19/bfd/elf.c	2008-11-23 16:31:09.000000000 +0100
    6.23 -@@ -1136,6 +1136,7 @@
    6.24 -     case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
    6.25 -     case PT_GNU_STACK: pt = "STACK"; break;
    6.26 -     case PT_GNU_RELRO: pt = "RELRO"; break;
    6.27 -+    case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
    6.28 -     default: pt = NULL; break;
    6.29 -     }
    6.30 -   return pt;
    6.31 -@@ -2442,6 +2443,9 @@
    6.32 -     case PT_GNU_RELRO:
    6.33 -       return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
    6.34 - 
    6.35 -+    case PT_PAX_FLAGS:
    6.36 -+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
    6.37 -+
    6.38 -     default:
    6.39 -       /* Check for any processor-specific program segment types.  */
    6.40 -       bed = get_elf_backend_data (abfd);
    6.41 -@@ -3404,6 +3408,11 @@
    6.42 -       ++segs;
    6.43 -     }
    6.44 - 
    6.45 -+    {
    6.46 -+      /* We need a PT_PAX_FLAGS segment.  */
    6.47 -+      ++segs;
    6.48 -+    }
    6.49 -+
    6.50 -   for (s = abfd->sections; s != NULL; s = s->next)
    6.51 -     {
    6.52 -       if ((s->flags & SEC_LOAD) != 0
    6.53 -@@ -3983,6 +3992,20 @@
    6.54 - 	    }
    6.55 - 	}
    6.56 - 
    6.57 -+    {
    6.58 -+      amt = sizeof (struct elf_segment_map);
    6.59 -+      m = bfd_zalloc (abfd, amt);
    6.60 -+      if (m == NULL)
    6.61 -+	goto error_return;
    6.62 -+      m->next = NULL;
    6.63 -+      m->p_type = PT_PAX_FLAGS;
    6.64 -+      m->p_flags = elf_tdata (abfd)->pax_flags;
    6.65 -+      m->p_flags_valid = 1;
    6.66 -+
    6.67 -+      *pm = m;
    6.68 -+      pm = &m->next;
    6.69 -+    }
    6.70 -+
    6.71 -       free (sections);
    6.72 -       elf_tdata (abfd)->segment_map = mfirst;
    6.73 -     }
    6.74 -@@ -5173,7 +5196,8 @@
    6.75 -        6. PT_TLS segment includes only SHF_TLS sections.
    6.76 -        7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
    6.77 -        8. PT_DYNAMIC should not contain empty sections at the beginning
    6.78 --	  (with the possible exception of .dynamic).  */
    6.79 -+	  (with the possible exception of .dynamic).
    6.80 -+       9. PT_PAX_FLAGS segments does not include any sections.  */
    6.81 - #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed)		\
    6.82 -   ((((segment->p_paddr							\
    6.83 -       ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr)	\
    6.84 -@@ -5181,6 +5205,7 @@
    6.85 -      && (section->flags & SEC_ALLOC) != 0)				\
    6.86 -     || IS_NOTE (segment, section))					\
    6.87 -    && segment->p_type != PT_GNU_STACK					\
    6.88 -+   && segment->p_type != PT_PAX_FLAGS					\
    6.89 -    && (segment->p_type != PT_TLS					\
    6.90 -        || (section->flags & SEC_THREAD_LOCAL))				\
    6.91 -    && (segment->p_type == PT_LOAD					\
    6.92 -diff -durN binutils-2.19.orig/bfd/elflink.c binutils-2.19/bfd/elflink.c
    6.93 ---- binutils-2.19.orig/bfd/elflink.c	2008-08-22 10:32:39.000000000 +0200
    6.94 -+++ binutils-2.19/bfd/elflink.c	2008-11-23 16:31:09.000000000 +0100
    6.95 -@@ -5397,16 +5397,30 @@
    6.96 -     return TRUE;
    6.97 - 
    6.98 -   bed = get_elf_backend_data (output_bfd);
    6.99 -+  elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
   6.100 -+
   6.101 -+  if (info->execheap)
   6.102 -+    elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
   6.103 -+  else if (info->noexecheap)
   6.104 -+    elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
   6.105 -+
   6.106 -   if (info->execstack)
   6.107 --    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
   6.108 -+    {
   6.109 -+      elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
   6.110 -+      elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
   6.111 -+    }
   6.112 -   else if (info->noexecstack)
   6.113 --    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
   6.114 -+    {
   6.115 -+      elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
   6.116 -+      elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
   6.117 -+    }
   6.118 -   else
   6.119 -     {
   6.120 -       bfd *inputobj;
   6.121 -       asection *notesec = NULL;
   6.122 -       int exec = 0;
   6.123 - 
   6.124 -+      elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
   6.125 -       for (inputobj = info->input_bfds;
   6.126 - 	   inputobj;
   6.127 - 	   inputobj = inputobj->link_next)
   6.128 -@@ -5419,7 +5433,11 @@
   6.129 - 	  if (s)
   6.130 - 	    {
   6.131 - 	      if (s->flags & SEC_CODE)
   6.132 --		exec = PF_X;
   6.133 -+		{
   6.134 -+		  elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
   6.135 -+		  elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
   6.136 -+		  exec = PF_X;
   6.137 -+		}
   6.138 - 	      notesec = s;
   6.139 - 	    }
   6.140 - 	  else if (bed->default_execstack)
   6.141 -diff -durN binutils-2.19.orig/binutils/readelf.c binutils-2.19/binutils/readelf.c
   6.142 ---- binutils-2.19.orig/binutils/readelf.c	2008-09-17 11:00:44.000000000 +0200
   6.143 -+++ binutils-2.19/binutils/readelf.c	2008-11-23 16:31:09.000000000 +0100
   6.144 -@@ -2505,6 +2505,7 @@
   6.145 - 			return "GNU_EH_FRAME";
   6.146 -     case PT_GNU_STACK:	return "GNU_STACK";
   6.147 -     case PT_GNU_RELRO:  return "GNU_RELRO";
   6.148 -+    case PT_PAX_FLAGS:  return "PAX_FLAGS";
   6.149 - 
   6.150 -     default:
   6.151 -       if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
   6.152 -diff -durN binutils-2.19.orig/include/bfdlink.h binutils-2.19/include/bfdlink.h
   6.153 ---- binutils-2.19.orig/include/bfdlink.h	2008-08-17 05:12:50.000000000 +0200
   6.154 -+++ binutils-2.19/include/bfdlink.h	2008-11-23 16:31:09.000000000 +0100
   6.155 -@@ -319,6 +319,14 @@
   6.156 -   /* TRUE if PT_GNU_RELRO segment should be created.  */
   6.157 -   unsigned int relro: 1;
   6.158 - 
   6.159 -+  /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
   6.160 -+     flags.  */
   6.161 -+  unsigned int execheap: 1;
   6.162 -+
   6.163 -+  /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
   6.164 -+     flags.  */
   6.165 -+  unsigned int noexecheap: 1;
   6.166 -+
   6.167 -   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
   6.168 -   unsigned int warn_shared_textrel: 1;
   6.169 - 
   6.170 -diff -durN binutils-2.19.orig/include/elf/common.h binutils-2.19/include/elf/common.h
   6.171 ---- binutils-2.19.orig/include/elf/common.h	2008-08-04 01:20:42.000000000 +0200
   6.172 -+++ binutils-2.19/include/elf/common.h	2008-11-23 16:31:09.000000000 +0100
   6.173 -@@ -360,6 +360,7 @@
   6.174 - #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
   6.175 - #define PT_GNU_STACK	(PT_LOOS + 0x474e551) /* Stack flags */
   6.176 - #define PT_GNU_RELRO	(PT_LOOS + 0x474e552) /* Read-only after relocation */
   6.177 -+#define PT_PAX_FLAGS	(PT_LOOS + 0x5041580) /* PaX flags */
   6.178 - 
   6.179 - /* Program segment permissions, in program header p_flags field.  */
   6.180 - 
   6.181 -@@ -370,6 +371,21 @@
   6.182 - #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
   6.183 - #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
   6.184 - 
   6.185 -+/* Flags to control PaX behavior.  */
   6.186 -+
   6.187 -+#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
   6.188 -+#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
   6.189 -+#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
   6.190 -+#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
   6.191 -+#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
   6.192 -+#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
   6.193 -+#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
   6.194 -+#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
   6.195 -+#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
   6.196 -+#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
   6.197 -+#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
   6.198 -+#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
   6.199 -+
   6.200 - /* Values for section header, sh_type field.  */
   6.201 - 
   6.202 - #define SHT_NULL	0		/* Section header table entry unused */
   6.203 -diff -durN binutils-2.19.orig/ld/emultempl/elf32.em binutils-2.19/ld/emultempl/elf32.em
   6.204 ---- binutils-2.19.orig/ld/emultempl/elf32.em	2008-11-23 16:30:36.000000000 +0100
   6.205 -+++ binutils-2.19/ld/emultempl/elf32.em	2008-11-23 16:31:09.000000000 +0100
   6.206 -@@ -2146,6 +2146,16 @@
   6.207 - 	  link_info.noexecstack = TRUE;
   6.208 - 	  link_info.execstack = FALSE;
   6.209 - 	}
   6.210 -+      else if (strcmp (optarg, "execheap") == 0)
   6.211 -+	{
   6.212 -+	  link_info.execheap = TRUE;
   6.213 -+	  link_info.noexecheap = FALSE;
   6.214 -+	}
   6.215 -+      else if (strcmp (optarg, "noexecheap") == 0)
   6.216 -+	{
   6.217 -+	  link_info.noexecheap = TRUE;
   6.218 -+	  link_info.execheap = FALSE;
   6.219 -+	}
   6.220 - EOF
   6.221 - 
   6.222 -   if test -n "$COMMONPAGESIZE"; then
   6.223 -@@ -2229,6 +2239,8 @@
   6.224 -   fprintf (file, _("\
   6.225 -   -z execstack                Mark executable as requiring executable stack\n"));
   6.226 -   fprintf (file, _("\
   6.227 -+  -z execheap\t\tMark executable as requiring executable heap\n"));
   6.228 -+  fprintf (file, _("\
   6.229 -   -z initfirst                Mark DSO to be initialized first at runtime\n"));
   6.230 -   fprintf (file, _("\
   6.231 -   -z interpose                Mark object to interpose all DSOs but executable\n"));
   6.232 -@@ -2252,6 +2264,8 @@
   6.233 -   -z nodump                   Mark DSO not available to dldump\n"));
   6.234 -   fprintf (file, _("\
   6.235 -   -z noexecstack              Mark executable as not requiring executable stack\n"));
   6.236 -+  fprintf (file, _("\
   6.237 -+  -z noexecheap\tMark executable as not requiring executable heap\n"));
   6.238 - EOF
   6.239 - 
   6.240 -   if test -n "$COMMONPAGESIZE"; then
   6.241 -diff -durN binutils-2.19.orig/ld/ldgram.y binutils-2.19/ld/ldgram.y
   6.242 ---- binutils-2.19.orig/ld/ldgram.y	2008-07-06 15:38:36.000000000 +0200
   6.243 -+++ binutils-2.19/ld/ldgram.y	2008-11-23 16:31:09.000000000 +0100
   6.244 -@@ -1112,6 +1112,8 @@
   6.245 - 			    $$ = exp_intop (0x6474e550);
   6.246 - 			  else if (strcmp (s, "PT_GNU_STACK") == 0)
   6.247 - 			    $$ = exp_intop (0x6474e551);
   6.248 -+			  else if (strcmp (s, "PT_PAX_FLAGS") == 0)
   6.249 -+			    $$ = exp_intop (0x65041580);
   6.250 - 			  else
   6.251 - 			    {
   6.252 - 			      einfo (_("\
     7.1 --- a/patches/binutils/2.19/150-warn-textrel.patch	Sun Sep 11 18:28:45 2011 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,48 +0,0 @@
     7.4 -Original patch from Gentoo:
     7.5 -gentoo/src/patchsets/binutils/2.19/66_all_binutils-2.18.50.0.2-warn-textrel.patch
     7.6 -
     7.7 -textrels are bad for forcing copy-on-write (this affects everyone),
     7.8 -and for security/runtime code generation, this affects security ppl.
     7.9 -But in either case, it doesn't matter who needs textrels, it's
    7.10 -the very fact that they're needed at all.
    7.11 -
    7.12 -diff -durN binutils-2.19.orig/bfd/elflink.c binutils-2.19/bfd/elflink.c
    7.13 ---- binutils-2.19.orig/bfd/elflink.c	2008-11-23 16:49:47.000000000 +0100
    7.14 -+++ binutils-2.19/bfd/elflink.c	2008-11-23 16:49:14.000000000 +0100
    7.15 -@@ -10820,14 +10820,12 @@
    7.16 - 	goto error_return;
    7.17 - 
    7.18 -       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
    7.19 --      if (info->warn_shared_textrel && info->shared)
    7.20 -+      o = bfd_get_section_by_name (dynobj, ".dynamic");
    7.21 -+      if (info->warn_shared_textrel && o != NULL)
    7.22 - 	{
    7.23 - 	  bfd_byte *dyncon, *dynconend;
    7.24 - 
    7.25 - 	  /* Fix up .dynamic entries.  */
    7.26 --	  o = bfd_get_section_by_name (dynobj, ".dynamic");
    7.27 --	  BFD_ASSERT (o != NULL);
    7.28 --
    7.29 - 	  dyncon = o->contents;
    7.30 - 	  dynconend = o->contents + o->size;
    7.31 - 	  for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
    7.32 -@@ -10839,7 +10837,7 @@
    7.33 - 	      if (dyn.d_tag == DT_TEXTREL)
    7.34 - 		{
    7.35 - 		 info->callbacks->einfo
    7.36 --		    (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
    7.37 -+		    (_("%P: warning: creating a DT_TEXTREL in object.\n"));
    7.38 - 		  break;
    7.39 - 		}
    7.40 - 	    }
    7.41 -diff -durN binutils-2.19.orig/ld/ldmain.c binutils-2.19/ld/ldmain.c
    7.42 ---- binutils-2.19.orig/ld/ldmain.c	2008-08-17 05:12:50.000000000 +0200
    7.43 -+++ binutils-2.19/ld/ldmain.c	2008-11-23 16:52:37.000000000 +0100
    7.44 -@@ -274,6 +274,7 @@
    7.45 -   link_info.relax_pass = 1;
    7.46 -   link_info.pei386_auto_import = -1;
    7.47 -   link_info.spare_dynamic_tags = 5;
    7.48 -+  link_info.warn_shared_textrel = TRUE;
    7.49 -   link_info.path_separator = ':';
    7.50 - 
    7.51 -   ldfile_add_arch ("");
     8.1 --- a/patches/binutils/2.19/160-use-new-ld-dtags.patch	Sun Sep 11 18:28:45 2011 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,14 +0,0 @@
     8.4 -Original patch from Gentoo:
     8.5 -gentoo/src/patchsets/binutils/2.19/76_all_use-new-ld-dtags.patch
     8.6 -
     8.7 -diff -durN binutils-2.19.orig/ld/ldmain.c binutils-2.19/ld/ldmain.c
     8.8 ---- binutils-2.19.orig/ld/ldmain.c	2008-11-23 16:54:42.000000000 +0100
     8.9 -+++ binutils-2.19/ld/ldmain.c	2008-11-23 16:56:16.000000000 +0100
    8.10 -@@ -262,6 +262,7 @@
    8.11 - 
    8.12 -   link_info.allow_undefined_version = TRUE;
    8.13 -   link_info.keep_memory = TRUE;
    8.14 -+  link_info.new_dtags = TRUE;
    8.15 -   link_info.combreloc = TRUE;
    8.16 -   link_info.strip_discarded = TRUE;
    8.17 -   link_info.emit_hash = TRUE;
     9.1 --- a/patches/binutils/2.19/170-use-relro.patch	Sun Sep 11 18:28:45 2011 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,14 +0,0 @@
     9.4 -Original patch from Gentoo:
     9.5 -gentoo/src/patchsets/binutils/2.19/78_all_use-relro.patch
     9.6 -
     9.7 -diff -durN binutils-2.19.orig/ld/ldmain.c binutils-2.19/ld/ldmain.c
     9.8 ---- binutils-2.19.orig/ld/ldmain.c	2008-11-23 16:59:24.000000000 +0100
     9.9 -+++ binutils-2.19/ld/ldmain.c	2008-11-23 16:59:45.000000000 +0100
    9.10 -@@ -264,6 +264,7 @@
    9.11 -   link_info.keep_memory = TRUE;
    9.12 -   link_info.new_dtags = TRUE;
    9.13 -   link_info.combreloc = TRUE;
    9.14 -+  link_info.relro = TRUE;
    9.15 -   link_info.strip_discarded = TRUE;
    9.16 -   link_info.emit_hash = TRUE;
    9.17 - #ifndef __mips__
    10.1 --- a/patches/binutils/2.19/180-libiberty-pic.patch	Sun Sep 11 18:28:45 2011 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,14 +0,0 @@
    10.4 -Original patch from Gentoo:
    10.5 -gentoo/src/patchsets/binutils/2.19/91_all_libiberty-pic.patch
    10.6 -
    10.7 -diff -durN binutils-2.19.orig/libiberty/Makefile.in binutils-2.19/libiberty/Makefile.in
    10.8 ---- binutils-2.19.orig/libiberty/Makefile.in	2008-07-24 15:51:49.000000000 +0200
    10.9 -+++ binutils-2.19/libiberty/Makefile.in	2008-11-23 17:03:33.000000000 +0100
   10.10 -@@ -227,6 +227,7 @@
   10.11 - 	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
   10.12 - 	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
   10.13 - 	  $(RANLIB) $(TARGETLIB); \
   10.14 -+	  cp $(TARGETLIB) ../ ; \
   10.15 - 	  cd ..; \
   10.16 - 	else true; fi
   10.17 - 
    11.1 --- a/patches/binutils/2.20/100-ppc64-pie.patch	Sun Sep 11 18:28:45 2011 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,16 +0,0 @@
    11.4 ---- binutils/bfd/elf64-ppc.c.jj	2004-09-27 16:46:06.000000000 -0400
    11.5 -+++ binutils/bfd/elf64-ppc.c	2004-10-04 09:09:50.000000000 -0400
    11.6 -@@ -9681,7 +9681,12 @@ ppc64_elf_relocate_section (bfd *output_
    11.7 - 	      else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
    11.8 - 		       && !is_opd
    11.9 - 		       && r_type != R_PPC64_TOC)
   11.10 --		outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
   11.11 -+		{
   11.12 -+		  outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
   11.13 -+		  if (h->elf.dynindx == -1
   11.14 -+		      && h->elf.root.type == bfd_link_hash_undefweak)
   11.15 -+		  memset (&outrel, 0, sizeof outrel);
   11.16 -+		}
   11.17 - 	      else
   11.18 - 		{
   11.19 - 		  /* This symbol is local, or marked to become local,
    12.1 --- a/patches/binutils/2.20/110-RPATH_ENVVAR-smack.patch	Sun Sep 11 18:28:45 2011 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,13 +0,0 @@
    12.4 -http://sourceware.org/ml/binutils/2007-07/msg00401.html
    12.5 -http://sourceware.org/bugzilla/show_bug.cgi?id=4970
    12.6 -
    12.7 ---- binutils/configure
    12.8 -+++ binutils/configure
    12.9 -@@ -5601,6 +5601,7 @@ case "${host}" in
   12.10 -   *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
   12.11 -   *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
   12.12 - esac
   12.13 -+RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
   12.14 - 
   12.15 - # On systems where the dynamic library environment variable is PATH,
   12.16 - if test "$RPATH_ENVVAR" = PATH; then
    13.1 --- a/patches/binutils/2.20/120-sh-targets.patch	Sun Sep 11 18:28:45 2011 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,40 +0,0 @@
    13.4 ---- binutils-2.20-dist/configure
    13.5 -+++ binutils-2.20/configure
    13.6 -@@ -3054,7 +3054,7 @@
    13.7 -   am33_2.0-*-linux*)
    13.8 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
    13.9 -     ;;
   13.10 --  sh-*-linux*)
   13.11 -+  sh*-*-linux*)
   13.12 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
   13.13 -     ;;
   13.14 -   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
   13.15 -@@ -3390,7 +3390,7 @@
   13.16 -   romp-*-*)
   13.17 -     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
   13.18 -     ;;
   13.19 --  sh-*-* | sh64-*-*)
   13.20 -+  sh*-*-* | sh64-*-*)
   13.21 -     case "${host}" in
   13.22 -       i[3456789]86-*-vsta) ;; # don't add gprof back in
   13.23 -       i[3456789]86-*-go32*) ;; # don't add gprof back in
   13.24 ---- binutils-2.20-dist/configure.ac
   13.25 -+++ binutils-2.20/configure.ac
   13.26 -@@ -424,7 +424,7 @@
   13.27 -   am33_2.0-*-linux*)
   13.28 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
   13.29 -     ;;
   13.30 --  sh-*-linux*)
   13.31 -+  sh*-*-linux*)
   13.32 -     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
   13.33 -     ;;    
   13.34 -   sh*-*-pe|mips*-*-pe|*arm-wince-pe)
   13.35 -@@ -712,7 +712,7 @@
   13.36 -   romp-*-*)
   13.37 -     noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
   13.38 -     ;;
   13.39 --  sh-*-* | sh64-*-*)
   13.40 -+  sh*-*-* | sh64-*-*)
   13.41 -     case "${host}" in
   13.42 -       i[[3456789]]86-*-vsta) ;; # don't add gprof back in
   13.43 -       i[[3456789]]86-*-go32*) ;; # don't add gprof back in
    14.1 --- a/patches/binutils/2.20/130-ld-sysroot.patch	Sun Sep 11 18:28:45 2011 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,36 +0,0 @@
    14.4 -Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
    14.5 -
    14.6 -Always try to prepend the sysroot prefix to absolute filenames first.
    14.7 -
    14.8 -http://bugs.gentoo.org/275666
    14.9 -http://sourceware.org/bugzilla/show_bug.cgi?id=10340
   14.10 -
   14.11 ---- binutils/ld/ldfile.c
   14.12 -+++ binutils/ld/ldfile.c
   14.13 -@@ -308,18 +308,24 @@
   14.14 -      directory first.  */
   14.15 -   if (! entry->is_archive)
   14.16 -     {
   14.17 --      if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
   14.18 -+      /* For absolute pathnames, try to always open the file in the
   14.19 -+	 sysroot first. If this fails, try to open the file at the
   14.20 -+	 given location. */
   14.21 -+      entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
   14.22 -+      if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
   14.23 - 	{
   14.24 - 	  char *name = concat (ld_sysroot, entry->filename,
   14.25 - 			       (const char *) NULL);
   14.26 - 	  if (ldfile_try_open_bfd (name, entry))
   14.27 - 	    {
   14.28 - 	      entry->filename = name;
   14.29 -+	      entry->sysrooted = TRUE;
   14.30 - 	      return TRUE;
   14.31 - 	    }
   14.32 - 	  free (name);
   14.33 - 	}
   14.34 --      else if (ldfile_try_open_bfd (entry->filename, entry))
   14.35 -+
   14.36 -+      if (ldfile_try_open_bfd (entry->filename, entry))
   14.37 - 	{
   14.38 - 	  entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
   14.39 - 	    && is_sysrooted_pathname (entry->filename, TRUE);
    15.1 --- a/patches/binutils/2.20/140-check_ldrunpath_length.patch	Sun Sep 11 18:28:45 2011 +0200
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,47 +0,0 @@
    15.4 -#!/bin/sh -e
    15.5 -## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
    15.6 -##
    15.7 -## All lines beginning with `## DP:' are a description of the patch.
    15.8 -## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
    15.9 -## DP: cases where -rpath isn't specified. (#151024)
   15.10 -
   15.11 -if [ $# -ne 1 ]; then
   15.12 -    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   15.13 -    exit 1
   15.14 -fi
   15.15 -
   15.16 -[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
   15.17 -patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
   15.18 -
   15.19 -case "$1" in
   15.20 -       -patch) patch $patch_opts -p1 < $0;;
   15.21 -       -unpatch) patch $patch_opts -p1 -R < $0;;
   15.22 -        *)
   15.23 -                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   15.24 -                exit 1;;
   15.25 -esac
   15.26 -
   15.27 -exit 0
   15.28 -
   15.29 -@DPATCH@
   15.30 -diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
   15.31 ---- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em	2004-05-21 23:12:58.000000000 +0100
   15.32 -+++ binutils-2.20/ld/emultempl/elf32.em	2004-05-21 23:12:59.000000000 +0100
   15.33 -@@ -692,6 +692,8 @@
   15.34 - 	      && command_line.rpath == NULL)
   15.35 - 	    {
   15.36 - 	      lib_path = (const char *) getenv ("LD_RUN_PATH");
   15.37 -+	      if ((lib_path) && (strlen (lib_path) == 0))
   15.38 -+		  lib_path = NULL;
   15.39 - 	      if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
   15.40 - 						      force))
   15.41 - 		break;
   15.42 -@@ -871,6 +873,8 @@
   15.43 -   rpath = command_line.rpath;
   15.44 -   if (rpath == NULL)
   15.45 -     rpath = (const char *) getenv ("LD_RUN_PATH");
   15.46 -+  if ((rpath) && (strlen (rpath) == 0))
   15.47 -+      rpath = NULL;
   15.48 -   if (! (bfd_elf_size_dynamic_sections
   15.49 - 	 (link_info.output_bfd, command_line.soname, rpath,
   15.50 - 	  command_line.filter_shlib,
    16.1 --- a/patches/binutils/2.20/150-pt-pax-flags-20090909.patch	Sun Sep 11 18:28:45 2011 +0200
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,238 +0,0 @@
    16.4 ---- binutils-2.20/bfd/elf-bfd.h
    16.5 -+++ binutils-2.20/bfd/elf-bfd.h
    16.6 -@@ -1527,6 +1527,9 @@ struct elf_obj_tdata
    16.7 -   /* Segment flags for the PT_GNU_STACK segment.  */
    16.8 -   unsigned int stack_flags;
    16.9 - 
   16.10 -+  /* Segment flags for the PT_PAX_FLAGS segment.  */
   16.11 -+  unsigned int pax_flags;
   16.12 -+
   16.13 -   /* Symbol version definitions in external objects.  */
   16.14 -   Elf_Internal_Verdef *verdef;
   16.15 - 
   16.16 ---- binutils-2.20/bfd/elf.c
   16.17 -+++ binutils-2.20/bfd/elf.c
   16.18 -@@ -1081,6 +1081,7 @@ get_segment_type (unsigned int p_type)
   16.19 -     case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
   16.20 -     case PT_GNU_STACK: pt = "STACK"; break;
   16.21 -     case PT_GNU_RELRO: pt = "RELRO"; break;
   16.22 -+    case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
   16.23 -     default: pt = NULL; break;
   16.24 -     }
   16.25 -   return pt;
   16.26 -@@ -2379,6 +2380,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
   16.27 -     case PT_GNU_RELRO:
   16.28 -       return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
   16.29 - 
   16.30 -+    case PT_PAX_FLAGS:
   16.31 -+      return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
   16.32 -+
   16.33 -     default:
   16.34 -       /* Check for any processor-specific program segment types.  */
   16.35 -       bed = get_elf_backend_data (abfd);
   16.36 -@@ -3393,6 +3397,11 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
   16.37 -       ++segs;
   16.38 -     }
   16.39 - 
   16.40 -+    {
   16.41 -+      /* We need a PT_PAX_FLAGS segment.  */
   16.42 -+      ++segs;
   16.43 -+    }
   16.44 -+
   16.45 -   for (s = abfd->sections; s != NULL; s = s->next)
   16.46 -     {
   16.47 -       if ((s->flags & SEC_LOAD) != 0
   16.48 -@@ -3972,6 +3981,20 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
   16.49 - 	    }
   16.50 - 	}
   16.51 - 
   16.52 -+    {
   16.53 -+      amt = sizeof (struct elf_segment_map);
   16.54 -+      m = bfd_zalloc (abfd, amt);
   16.55 -+      if (m == NULL)
   16.56 -+	goto error_return;
   16.57 -+      m->next = NULL;
   16.58 -+      m->p_type = PT_PAX_FLAGS;
   16.59 -+      m->p_flags = elf_tdata (abfd)->pax_flags;
   16.60 -+      m->p_flags_valid = 1;
   16.61 -+
   16.62 -+      *pm = m;
   16.63 -+      pm = &m->next;
   16.64 -+    }
   16.65 -+
   16.66 -       free (sections);
   16.67 -       elf_tdata (abfd)->segment_map = mfirst;
   16.68 -     }
   16.69 -@@ -5176,7 +5199,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
   16.70 -        6. PT_TLS segment includes only SHF_TLS sections.
   16.71 -        7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
   16.72 -        8. PT_DYNAMIC should not contain empty sections at the beginning
   16.73 --	  (with the possible exception of .dynamic).  */
   16.74 -+	  (with the possible exception of .dynamic).
   16.75 -+       9. PT_PAX_FLAGS segments do not include any sections.  */
   16.76 - #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed)		\
   16.77 -   ((((segment->p_paddr							\
   16.78 -       ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr)	\
   16.79 -@@ -5184,6 +5208,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
   16.80 -      && (section->flags & SEC_ALLOC) != 0)				\
   16.81 -     || IS_NOTE (segment, section))					\
   16.82 -    && segment->p_type != PT_GNU_STACK					\
   16.83 -+   && segment->p_type != PT_PAX_FLAGS					\
   16.84 -    && (segment->p_type != PT_TLS					\
   16.85 -        || (section->flags & SEC_THREAD_LOCAL))				\
   16.86 -    && (segment->p_type == PT_LOAD					\
   16.87 ---- binutils-2.20/bfd/elflink.c
   16.88 -+++ binutils-2.20/bfd/elflink.c
   16.89 -@@ -5465,16 +5465,30 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
   16.90 -     return TRUE;
   16.91 - 
   16.92 -   bed = get_elf_backend_data (output_bfd);
   16.93 -+
   16.94 -+  elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
   16.95 -+  if (info->execheap)
   16.96 -+    elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
   16.97 -+  else if (info->noexecheap)
   16.98 -+    elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
   16.99 -+
  16.100 -   if (info->execstack)
  16.101 --    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
  16.102 -+    {
  16.103 -+      elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
  16.104 -+      elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
  16.105 -+    }
  16.106 -   else if (info->noexecstack)
  16.107 --    elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
  16.108 -+    {
  16.109 -+      elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
  16.110 -+      elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
  16.111 -+    }
  16.112 -   else
  16.113 -     {
  16.114 -       bfd *inputobj;
  16.115 -       asection *notesec = NULL;
  16.116 -       int exec = 0;
  16.117 - 
  16.118 -+      elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
  16.119 -       for (inputobj = info->input_bfds;
  16.120 - 	   inputobj;
  16.121 - 	   inputobj = inputobj->link_next)
  16.122 -@@ -5487,7 +5501,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
  16.123 - 	  if (s)
  16.124 - 	    {
  16.125 - 	      if (s->flags & SEC_CODE)
  16.126 --		exec = PF_X;
  16.127 -+		{
  16.128 -+		  elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
  16.129 -+		  elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
  16.130 -+		  exec = PF_X;
  16.131 -+		}
  16.132 - 	      notesec = s;
  16.133 - 	    }
  16.134 - 	  else if (bed->default_execstack)
  16.135 ---- binutils-2.20/binutils/readelf.c
  16.136 -+++ binutils-2.20/binutils/readelf.c
  16.137 -@@ -2556,6 +2556,7 @@ get_segment_type (unsigned long p_type)
  16.138 - 			return "GNU_EH_FRAME";
  16.139 -     case PT_GNU_STACK:	return "GNU_STACK";
  16.140 -     case PT_GNU_RELRO:  return "GNU_RELRO";
  16.141 -+    case PT_PAX_FLAGS:  return "PAX_FLAGS";
  16.142 - 
  16.143 -     default:
  16.144 -       if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
  16.145 ---- binutils-2.20/include/bfdlink.h
  16.146 -+++ binutils-2.20/include/bfdlink.h
  16.147 -@@ -319,6 +319,14 @@ struct bfd_link_info
  16.148 -   /* TRUE if PT_GNU_RELRO segment should be created.  */
  16.149 -   unsigned int relro: 1;
  16.150 - 
  16.151 -+  /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
  16.152 -+     flags.  */
  16.153 -+  unsigned int execheap: 1;
  16.154 -+
  16.155 -+  /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
  16.156 -+     flags.  */
  16.157 -+  unsigned int noexecheap: 1;
  16.158 -+
  16.159 -   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
  16.160 -   unsigned int warn_shared_textrel: 1;
  16.161 - 
  16.162 ---- binutils-2.20/include/elf/common.h
  16.163 -+++ binutils-2.20/include/elf/common.h
  16.164 -@@ -422,6 +422,7 @@
  16.165 - #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
  16.166 - #define PT_GNU_STACK	(PT_LOOS + 0x474e551) /* Stack flags */
  16.167 - #define PT_GNU_RELRO	(PT_LOOS + 0x474e552) /* Read-only after relocation */
  16.168 -+#define PT_PAX_FLAGS	(PT_LOOS + 0x5041580) /* PaX flags */
  16.169 - 
  16.170 - /* Program segment permissions, in program header p_flags field.  */
  16.171 - 
  16.172 -@@ -432,6 +433,21 @@
  16.173 - #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
  16.174 - #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
  16.175 - 
  16.176 -+/* Flags to control PaX behavior.  */
  16.177 -+
  16.178 -+#define PF_PAGEEXEC	(1 << 4)	/* Enable  PAGEEXEC */
  16.179 -+#define PF_NOPAGEEXEC	(1 << 5)	/* Disable PAGEEXEC */
  16.180 -+#define PF_SEGMEXEC	(1 << 6)	/* Enable  SEGMEXEC */
  16.181 -+#define PF_NOSEGMEXEC	(1 << 7)	/* Disable SEGMEXEC */
  16.182 -+#define PF_MPROTECT	(1 << 8)	/* Enable  MPROTECT */
  16.183 -+#define PF_NOMPROTECT	(1 << 9)	/* Disable MPROTECT */
  16.184 -+#define PF_RANDEXEC	(1 << 10)	/* Enable  RANDEXEC */
  16.185 -+#define PF_NORANDEXEC	(1 << 11)	/* Disable RANDEXEC */
  16.186 -+#define PF_EMUTRAMP	(1 << 12)	/* Enable  EMUTRAMP */
  16.187 -+#define PF_NOEMUTRAMP	(1 << 13)	/* Disable EMUTRAMP */
  16.188 -+#define PF_RANDMMAP	(1 << 14)	/* Enable  RANDMMAP */
  16.189 -+#define PF_NORANDMMAP	(1 << 15)	/* Disable RANDMMAP */
  16.190 -+
  16.191 - /* Values for section header, sh_type field.  */
  16.192 - 
  16.193 - #define SHT_NULL	0		/* Section header table entry unused */
  16.194 ---- binutils-2.20/ld/emultempl/elf32.em
  16.195 -+++ binutils-2.20/ld/emultempl/elf32.em
  16.196 -@@ -2159,6 +2159,16 @@ fragment <<EOF
  16.197 - 	  link_info.noexecstack = TRUE;
  16.198 - 	  link_info.execstack = FALSE;
  16.199 - 	}
  16.200 -+      else if (strcmp (optarg, "execheap") == 0)
  16.201 -+	{
  16.202 -+	  link_info.execheap = TRUE;
  16.203 -+	  link_info.noexecheap = FALSE;
  16.204 -+	}
  16.205 -+      else if (strcmp (optarg, "noexecheap") == 0)
  16.206 -+	{
  16.207 -+	  link_info.noexecheap = TRUE;
  16.208 -+	  link_info.execheap = FALSE;
  16.209 -+	}
  16.210 - EOF
  16.211 - 
  16.212 -   if test -n "$COMMONPAGESIZE"; then
  16.213 -@@ -2237,6 +2247,8 @@ fragment <<EOF
  16.214 -   fprintf (file, _("\
  16.215 -   -z execstack                Mark executable as requiring executable stack\n"));
  16.216 -   fprintf (file, _("\
  16.217 -+  -z execheap                 Mark executable as requiring executable heap\n"));
  16.218 -+  fprintf (file, _("\
  16.219 -   -z initfirst                Mark DSO to be initialized first at runtime\n"));
  16.220 -   fprintf (file, _("\
  16.221 -   -z interpose                Mark object to interpose all DSOs but executable\n"));
  16.222 -@@ -2260,6 +2272,8 @@ fragment <<EOF
  16.223 -   -z nodump                   Mark DSO not available to dldump\n"));
  16.224 -   fprintf (file, _("\
  16.225 -   -z noexecstack              Mark executable as not requiring executable stack\n"));
  16.226 -+  fprintf (file, _("\
  16.227 -+  -z noexecheap               Mark executable as not requiring executable heap\n"));
  16.228 - EOF
  16.229 - 
  16.230 -   if test -n "$COMMONPAGESIZE"; then
  16.231 ---- binutils-2.20/ld/ldgram.y
  16.232 -+++ binutils-2.20/ld/ldgram.y
  16.233 -@@ -1116,6 +1116,8 @@ phdr_type:
  16.234 - 			    $$ = exp_intop (0x6474e550);
  16.235 - 			  else if (strcmp (s, "PT_GNU_STACK") == 0)
  16.236 - 			    $$ = exp_intop (0x6474e551);
  16.237 -+			  else if (strcmp (s, "PT_PAX_FLAGS") == 0)
  16.238 -+			    $$ = exp_intop (0x65041580);
  16.239 - 			  else
  16.240 - 			    {
  16.241 - 			      einfo (_("\
    17.1 --- a/patches/binutils/2.20/160-amd64-32bit-path.patch	Sun Sep 11 18:28:45 2011 +0200
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,16 +0,0 @@
    17.4 ---- binutils/ld/emulparams/elf_i386.sh
    17.5 -+++ binutils/ld/emulparams/elf_i386.sh
    17.6 -@@ -13,3 +13,13 @@
    17.7 - NO_SMALL_DATA=yes
    17.8 - SEPARATE_GOTPLT=12
    17.9 - IREL_IN_PLT=
   17.10 -+
   17.11 -+# In Gentoo, we install 32bit libs into /lib32 in an
   17.12 -+# ABI setup with amd64/x86
   17.13 -+case "$target" in
   17.14 -+  x86_64*-linux*)
   17.15 -+    case "$EMULATION_NAME" in
   17.16 -+      *i386*) LIBPATH_SUFFIX=32  ;;
   17.17 -+    esac
   17.18 -+  ;;
   17.19 -+esac
    18.1 --- a/patches/binutils/2.20/170-warn-textrel.patch	Sun Sep 11 18:28:45 2011 +0200
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,59 +0,0 @@
    18.4 -textrels are bad for forcing copy-on-write (this affects everyone),
    18.5 -and for security/runtime code generation, this affects security ppl.
    18.6 -But in either case, it doesn't matter who needs textrels, it's
    18.7 -the very fact that they're needed at all.
    18.8 -
    18.9 -2006-06-10  Ned Ludd  <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
   18.10 -
   18.11 -	* bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
   18.12 -	* ld/ldmain.c (main): Change textrel warning default to true.
   18.13 -	* ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
   18.14 -	warnings from ld output.
   18.15 -
   18.16 ---- binutils/bfd/elflink.c
   18.17 -+++ binutils/bfd/elflink.c
   18.18 -@@ -8652,14 +8652,12 @@
   18.19 - 	goto error_return;
   18.20 - 
   18.21 -       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
   18.22 --      if (info->warn_shared_textrel && info->shared)
   18.23 -+      o = bfd_get_section_by_name (dynobj, ".dynamic");
   18.24 -+      if (info->warn_shared_textrel && o != NULL)
   18.25 - 	{
   18.26 - 	  bfd_byte *dyncon, *dynconend;
   18.27 - 
   18.28 - 	  /* Fix up .dynamic entries.  */
   18.29 --	  o = bfd_get_section_by_name (dynobj, ".dynamic");
   18.30 --	  BFD_ASSERT (o != NULL);
   18.31 --
   18.32 - 	  dyncon = o->contents;
   18.33 - 	  dynconend = o->contents + o->size;
   18.34 - 	  for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
   18.35 -@@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
   18.36 - 	      if (dyn.d_tag == DT_TEXTREL)
   18.37 - 		{
   18.38 - 		 info->callbacks->einfo
   18.39 --		    (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
   18.40 -+		    (_("%P: warning: creating a DT_TEXTREL in object.\n"));
   18.41 - 		  break;
   18.42 - 		}
   18.43 - 	    }
   18.44 ---- binutils/ld/ldmain.c
   18.45 -+++ binutils/ld/ldmain.c
   18.46 -@@ -282,2 +282,3 @@ main (int argc, char **argv)
   18.47 -   link_info.spare_dynamic_tags = 5;
   18.48 -+  link_info.warn_shared_textrel = TRUE;
   18.49 -   link_info.sharable_sections = FALSE;
   18.50 ---- binutils/ld/testsuite/lib/ld-lib.exp
   18.51 -+++ binutils/ld/testsuite/lib/ld-lib.exp
   18.52 -@@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target 
   18.53 -     # symbol, since the default linker script might use ENTRY.
   18.54 -     regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
   18.55 - 
   18.56 -+    # Gentoo tweak:
   18.57 -+    # We want to ignore TEXTREL warnings since we force enable them by default
   18.58 -+    regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
   18.59 -+
   18.60 -     if [string match "" $exec_output] then {
   18.61 - 	return 1
   18.62 -     } else {
    19.1 --- a/patches/binutils/2.20/180-only-use-new-ld-dtags.patch.disabled	Sun Sep 11 18:28:45 2011 +0200
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,25 +0,0 @@
    19.4 -Don't generate RPATH if we're going to be generating RUNPATH.
    19.5 -
    19.6 -need to ponder what ramifications this has before enabling it
    19.7 -
    19.8 ---- binutils/bfd/elflink.c
    19.9 -+++ binutils/bfd/elflink.c
   19.10 -@@ -5382,11 +5382,15 @@
   19.11 - 
   19.12 - 	  indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
   19.13 - 				      TRUE);
   19.14 --	  if (indx == (bfd_size_type) -1
   19.15 --	      || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
   19.16 -+	  if (indx == (bfd_size_type) -1)
   19.17 - 	    return FALSE;
   19.18 - 
   19.19 --	  if  (info->new_dtags)
   19.20 -+	  if (!info->new_dtags)
   19.21 -+	    {
   19.22 -+	      if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
   19.23 -+		return FALSE;
   19.24 -+	    }
   19.25 -+	  else
   19.26 - 	    {
   19.27 - 	      _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
   19.28 - 	      if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
    20.1 --- a/patches/binutils/2.20/190-use-new-ld-dtags.patch	Sun Sep 11 18:28:45 2011 +0200
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,10 +0,0 @@
    20.4 ---- binutils/ld/ldmain.c
    20.5 -+++ binutils/ld/ldmain.c
    20.6 -@@ -296,6 +296,7 @@ main (int argc, char **argv)
    20.7 - 
    20.8 -   link_info.allow_undefined_version = TRUE;
    20.9 -   link_info.keep_memory = TRUE;
   20.10 -+  link_info.new_dtags = TRUE;
   20.11 -   link_info.combreloc = TRUE;
   20.12 -   link_info.strip_discarded = TRUE;
   20.13 -   link_info.callbacks = &link_callbacks;
    21.1 --- a/patches/binutils/2.20/200-document-new-dtags-behaviour.patch	Sun Sep 11 18:28:45 2011 +0200
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,16 +0,0 @@
    21.4 -Index: binutils-2.19.51.0.5/ld/ld.texinfo
    21.5 -===================================================================
    21.6 ---- binutils-2.19.51.0.5.orig/ld/ld.texinfo
    21.7 -+++ binutils-2.19.51.0.5/ld/ld.texinfo
    21.8 -@@ -2036,8 +2036,9 @@ This linker can create the new dynamic t
    21.9 - systems may not understand them. If you specify
   21.10 - @option{--enable-new-dtags}, the dynamic tags will be created as needed.
   21.11 - If you specify @option{--disable-new-dtags}, no new dynamic tags will be
   21.12 --created. By default, the new dynamic tags are not created. Note that
   21.13 --those options are only available for ELF systems.
   21.14 -+created. On Gentoo, by default, the new dynamic tags are created (this
   21.15 -+differs from upstream behaviour). Note that those options are only
   21.16 -+available for ELF systems.
   21.17 - 
   21.18 - @kindex --hash-size=@var{number}
   21.19 - @item --hash-size=@var{number}
    22.1 --- a/patches/binutils/2.20/220-use-relro.patch	Sun Sep 11 18:28:45 2011 +0200
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,6 +0,0 @@
    22.4 ---- binutils/ld/ldmain.c
    22.5 -+++ binutils/ld/ldmain.c
    22.6 -@@ -293,2 +293,3 @@ main (int argc, char **argv)
    22.7 -   link_info.combreloc = TRUE;
    22.8 -+  link_info.relro = TRUE;
    22.9 -   link_info.strip_discarded = TRUE;
    23.1 --- a/patches/binutils/2.20/230-libiberty-pic.patch	Sun Sep 11 18:28:45 2011 +0200
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,10 +0,0 @@
    23.4 ---- binutils/libiberty/Makefile.in.mps	2004-05-13 15:53:17.000000000 +0200
    23.5 -+++ binutils/libiberty/Makefile.in	2004-05-13 15:52:53.000000000 +0200
    23.6 -@@ -224,6 +224,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
    23.7 - 	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
    23.8 - 	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
    23.9 - 	  $(RANLIB) $(TARGETLIB); \
   23.10 -+	  cp $(TARGETLIB) ../ ; \
   23.11 - 	  cd ..; \
   23.12 - 	else true; fi
   23.13 - 
    24.1 --- a/patches/binutils/2.20/240-ld_makefile.patch	Sun Sep 11 18:28:45 2011 +0200
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,25 +0,0 @@
    24.4 -Description: correct where ld scripts are installed
    24.5 -Author: Chris Chimelis <chris@debian.org>
    24.6 -
    24.7 ---- binutils-2.16.91.0.1/ld/Makefile.am
    24.8 -+++ binutils-2.16.91.0.1/ld/Makefile.am
    24.9 -@@ -20,7 +20,7 @@
   24.10 - # We put the scripts in the directory $(scriptdir)/ldscripts.
   24.11 - # We can't put the scripts in $(datadir) because the SEARCH_DIR
   24.12 - # directives need to be different for native and cross linkers.
   24.13 --scriptdir = $(tooldir)/lib
   24.14 -+scriptdir = $(libdir)
   24.15 - 
   24.16 - EMUL = @EMUL@
   24.17 - EMULATION_OFILES = @EMULATION_OFILES@
   24.18 ---- binutils-2.16.91.0.1/ld/Makefile.in
   24.19 -+++ binutils-2.16.91.0.1/ld/Makefile.in
   24.20 -@@ -268,7 +268,7 @@
   24.21 - # We put the scripts in the directory $(scriptdir)/ldscripts.
   24.22 - # We can't put the scripts in $(datadir) because the SEARCH_DIR
   24.23 - # directives need to be different for native and cross linkers.
   24.24 --scriptdir = $(tooldir)/lib
   24.25 -+scriptdir = $(libdir)
   24.26 - BASEDIR = $(srcdir)/..
   24.27 - BFDDIR = $(BASEDIR)/bfd
   24.28 - INCDIR = $(BASEDIR)/include
    25.1 --- a/patches/binutils/2.20/250-arm-eabi-conf.patch	Sun Sep 11 18:28:45 2011 +0200
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,24 +0,0 @@
    25.4 -diff -u binutils-2.20.orig/configure binutils-2.20/configure
    25.5 ---- binutils-2.20.orig/configure	2010-01-05 11:15:44.000000000 +0100
    25.6 -+++ binutils-2.20/configure	2010-01-05 12:25:41.000000000 +0100
    25.7 -@@ -3086,7 +3086,7 @@
    25.8 -     noconfigdirs="$noconfigdirs target-libffi target-qthreads"
    25.9 -     libgloss_dir=arm
   25.10 -     ;;
   25.11 --  arm*-*-linux-gnueabi)
   25.12 -+  arm*-*-linux-*gnueabi)
   25.13 -     noconfigdirs="$noconfigdirs target-qthreads"
   25.14 -     case ${with_newlib} in
   25.15 -       no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
   25.16 -diff -u binutils-2.20.orig/configure.ac binutils-2.20/configure.ac
   25.17 ---- binutils-2.20.orig/configure.ac	2010-01-05 11:15:44.000000000 +0100
   25.18 -+++ binutils-2.20/configure.ac	2010-01-05 12:25:51.000000000 +0100
   25.19 -@@ -573,7 +573,7 @@
   25.20 -     noconfigdirs="$noconfigdirs target-libffi target-qthreads"
   25.21 -     libgloss_dir=arm
   25.22 -     ;;
   25.23 --  arm*-*-linux-gnueabi)
   25.24 -+  arm*-*-linux-*gnueabi)
   25.25 -     noconfigdirs="$noconfigdirs target-qthreads"
   25.26 -     case ${with_newlib} in
   25.27 -       no) noconfigdirs="$noconfigdirs target-newlib target-libgloss"
    26.1 --- a/patches/binutils/2.20/260-arm-non-empty-know.patch	Sun Sep 11 18:28:45 2011 +0200
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,18 +0,0 @@
    26.4 -This is backported partially from 2.20 branch
    26.5 -
    26.6 -http://sourceware.org/ml/binutils-cvs/2009-10/msg00173.html
    26.7 -
    26.8 --Khem
    26.9 -Index: binutils-2.20/gas/as.h
   26.10 -===================================================================
   26.11 ---- binutils-2.20.orig/gas/as.h	2009-10-22 00:27:08.700469349 -0700
   26.12 -+++ binutils-2.20/gas/as.h	2009-10-22 00:28:04.068416318 -0700
   26.13 -@@ -238,7 +238,7 @@ typedef addressT valueT;
   26.14 - #define know(p) gas_assert(p)	/* Verify our assumptions!  */
   26.15 - #endif /* not yet defined */
   26.16 - #else
   26.17 --#define know(p)			/* know() checks are no-op.ed  */
   26.18 -+#define know(p) do {} while (0)	/* know() checks are no-op.ed  */
   26.19 - #endif
   26.20 - 
   26.21 - /* input_scrub.c */
    27.1 --- a/patches/binutils/2.20/270-better_file_error.patch	Sun Sep 11 18:28:45 2011 +0200
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,43 +0,0 @@
    27.4 -#!/bin/sh -e
    27.5 -## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
    27.6 -##
    27.7 -## All lines beginning with `## DP:' are a description of the patch.
    27.8 -## DP: Specify which filename is causing an error if the filename is a
    27.9 -## DP: directory. (#45832)
   27.10 -
   27.11 -if [ $# -ne 1 ]; then
   27.12 -    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   27.13 -    exit 1
   27.14 -fi
   27.15 -
   27.16 -[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
   27.17 -patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
   27.18 -
   27.19 -case "$1" in
   27.20 -       -patch) patch $patch_opts -p1 < $0;;
   27.21 -       -unpatch) patch $patch_opts -p1 -R < $0;;
   27.22 -        *)
   27.23 -                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
   27.24 -                exit 1;;
   27.25 -esac
   27.26 -
   27.27 -exit 0
   27.28 -
   27.29 -@DPATCH@
   27.30 -diff -urNad /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c binutils-2.14.90.0.6/bfd/opncls.c
   27.31 ---- /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c	2003-07-23 16:08:09.000000000 +0100
   27.32 -+++ binutils-2.14.90.0.6/bfd/opncls.c	2003-09-10 22:35:00.000000000 +0100
   27.33 -@@ -150,6 +150,13 @@
   27.34 - {
   27.35 -   bfd *nbfd;
   27.36 -   const bfd_target *target_vec;
   27.37 -+  struct stat s;
   27.38 -+
   27.39 -+  if (stat (filename, &s) == 0)
   27.40 -+    if (S_ISDIR(s.st_mode)) {
   27.41 -+      bfd_set_error (bfd_error_file_not_recognized);
   27.42 -+      return NULL;
   27.43 -+    }
   27.44 - 
   27.45 -   nbfd = _bfd_new_bfd ();
   27.46 -   if (nbfd == NULL)
    28.1 --- a/patches/binutils/2.20/280-unexport_LD_LIBRARY_PATH.patch	Sun Sep 11 18:28:45 2011 +0200
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,95 +0,0 @@
    28.4 -Description:
    28.5 -
    28.6 -This patch is needed in situations where build system is running same version of
    28.7 -binutils that is intended to be built  cross-native ( build != host = target)
    28.8 - and has shared libraries enabled. binutils/binutils
    28.9 -Makefile has some tools which are built to run on build system. Toplevel makefile
   28.10 -for binutils passes HOST_EXPORTS to sub-makefiles which also include RPATH_ENVVARS
   28.11 -containing LD_LIBRARY_PATH which is modified so that it also includes host libraries
   28.12 -like opcodes and libbfd which are just built for the host system. 
   28.13 -
   28.14 -Now the problem is that same LD_LIBRARY_PATH value gets set in environment even
   28.15 -for the tools that are being built for build system using CC_FOR_BUILD and the tools
   28.16 -like as,ld it invokes from build machine get the LD_LIBRARY_PATH set to search
   28.17 -the newly build host libraries like opcodes and bfd and if host is like a big endian
   28.18 -system say (mips-linux) the build system linker and assembler do not run because
   28.19 -ld.so tries to load these shared libraries instead of the ones from /usr/lib for 
   28.20 -the build tools. 
   28.21 -
   28.22 -This patch fixes the issue by clearing LD_LIBRARY_PATH for BUILD tools
   28.23 -
   28.24 -This patch would be needed on other versions of binutils. I just cared about 2.20
   28.25 -May be upstream is also interested in such a patch.
   28.26 -
   28.27 --Khem
   28.28 -
   28.29 -Index: binutils-2.20/binutils/Makefile.am
   28.30 -===================================================================
   28.31 ---- binutils-2.20.orig/binutils/Makefile.am	2009-12-30 15:30:35.302438121 -0800
   28.32 -+++ binutils-2.20/binutils/Makefile.am	2009-12-30 15:33:09.154420373 -0800
   28.33 -@@ -251,24 +251,24 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sy
   28.34 - 	./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
   28.35 - 
   28.36 - sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
   28.37 --	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
   28.38 -+	LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
   28.39 - 
   28.40 - syslex.o: syslex.c sysinfo.h config.h
   28.41 - 	if [ -r syslex.c ]; then \
   28.42 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
   28.43 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
   28.44 - 	else \
   28.45 --	  $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
   28.46 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
   28.47 - 	fi
   28.48 - 
   28.49 - sysinfo.o: sysinfo.c
   28.50 - 	if [ -r sysinfo.c ]; then \
   28.51 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
   28.52 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
   28.53 - 	else \
   28.54 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
   28.55 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
   28.56 - 	fi
   28.57 - 
   28.58 - bin2c$(EXEEXT_FOR_BUILD):
   28.59 --	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
   28.60 -+	LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
   28.61 - 
   28.62 - embedspu: embedspu.sh
   28.63 - 	sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
   28.64 -Index: binutils-2.20/binutils/Makefile.in
   28.65 -===================================================================
   28.66 ---- binutils-2.20.orig/binutils/Makefile.in	2009-12-30 15:30:44.582922535 -0800
   28.67 -+++ binutils-2.20/binutils/Makefile.in	2009-12-30 15:33:47.322422313 -0800
   28.68 -@@ -1193,24 +1193,24 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sy
   28.69 - 	./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
   28.70 - 
   28.71 - sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
   28.72 --	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
   28.73 -+	LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
   28.74 - 
   28.75 - syslex.o: syslex.c sysinfo.h config.h
   28.76 - 	if [ -r syslex.c ]; then \
   28.77 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
   28.78 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
   28.79 - 	else \
   28.80 --	  $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
   28.81 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
   28.82 - 	fi
   28.83 - 
   28.84 - sysinfo.o: sysinfo.c
   28.85 - 	if [ -r sysinfo.c ]; then \
   28.86 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
   28.87 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
   28.88 - 	else \
   28.89 --	  $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
   28.90 -+	  LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
   28.91 - 	fi
   28.92 - 
   28.93 - bin2c$(EXEEXT_FOR_BUILD):
   28.94 --	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
   28.95 -+	LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
   28.96 - 
   28.97 - embedspu: embedspu.sh
   28.98 - 	sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
    29.1 --- a/patches/binutils/2.20/290-ld-stub-crash.patch	Sun Sep 11 18:28:45 2011 +0200
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,22 +0,0 @@
    29.4 -diff -p -c -u -r1.196 elf32-arm.c
    29.5 ---- a/bfd/elf32-arm.c	22 May 2009 11:58:44 -0000	1.196
    29.6 -+++ b/bfd/elf32-arm.c	12 Jun 2009 13:18:20 -0000
    29.7 -@@ -3175,11 +3175,15 @@ arm_type_of_stub (struct bfd_link_info *
    29.8 - 
    29.9 - 	  /* We have an extra 2-bytes reach because of
   29.10 - 	     the mode change (bit 24 (H) of BLX encoding).  */
   29.11 -+	  /* A stub is needed only if this call is not throught a PLT
   29.12 -+	     entry, because PLT stubs handle mode switching
   29.13 -+	     already.  */
   29.14 - 	  if (branch_offset > (ARM_MAX_FWD_BRANCH_OFFSET + 2)
   29.15 - 	      || (branch_offset < ARM_MAX_BWD_BRANCH_OFFSET)
   29.16 --	      || ((r_type == R_ARM_CALL) && !globals->use_blx)
   29.17 --	      || (r_type == R_ARM_JUMP24)
   29.18 --	      || (r_type == R_ARM_PLT32))
   29.19 -+	      || ( (((r_type == R_ARM_CALL) && !globals->use_blx)
   29.20 -+		    || (r_type == R_ARM_JUMP24)
   29.21 -+		    || (r_type == R_ARM_PLT32))
   29.22 -+		   && !use_plt))
   29.23 - 	    {
   29.24 - 	      stub_type = (info->shared | globals->pic_veneer)
   29.25 - 		/* PIC stubs.  */
    30.1 --- a/patches/binutils/2.20/300-mips64-defaultemul.patch	Sun Sep 11 18:28:45 2011 +0200
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,18 +0,0 @@
    30.4 ---- binutils-2.20/ld/configure.tgt.orig	2010-02-20 04:05:31.000000000 -0500
    30.5 -+++ binutils-2.20/ld/configure.tgt	2010-02-20 04:08:11.000000000 -0500
    30.6 -@@ -400,11 +400,11 @@
    30.7 - mips*-*-vxworks*)	targ_emul=elf32ebmipvxworks
    30.8 - 		        targ_extra_emuls="elf32elmipvxworks" ;;
    30.9 - mips*-*-windiss)	targ_emul=elf32mipswindiss ;;
   30.10 --mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
   30.11 --			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
   30.12 -+mips64*el-*-linux-*)	targ_emul=elf64ltsmip
   30.13 -+			targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
   30.14 - 			targ_extra_libpath=$targ_extra_emuls ;;
   30.15 --mips64*-*-linux-*)	targ_emul=elf32btsmipn32
   30.16 --			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
   30.17 -+mips64*-*-linux-*)	targ_emul=elf64btsmip
   30.18 -+			targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
   30.19 - 			targ_extra_libpath=$targ_extra_emuls ;;
   30.20 - mips*el-*-linux-*)	targ_emul=elf32ltsmip
   30.21 - 			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"