1.1 --- a/config/binutils/binutils.in Wed Oct 28 19:00:34 2009 +0100
1.2 +++ b/config/binutils/binutils.in Tue Oct 27 20:06:46 2009 +0100
1.3 @@ -8,6 +8,10 @@
1.4 # Don't remove next line
1.5 # CT_INSERT_VERSION_BELOW
1.6
1.7 +config BINUTILS_V_2_20
1.8 + bool
1.9 + prompt "2.20"
1.10 +
1.11 config BINUTILS_V_2_19_1
1.12 bool
1.13 prompt "2.19.1"
1.14 @@ -34,6 +38,7 @@
1.15 string
1.16 # Don't remove next line
1.17 # CT_INSERT_VERSION_STRING_BELOW
1.18 + default "2.20" if BINUTILS_V_2_20
1.19 default "2.19.1" if BINUTILS_V_2_19_1
1.20 default "2.19" if BINUTILS_V_2_19
1.21 default "2.18" if BINUTILS_V_2_18
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/patches/binutils/2.20/100-ppc64-pie.patch Tue Oct 27 20:06:46 2009 +0100
2.3 @@ -0,0 +1,16 @@
2.4 +--- bfd/elf64-ppc.c.jj 2004-09-27 16:46:06.000000000 -0400
2.5 ++++ bfd/elf64-ppc.c 2004-10-04 09:09:50.000000000 -0400
2.6 +@@ -9681,7 +9681,12 @@ ppc64_elf_relocate_section (bfd *output_
2.7 + else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf)
2.8 + && !is_opd
2.9 + && r_type != R_PPC64_TOC)
2.10 +- outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
2.11 ++ {
2.12 ++ outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type);
2.13 ++ if (h->elf.dynindx == -1
2.14 ++ && h->elf.root.type == bfd_link_hash_undefweak)
2.15 ++ memset (&outrel, 0, sizeof outrel);
2.16 ++ }
2.17 + else
2.18 + {
2.19 + /* 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.20/110-RPATH_ENVVAR-smack.patch Tue Oct 27 20:06:46 2009 +0100
3.3 @@ -0,0 +1,13 @@
3.4 +http://sourceware.org/ml/binutils/2007-07/msg00401.html
3.5 +http://sourceware.org/bugzilla/show_bug.cgi?id=4970
3.6 +
3.7 +--- configure
3.8 ++++ configure
3.9 +@@ -5601,6 +5601,7 @@ case "${host}" in
3.10 + *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
3.11 + *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
3.12 + esac
3.13 ++RPATH_ENVVAR="cant_touch_this_nah_nah_nah"
3.14 +
3.15 + # On systems where the dynamic library environment variable is PATH,
3.16 + if test "$RPATH_ENVVAR" = PATH; then
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/patches/binutils/2.20/120-sh-targets.patch Tue Oct 27 20:06:46 2009 +0100
4.3 @@ -0,0 +1,47 @@
4.4 +r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
4.5 +
4.6 +Likewise, binutils has no idea about any of these new targets either, so we
4.7 +fix that up too.. now we're able to actually build a real toolchain for
4.8 +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
4.9 +inept targets than that one, really. Go look, I promise).
4.10 +
4.11 +--- binutils-2.16.90.0.2-dist/configure
4.12 ++++ binutils-2.16.90.0.2/configure
4.13 +@@ -1207,7 +1207,7 @@
4.14 + am33_2.0-*-linux*)
4.15 + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4.16 + ;;
4.17 +- sh-*-linux*)
4.18 ++ sh*-*-linux*)
4.19 + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4.20 + ;;
4.21 + sh*-*-pe|mips*-*-pe|*arm-wince-pe)
4.22 +@@ -1495,7 +1495,7 @@
4.23 + romp-*-*)
4.24 + noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
4.25 + ;;
4.26 +- sh-*-* | sh64-*-*)
4.27 ++ sh*-*-* | sh64-*-*)
4.28 + case "${host}" in
4.29 + i[3456789]86-*-vsta) ;; # don't add gprof back in
4.30 + i[3456789]86-*-go32*) ;; # don't add gprof back in
4.31 +--- binutils-2.16.90.0.2-dist/configure.ac
4.32 ++++ binutils-2.16.90.0.2/configure.ac
4.33 +@@ -424,7 +424,7 @@
4.34 + am33_2.0-*-linux*)
4.35 + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4.36 + ;;
4.37 +- sh-*-linux*)
4.38 ++ sh*-*-linux*)
4.39 + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
4.40 + ;;
4.41 + sh*-*-pe|mips*-*-pe|*arm-wince-pe)
4.42 +@@ -712,7 +712,7 @@
4.43 + romp-*-*)
4.44 + noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}"
4.45 + ;;
4.46 +- sh-*-* | sh64-*-*)
4.47 ++ sh*-*-* | sh64-*-*)
4.48 + case "${host}" in
4.49 + i[[3456789]]86-*-vsta) ;; # don't add gprof back in
4.50 + 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.20/130-ld-sysroot.patch Tue Oct 27 20:06:46 2009 +0100
5.3 @@ -0,0 +1,36 @@
5.4 +Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
5.5 +
5.6 +Always try to prepend the sysroot prefix to absolute filenames first.
5.7 +
5.8 +http://bugs.gentoo.org/275666
5.9 +http://sourceware.org/bugzilla/show_bug.cgi?id=10340
5.10 +
5.11 +--- ld/ldfile.c
5.12 ++++ ld/ldfile.c
5.13 +@@ -308,18 +308,24 @@
5.14 + directory first. */
5.15 + if (! entry->is_archive)
5.16 + {
5.17 +- if (entry->sysrooted && IS_ABSOLUTE_PATH (entry->filename))
5.18 ++ /* For absolute pathnames, try to always open the file in the
5.19 ++ sysroot first. If this fails, try to open the file at the
5.20 ++ given location. */
5.21 ++ entry->sysrooted = is_sysrooted_pathname(entry->filename, FALSE);
5.22 ++ if (IS_ABSOLUTE_PATH (entry->filename) && ld_sysroot && ! entry->sysrooted)
5.23 + {
5.24 + char *name = concat (ld_sysroot, entry->filename,
5.25 + (const char *) NULL);
5.26 + if (ldfile_try_open_bfd (name, entry))
5.27 + {
5.28 + entry->filename = name;
5.29 ++ entry->sysrooted = TRUE;
5.30 + return TRUE;
5.31 + }
5.32 + free (name);
5.33 + }
5.34 +- else if (ldfile_try_open_bfd (entry->filename, entry))
5.35 ++
5.36 ++ if (ldfile_try_open_bfd (entry->filename, entry))
5.37 + {
5.38 + entry->sysrooted = IS_ABSOLUTE_PATH (entry->filename)
5.39 + && is_sysrooted_pathname (entry->filename, TRUE);
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/patches/binutils/2.20/140-check_ldrunpath_length.patch Tue Oct 27 20:06:46 2009 +0100
6.3 @@ -0,0 +1,47 @@
6.4 +#!/bin/sh -e
6.5 +## 012_check_ldrunpath_length.dpatch by Chris Chimelis <chris@debian.org>
6.6 +##
6.7 +## All lines beginning with `## DP:' are a description of the patch.
6.8 +## DP: Only generate an RPATH entry if LD_RUN_PATH is not empty, for
6.9 +## DP: cases where -rpath isn't specified. (#151024)
6.10 +
6.11 +if [ $# -ne 1 ]; then
6.12 + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
6.13 + exit 1
6.14 +fi
6.15 +
6.16 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
6.17 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
6.18 +
6.19 +case "$1" in
6.20 + -patch) patch $patch_opts -p1 < $0;;
6.21 + -unpatch) patch $patch_opts -p1 -R < $0;;
6.22 + *)
6.23 + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
6.24 + exit 1;;
6.25 +esac
6.26 +
6.27 +exit 0
6.28 +
6.29 +@DPATCH@
6.30 +diff -urNad /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em binutils-2.15/ld/emultempl/elf32.em
6.31 +--- /home/james/debian/packages/binutils/new/binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:58.000000000 +0100
6.32 ++++ binutils-2.15/ld/emultempl/elf32.em 2004-05-21 23:12:59.000000000 +0100
6.33 +@@ -692,6 +692,8 @@
6.34 + && command_line.rpath == NULL)
6.35 + {
6.36 + lib_path = (const char *) getenv ("LD_RUN_PATH");
6.37 ++ if ((lib_path) && (strlen (lib_path) == 0))
6.38 ++ lib_path = NULL;
6.39 + if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
6.40 + force))
6.41 + break;
6.42 +@@ -871,6 +873,8 @@
6.43 + rpath = command_line.rpath;
6.44 + if (rpath == NULL)
6.45 + rpath = (const char *) getenv ("LD_RUN_PATH");
6.46 ++ if ((rpath) && (strlen (rpath) == 0))
6.47 ++ rpath = NULL;
6.48 + if (! (bfd_elf_size_dynamic_sections
6.49 + (output_bfd, command_line.soname, rpath,
6.50 + command_line.filter_shlib,
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/patches/binutils/2.20/150-pt-pax-flags-20090909.patch Tue Oct 27 20:06:46 2009 +0100
7.3 @@ -0,0 +1,238 @@
7.4 +--- binutils-2.20/bfd/elf-bfd.h
7.5 ++++ binutils-2.20/bfd/elf-bfd.h
7.6 +@@ -1527,6 +1527,9 @@ struct elf_obj_tdata
7.7 + /* Segment flags for the PT_GNU_STACK segment. */
7.8 + unsigned int stack_flags;
7.9 +
7.10 ++ /* Segment flags for the PT_PAX_FLAGS segment. */
7.11 ++ unsigned int pax_flags;
7.12 ++
7.13 + /* Symbol version definitions in external objects. */
7.14 + Elf_Internal_Verdef *verdef;
7.15 +
7.16 +--- binutils-2.20/bfd/elf.c
7.17 ++++ binutils-2.20/bfd/elf.c
7.18 +@@ -1081,6 +1081,7 @@ get_segment_type (unsigned int p_type)
7.19 + case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
7.20 + case PT_GNU_STACK: pt = "STACK"; break;
7.21 + case PT_GNU_RELRO: pt = "RELRO"; break;
7.22 ++ case PT_PAX_FLAGS: pt = "PAX_FLAGS"; break;
7.23 + default: pt = NULL; break;
7.24 + }
7.25 + return pt;
7.26 +@@ -2379,6 +2380,9 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index)
7.27 + case PT_GNU_RELRO:
7.28 + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro");
7.29 +
7.30 ++ case PT_PAX_FLAGS:
7.31 ++ return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "pax_flags");
7.32 ++
7.33 + default:
7.34 + /* Check for any processor-specific program segment types. */
7.35 + bed = get_elf_backend_data (abfd);
7.36 +@@ -3393,6 +3397,11 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info)
7.37 + ++segs;
7.38 + }
7.39 +
7.40 ++ {
7.41 ++ /* We need a PT_PAX_FLAGS segment. */
7.42 ++ ++segs;
7.43 ++ }
7.44 ++
7.45 + for (s = abfd->sections; s != NULL; s = s->next)
7.46 + {
7.47 + if ((s->flags & SEC_LOAD) != 0
7.48 +@@ -3972,6 +3981,20 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
7.49 + }
7.50 + }
7.51 +
7.52 ++ {
7.53 ++ amt = sizeof (struct elf_segment_map);
7.54 ++ m = bfd_zalloc (abfd, amt);
7.55 ++ if (m == NULL)
7.56 ++ goto error_return;
7.57 ++ m->next = NULL;
7.58 ++ m->p_type = PT_PAX_FLAGS;
7.59 ++ m->p_flags = elf_tdata (abfd)->pax_flags;
7.60 ++ m->p_flags_valid = 1;
7.61 ++
7.62 ++ *pm = m;
7.63 ++ pm = &m->next;
7.64 ++ }
7.65 ++
7.66 + free (sections);
7.67 + elf_tdata (abfd)->segment_map = mfirst;
7.68 + }
7.69 +@@ -5176,7 +5199,8 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
7.70 + 6. PT_TLS segment includes only SHF_TLS sections.
7.71 + 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments.
7.72 + 8. PT_DYNAMIC should not contain empty sections at the beginning
7.73 +- (with the possible exception of .dynamic). */
7.74 ++ (with the possible exception of .dynamic).
7.75 ++ 9. PT_PAX_FLAGS segments do not include any sections. */
7.76 + #define IS_SECTION_IN_INPUT_SEGMENT(section, segment, bed) \
7.77 + ((((segment->p_paddr \
7.78 + ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \
7.79 +@@ -5184,6 +5208,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
7.80 + && (section->flags & SEC_ALLOC) != 0) \
7.81 + || IS_NOTE (segment, section)) \
7.82 + && segment->p_type != PT_GNU_STACK \
7.83 ++ && segment->p_type != PT_PAX_FLAGS \
7.84 + && (segment->p_type != PT_TLS \
7.85 + || (section->flags & SEC_THREAD_LOCAL)) \
7.86 + && (segment->p_type == PT_LOAD \
7.87 +--- binutils-2.20/bfd/elflink.c
7.88 ++++ binutils-2.20/bfd/elflink.c
7.89 +@@ -5465,16 +5465,30 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
7.90 + return TRUE;
7.91 +
7.92 + bed = get_elf_backend_data (output_bfd);
7.93 ++
7.94 ++ elf_tdata (output_bfd)->pax_flags = PF_NORANDEXEC;
7.95 ++ if (info->execheap)
7.96 ++ elf_tdata (output_bfd)->pax_flags |= PF_NOMPROTECT;
7.97 ++ else if (info->noexecheap)
7.98 ++ elf_tdata (output_bfd)->pax_flags |= PF_MPROTECT;
7.99 ++
7.100 + if (info->execstack)
7.101 +- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
7.102 ++ {
7.103 ++ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
7.104 ++ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
7.105 ++ }
7.106 + else if (info->noexecstack)
7.107 +- elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
7.108 ++ {
7.109 ++ elf_tdata (output_bfd)->stack_flags = PF_R | PF_W;
7.110 ++ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
7.111 ++ }
7.112 + else
7.113 + {
7.114 + bfd *inputobj;
7.115 + asection *notesec = NULL;
7.116 + int exec = 0;
7.117 +
7.118 ++ elf_tdata (output_bfd)->pax_flags |= PF_NOEMUTRAMP;
7.119 + for (inputobj = info->input_bfds;
7.120 + inputobj;
7.121 + inputobj = inputobj->link_next)
7.122 +@@ -5487,7 +5501,11 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
7.123 + if (s)
7.124 + {
7.125 + if (s->flags & SEC_CODE)
7.126 +- exec = PF_X;
7.127 ++ {
7.128 ++ elf_tdata (output_bfd)->pax_flags &= ~PF_NOEMUTRAMP;
7.129 ++ elf_tdata (output_bfd)->pax_flags |= PF_EMUTRAMP;
7.130 ++ exec = PF_X;
7.131 ++ }
7.132 + notesec = s;
7.133 + }
7.134 + else if (bed->default_execstack)
7.135 +--- binutils-2.20/binutils/readelf.c
7.136 ++++ binutils-2.20/binutils/readelf.c
7.137 +@@ -2556,6 +2556,7 @@ get_segment_type (unsigned long p_type)
7.138 + return "GNU_EH_FRAME";
7.139 + case PT_GNU_STACK: return "GNU_STACK";
7.140 + case PT_GNU_RELRO: return "GNU_RELRO";
7.141 ++ case PT_PAX_FLAGS: return "PAX_FLAGS";
7.142 +
7.143 + default:
7.144 + if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
7.145 +--- binutils-2.20/include/bfdlink.h
7.146 ++++ binutils-2.20/include/bfdlink.h
7.147 +@@ -319,6 +319,14 @@ struct bfd_link_info
7.148 + /* TRUE if PT_GNU_RELRO segment should be created. */
7.149 + unsigned int relro: 1;
7.150 +
7.151 ++ /* TRUE if PT_PAX_FLAGS segment should be created with PF_NOMPROTECT
7.152 ++ flags. */
7.153 ++ unsigned int execheap: 1;
7.154 ++
7.155 ++ /* TRUE if PT_PAX_FLAGS segment should be created with PF_MPROTECT
7.156 ++ flags. */
7.157 ++ unsigned int noexecheap: 1;
7.158 ++
7.159 + /* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
7.160 + unsigned int warn_shared_textrel: 1;
7.161 +
7.162 +--- binutils-2.20/include/elf/common.h
7.163 ++++ binutils-2.20/include/elf/common.h
7.164 +@@ -422,6 +422,7 @@
7.165 + #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
7.166 + #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
7.167 + #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
7.168 ++#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* PaX flags */
7.169 +
7.170 + /* Program segment permissions, in program header p_flags field. */
7.171 +
7.172 +@@ -432,6 +433,21 @@
7.173 + #define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
7.174 + #define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
7.175 +
7.176 ++/* Flags to control PaX behavior. */
7.177 ++
7.178 ++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */
7.179 ++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */
7.180 ++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */
7.181 ++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */
7.182 ++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */
7.183 ++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */
7.184 ++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */
7.185 ++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */
7.186 ++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */
7.187 ++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */
7.188 ++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */
7.189 ++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */
7.190 ++
7.191 + /* Values for section header, sh_type field. */
7.192 +
7.193 + #define SHT_NULL 0 /* Section header table entry unused */
7.194 +--- binutils-2.20/ld/emultempl/elf32.em
7.195 ++++ binutils-2.20/ld/emultempl/elf32.em
7.196 +@@ -2159,6 +2159,16 @@ fragment <<EOF
7.197 + link_info.noexecstack = TRUE;
7.198 + link_info.execstack = FALSE;
7.199 + }
7.200 ++ else if (strcmp (optarg, "execheap") == 0)
7.201 ++ {
7.202 ++ link_info.execheap = TRUE;
7.203 ++ link_info.noexecheap = FALSE;
7.204 ++ }
7.205 ++ else if (strcmp (optarg, "noexecheap") == 0)
7.206 ++ {
7.207 ++ link_info.noexecheap = TRUE;
7.208 ++ link_info.execheap = FALSE;
7.209 ++ }
7.210 + EOF
7.211 +
7.212 + if test -n "$COMMONPAGESIZE"; then
7.213 +@@ -2237,6 +2247,8 @@ fragment <<EOF
7.214 + fprintf (file, _("\
7.215 + -z execstack Mark executable as requiring executable stack\n"));
7.216 + fprintf (file, _("\
7.217 ++ -z execheap Mark executable as requiring executable heap\n"));
7.218 ++ fprintf (file, _("\
7.219 + -z initfirst Mark DSO to be initialized first at runtime\n"));
7.220 + fprintf (file, _("\
7.221 + -z interpose Mark object to interpose all DSOs but executable\n"));
7.222 +@@ -2260,6 +2272,8 @@ fragment <<EOF
7.223 + -z nodump Mark DSO not available to dldump\n"));
7.224 + fprintf (file, _("\
7.225 + -z noexecstack Mark executable as not requiring executable stack\n"));
7.226 ++ fprintf (file, _("\
7.227 ++ -z noexecheap Mark executable as not requiring executable heap\n"));
7.228 + EOF
7.229 +
7.230 + if test -n "$COMMONPAGESIZE"; then
7.231 +--- binutils-2.20/ld/ldgram.y
7.232 ++++ binutils-2.20/ld/ldgram.y
7.233 +@@ -1116,6 +1116,8 @@ phdr_type:
7.234 + $$ = exp_intop (0x6474e550);
7.235 + else if (strcmp (s, "PT_GNU_STACK") == 0)
7.236 + $$ = exp_intop (0x6474e551);
7.237 ++ else if (strcmp (s, "PT_PAX_FLAGS") == 0)
7.238 ++ $$ = exp_intop (0x65041580);
7.239 + else
7.240 + {
7.241 + einfo (_("\
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/patches/binutils/2.20/160-amd64-32bit-path.patch Tue Oct 27 20:06:46 2009 +0100
8.3 @@ -0,0 +1,16 @@
8.4 +--- binutils/ld/emulparams/elf_i386.sh
8.5 ++++ binutils/ld/emulparams/elf_i386.sh
8.6 +@@ -13,3 +13,13 @@
8.7 + NO_SMALL_DATA=yes
8.8 + SEPARATE_GOTPLT=12
8.9 + IREL_IN_PLT=
8.10 ++
8.11 ++# In Gentoo, we install 32bit libs into /lib32 in an
8.12 ++# ABI setup with amd64/x86
8.13 ++case "$target" in
8.14 ++ x86_64*-linux*)
8.15 ++ case "$EMULATION_NAME" in
8.16 ++ *i386*) LIBPATH_SUFFIX=32 ;;
8.17 ++ esac
8.18 ++ ;;
8.19 ++esac
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/patches/binutils/2.20/170-warn-textrel.patch Tue Oct 27 20:06:46 2009 +0100
9.3 @@ -0,0 +1,59 @@
9.4 +textrels are bad for forcing copy-on-write (this affects everyone),
9.5 +and for security/runtime code generation, this affects security ppl.
9.6 +But in either case, it doesn't matter who needs textrels, it's
9.7 +the very fact that they're needed at all.
9.8 +
9.9 +2006-06-10 Ned Ludd <solar@gentoo.org>, Mike Frysinger <vapier@gentoo.org>
9.10 +
9.11 + * bfd/elflink.c (bfd_elf_final_link): Check all objects for TEXTRELs.
9.12 + * ld/ldmain.c (main): Change textrel warning default to true.
9.13 + * ld/testsuite/lib/ld-lib.exp (default_ld_simple_link): Scrub TEXTREL
9.14 + warnings from ld output.
9.15 +
9.16 +--- bfd/elflink.c
9.17 ++++ bfd/elflink.c
9.18 +@@ -8652,14 +8652,12 @@
9.19 + goto error_return;
9.20 +
9.21 + /* Check for DT_TEXTREL (late, in case the backend removes it). */
9.22 +- if (info->warn_shared_textrel && info->shared)
9.23 ++ o = bfd_get_section_by_name (dynobj, ".dynamic");
9.24 ++ if (info->warn_shared_textrel && o != NULL)
9.25 + {
9.26 + bfd_byte *dyncon, *dynconend;
9.27 +
9.28 + /* Fix up .dynamic entries. */
9.29 +- o = bfd_get_section_by_name (dynobj, ".dynamic");
9.30 +- BFD_ASSERT (o != NULL);
9.31 +-
9.32 + dyncon = o->contents;
9.33 + dynconend = o->contents + o->size;
9.34 + for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
9.35 +@@ -8702,7 +8702,7 @@ bfd_elf_final_link (bfd *abfd, struct bf
9.36 + if (dyn.d_tag == DT_TEXTREL)
9.37 + {
9.38 + info->callbacks->einfo
9.39 +- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
9.40 ++ (_("%P: warning: creating a DT_TEXTREL in object.\n"));
9.41 + break;
9.42 + }
9.43 + }
9.44 +--- ld/ldmain.c
9.45 ++++ ld/ldmain.c
9.46 +@@ -282,2 +282,3 @@ main (int argc, char **argv)
9.47 + link_info.spare_dynamic_tags = 5;
9.48 ++ link_info.warn_shared_textrel = TRUE;
9.49 + link_info.sharable_sections = FALSE;
9.50 +--- ld/testsuite/lib/ld-lib.exp
9.51 ++++ ld/testsuite/lib/ld-lib.exp
9.52 +@@ -181,6 +181,10 @@ proc default_ld_simple_link { ld target
9.53 + # symbol, since the default linker script might use ENTRY.
9.54 + regsub -all "(^|\n)(\[^\n\]*: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
9.55 +
9.56 ++ # Gentoo tweak:
9.57 ++ # We want to ignore TEXTREL warnings since we force enable them by default
9.58 ++ regsub -all "^lt-ld-new: warning: creating a DT_TEXTREL in object\." $exec_output "\\1" exec_output
9.59 ++
9.60 + if [string match "" $exec_output] then {
9.61 + return 1
9.62 + } else {
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/patches/binutils/2.20/180-only-use-new-ld-dtags.patch.disabled Tue Oct 27 20:06:46 2009 +0100
10.3 @@ -0,0 +1,25 @@
10.4 +Don't generate RPATH if we're going to be generating RUNPATH.
10.5 +
10.6 +need to ponder what ramifications this has before enabling it
10.7 +
10.8 +--- binutils/bfd/elflink.c
10.9 ++++ binutils/bfd/elflink.c
10.10 +@@ -5382,11 +5382,15 @@
10.11 +
10.12 + indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath,
10.13 + TRUE);
10.14 +- if (indx == (bfd_size_type) -1
10.15 +- || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
10.16 ++ if (indx == (bfd_size_type) -1)
10.17 + return FALSE;
10.18 +
10.19 +- if (info->new_dtags)
10.20 ++ if (!info->new_dtags)
10.21 ++ {
10.22 ++ if (!_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx))
10.23 ++ return FALSE;
10.24 ++ }
10.25 ++ else
10.26 + {
10.27 + _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx);
10.28 + if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx))
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/patches/binutils/2.20/190-use-new-ld-dtags.patch Tue Oct 27 20:06:46 2009 +0100
11.3 @@ -0,0 +1,10 @@
11.4 +--- binutils/ld/ldmain.c
11.5 ++++ binutils/ld/ldmain.c
11.6 +@@ -296,6 +296,7 @@ main (int argc, char **argv)
11.7 +
11.8 + link_info.allow_undefined_version = TRUE;
11.9 + link_info.keep_memory = TRUE;
11.10 ++ link_info.new_dtags = TRUE;
11.11 + link_info.combreloc = TRUE;
11.12 + link_info.strip_discarded = TRUE;
11.13 + link_info.callbacks = &link_callbacks;
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/patches/binutils/2.20/200-document-new-dtags-behaviour.patch Tue Oct 27 20:06:46 2009 +0100
12.3 @@ -0,0 +1,16 @@
12.4 +Index: binutils-2.19.51.0.5/ld/ld.texinfo
12.5 +===================================================================
12.6 +--- binutils-2.19.51.0.5.orig/ld/ld.texinfo
12.7 ++++ binutils-2.19.51.0.5/ld/ld.texinfo
12.8 +@@ -2036,8 +2036,9 @@ This linker can create the new dynamic t
12.9 + systems may not understand them. If you specify
12.10 + @option{--enable-new-dtags}, the dynamic tags will be created as needed.
12.11 + If you specify @option{--disable-new-dtags}, no new dynamic tags will be
12.12 +-created. By default, the new dynamic tags are not created. Note that
12.13 +-those options are only available for ELF systems.
12.14 ++created. On Gentoo, by default, the new dynamic tags are created (this
12.15 ++differs from upstream behaviour). Note that those options are only
12.16 ++available for ELF systems.
12.17 +
12.18 + @kindex --hash-size=@var{number}
12.19 + @item --hash-size=@var{number}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/patches/binutils/2.20/210-generate-gnu-hash.patch Tue Oct 27 20:06:46 2009 +0100
13.3 @@ -0,0 +1,8 @@
13.4 +--- binutils/ld/ldmain.c
13.5 ++++ binutils/ld/ldmain.c
13.6 +@@ -273,2 +273,5 @@ main (int argc, char **argv)
13.7 + link_info.emit_hash = TRUE;
13.8 ++#ifndef __mips__
13.9 ++ link_info.emit_gnu_hash = TRUE;
13.10 ++#endif
13.11 + link_info.callbacks = &link_callbacks;
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/patches/binutils/2.20/220-use-relro.patch Tue Oct 27 20:06:46 2009 +0100
14.3 @@ -0,0 +1,6 @@
14.4 +--- binutils/ld/ldmain.c
14.5 ++++ binutils/ld/ldmain.c
14.6 +@@ -293,2 +293,3 @@ main (int argc, char **argv)
14.7 + link_info.combreloc = TRUE;
14.8 ++ link_info.relro = TRUE;
14.9 + link_info.strip_discarded = TRUE;
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/patches/binutils/2.20/230-libiberty-pic.patch Tue Oct 27 20:06:46 2009 +0100
15.3 @@ -0,0 +1,10 @@
15.4 +--- libiberty/Makefile.in.mps 2004-05-13 15:53:17.000000000 +0200
15.5 ++++ libiberty/Makefile.in 2004-05-13 15:52:53.000000000 +0200
15.6 +@@ -224,6 +224,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA
15.7 + $(AR) $(AR_FLAGS) $(TARGETLIB) \
15.8 + $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
15.9 + $(RANLIB) $(TARGETLIB); \
15.10 ++ cp $(TARGETLIB) ../ ; \
15.11 + cd ..; \
15.12 + else true; fi
15.13 +