Add binutils-2.19 and associated patchset (vampirised from Gentoo).
/trunk/patches/binutils/2.19/120-sh-targets.patch | 52 52 0 0 ++++
/trunk/patches/binutils/2.19/180-use-relro.patch | 14 14 0 0 +
/trunk/patches/binutils/2.19/160-use-new-ld-dtags.patch | 14 14 0 0 +
/trunk/patches/binutils/2.19/100-ppc64-pie.patch | 20 20 0 0 +
/trunk/patches/binutils/2.19/190-libiberty-pic.patch | 14 14 0 0 +
/trunk/patches/binutils/2.19/170-generate-gnu-hash.patch | 16 16 0 0 +
/trunk/patches/binutils/2.19/110-RPATH_ENVVAR-smack.patch | 17 17 0 0 +
/trunk/patches/binutils/2.19/140-pt-pax-flags-20081101.patch | 249 249 0 0 +++++++++++++++++
/trunk/patches/binutils/2.19/150-warn-textrel.patch | 48 48 0 0 +++
/trunk/patches/binutils/2.19/130-check_ldrunpath_length.patch | 31 31 0 0 ++
/trunk/config/binutils.in | 5 5 0 0 +
11 files changed, 480 insertions(+)
1.1 --- a/config/binutils.in Fri Nov 21 17:46:42 2008 +0000
1.2 +++ b/config/binutils.in Sun Nov 23 16:34:49 2008 +0000
1.3 @@ -76,6 +76,10 @@
1.4 prompt "2.18.93 (EXPERIMENTAL)"
1.5 depends on EXPERIMENTAL
1.6
1.7 +config BINUTILS_V_2_19
1.8 + bool
1.9 + prompt "2.19"
1.10 +
1.11 config BINUTILS_V_2_19_50_0_1
1.12 bool
1.13 prompt "2.19.50.0.1 (EXPERIMENTAL)"
1.14 @@ -101,6 +105,7 @@
1.15 default "2.18.91" if BINUTILS_V_2_18_91
1.16 default "2.18.92" if BINUTILS_V_2_18_92
1.17 default "2.18.93" if BINUTILS_V_2_18_93
1.18 + default "2.19" if BINUTILS_V_2_19
1.19 default "2.19.50.0.1" if BINUTILS_V_2_19_50_0_1
1.20 # CT_INSERT_VERSION_STRING_ABOVE
1.21 # Don't remove above line!
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/binutils/2.19/100-ppc64-pie.patch Sun Nov 23 16:34:49 2008 +0000
2.3 @@ -0,0 +1,20 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/patches/binutils/2.19/110-RPATH_ENVVAR-smack.patch Sun Nov 23 16:34:49 2008 +0000
3.3 @@ -0,0 +1,17 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/binutils/2.19/120-sh-targets.patch Sun Nov 23 16:34:49 2008 +0000
4.3 @@ -0,0 +1,52 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/patches/binutils/2.19/130-check_ldrunpath_length.patch Sun Nov 23 16:34:49 2008 +0000
5.3 @@ -0,0 +1,31 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/binutils/2.19/140-pt-pax-flags-20081101.patch Sun Nov 23 16:34:49 2008 +0000
6.3 @@ -0,0 +1,249 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/patches/binutils/2.19/150-warn-textrel.patch Sun Nov 23 16:34:49 2008 +0000
7.3 @@ -0,0 +1,48 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/patches/binutils/2.19/160-use-new-ld-dtags.patch Sun Nov 23 16:34:49 2008 +0000
8.3 @@ -0,0 +1,14 @@
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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/patches/binutils/2.19/170-generate-gnu-hash.patch Sun Nov 23 16:34:49 2008 +0000
9.3 @@ -0,0 +1,16 @@
9.4 +Original patch from Gentoo:
9.5 +gentoo/src/patchsets/binutils/2.19/77_all_generate-gnu-hash.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:58:24.000000000 +0100
9.9 ++++ binutils-2.19/ld/ldmain.c 2008-11-23 16:58:33.000000000 +0100
9.10 +@@ -266,6 +266,9 @@
9.11 + link_info.combreloc = TRUE;
9.12 + link_info.strip_discarded = TRUE;
9.13 + link_info.emit_hash = TRUE;
9.14 ++#ifndef __mips__
9.15 ++ link_info.emit_gnu_hash = TRUE;
9.16 ++#endif
9.17 + link_info.callbacks = &link_callbacks;
9.18 + link_info.input_bfds_tail = &link_info.input_bfds;
9.19 + /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/patches/binutils/2.19/180-use-relro.patch Sun Nov 23 16:34:49 2008 +0000
10.3 @@ -0,0 +1,14 @@
10.4 +Original patch from Gentoo:
10.5 +gentoo/src/patchsets/binutils/2.19/78_all_use-relro.patch
10.6 +
10.7 +diff -durN binutils-2.19.orig/ld/ldmain.c binutils-2.19/ld/ldmain.c
10.8 +--- binutils-2.19.orig/ld/ldmain.c 2008-11-23 16:59:24.000000000 +0100
10.9 ++++ binutils-2.19/ld/ldmain.c 2008-11-23 16:59:45.000000000 +0100
10.10 +@@ -264,6 +264,7 @@
10.11 + link_info.keep_memory = TRUE;
10.12 + link_info.new_dtags = TRUE;
10.13 + link_info.combreloc = TRUE;
10.14 ++ link_info.relro = TRUE;
10.15 + link_info.strip_discarded = TRUE;
10.16 + link_info.emit_hash = TRUE;
10.17 + #ifndef __mips__
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/patches/binutils/2.19/190-libiberty-pic.patch Sun Nov 23 16:34:49 2008 +0000
11.3 @@ -0,0 +1,14 @@
11.4 +Original patch from Gentoo:
11.5 +gentoo/src/patchsets/binutils/2.19/91_all_libiberty-pic.patch
11.6 +
11.7 +diff -durN binutils-2.19.orig/libiberty/Makefile.in binutils-2.19/libiberty/Makefile.in
11.8 +--- binutils-2.19.orig/libiberty/Makefile.in 2008-07-24 15:51:49.000000000 +0200
11.9 ++++ binutils-2.19/libiberty/Makefile.in 2008-11-23 17:03:33.000000000 +0100
11.10 +@@ -227,6 +227,7 @@
11.11 + $(AR) $(AR_FLAGS) $(TARGETLIB) \
11.12 + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
11.13 + $(RANLIB) $(TARGETLIB); \
11.14 ++ cp $(TARGETLIB) ../ ; \
11.15 + cd ..; \
11.16 + else true; fi
11.17 +