binutils/binutils: add the patches used by BuildRoot for 2.22
author"Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Wed Dec 14 19:57:47 2011 +0100 (2011-12-14)
changeset 281043a3cb39a786
parent 2809 4cd9134739b5
child 2811 d74b5845f328
binutils/binutils: add the patches used by BuildRoot for 2.22

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
patches/binutils/2.22/120-sh-conf.patch
patches/binutils/2.22/300-001_ld_makefile_patch.patch
patches/binutils/2.22/300-012_check_ldrunpath_length.patch
patches/binutils/2.22/999-ppc-textrels.patch
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.22/120-sh-conf.patch	Wed Dec 14 19:57:47 2011 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +r10231 | lethal | 2005-05-02 09:58:00 -0400 (Mon, 02 May 2005) | 13 lines
     1.5 +
     1.6 +Likewise, binutils has no idea about any of these new targets either, so we 
     1.7 +fix that up too.. now we're able to actually build a real toolchain for 
     1.8 +sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more 
     1.9 +inept targets than that one, really. Go look, I promise).
    1.10 +
    1.11 +diff -durN binutils-2.22.orig/configure binutils-2.22/configure
    1.12 +--- binutils-2.22.orig/configure	2011-08-14 14:28:15.000000000 +0200
    1.13 ++++ binutils-2.22/configure	2011-12-14 19:49:40.284777434 +0100
    1.14 +@@ -3570,7 +3570,7 @@
    1.15 +   mips*-*-*)
    1.16 +     noconfigdirs="$noconfigdirs gprof"
    1.17 +     ;;
    1.18 +-  sh-*-* | sh64-*-*)
    1.19 ++  sh*-*-* | sh64-*-*)
    1.20 +     case "${target}" in
    1.21 +       sh*-*-elf)
    1.22 +          ;;
    1.23 +diff -durN binutils-2.22.orig/configure.ac binutils-2.22/configure.ac
    1.24 +--- binutils-2.22.orig/configure.ac	2011-11-21 12:58:27.000000000 +0100
    1.25 ++++ binutils-2.22/configure.ac	2011-12-14 19:49:40.316777436 +0100
    1.26 +@@ -1006,7 +1006,7 @@
    1.27 +   mips*-*-*)
    1.28 +     noconfigdirs="$noconfigdirs gprof"
    1.29 +     ;;
    1.30 +-  sh-*-* | sh64-*-*)
    1.31 ++  sh*-*-* | sh64-*-*)
    1.32 +     case "${target}" in
    1.33 +       sh*-*-elf)
    1.34 +          ;;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/binutils/2.22/300-001_ld_makefile_patch.patch	Wed Dec 14 19:57:47 2011 +0100
     2.3 @@ -0,0 +1,24 @@
     2.4 +diff -durN binutils-2.22.orig/ld/Makefile.am binutils-2.22/ld/Makefile.am
     2.5 +--- binutils-2.22.orig/ld/Makefile.am	2011-07-22 22:22:37.000000000 +0200
     2.6 ++++ binutils-2.22/ld/Makefile.am	2011-12-14 19:50:25.760779164 +0100
     2.7 +@@ -37,7 +37,7 @@
     2.8 + # We put the scripts in the directory $(scriptdir)/ldscripts.
     2.9 + # We can't put the scripts in $(datadir) because the SEARCH_DIR
    2.10 + # directives need to be different for native and cross linkers.
    2.11 +-scriptdir = $(tooldir)/lib
    2.12 ++scriptdir = $(libdir)
    2.13 + 
    2.14 + EMUL = @EMUL@
    2.15 + EMULATION_OFILES = @EMULATION_OFILES@
    2.16 +diff -durN binutils-2.22.orig/ld/Makefile.in binutils-2.22/ld/Makefile.in
    2.17 +--- binutils-2.22.orig/ld/Makefile.in	2011-07-22 22:22:37.000000000 +0200
    2.18 ++++ binutils-2.22/ld/Makefile.in	2011-12-14 19:50:25.784779163 +0100
    2.19 +@@ -366,7 +366,7 @@
    2.20 + # We put the scripts in the directory $(scriptdir)/ldscripts.
    2.21 + # We can't put the scripts in $(datadir) because the SEARCH_DIR
    2.22 + # directives need to be different for native and cross linkers.
    2.23 +-scriptdir = $(tooldir)/lib
    2.24 ++scriptdir = $(libdir)
    2.25 + BASEDIR = $(srcdir)/..
    2.26 + BFDDIR = $(BASEDIR)/bfd
    2.27 + INCDIR = $(BASEDIR)/include
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/binutils/2.22/300-012_check_ldrunpath_length.patch	Wed Dec 14 19:57:47 2011 +0100
     3.3 @@ -0,0 +1,21 @@
     3.4 +diff -durN binutils-2.22.orig/ld/emultempl/elf32.em binutils-2.22/ld/emultempl/elf32.em
     3.5 +--- binutils-2.22.orig/ld/emultempl/elf32.em	2011-11-21 10:29:39.000000000 +0100
     3.6 ++++ binutils-2.22/ld/emultempl/elf32.em	2011-12-14 19:52:12.880783238 +0100
     3.7 +@@ -1273,6 +1273,8 @@
     3.8 + 	      && command_line.rpath == NULL)
     3.9 + 	    {
    3.10 + 	      lib_path = (const char *) getenv ("LD_RUN_PATH");
    3.11 ++	      if ((lib_path) && (strlen (lib_path) == 0))
    3.12 ++	      	lib_path = NULL;
    3.13 + 	      if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
    3.14 + 						      force))
    3.15 + 		break;
    3.16 +@@ -1500,6 +1502,8 @@
    3.17 +   rpath = command_line.rpath;
    3.18 +   if (rpath == NULL)
    3.19 +     rpath = (const char *) getenv ("LD_RUN_PATH");
    3.20 ++  if ((rpath) && (strlen (rpath) == 0))
    3.21 ++  	rpath = NULL;
    3.22 + 
    3.23 +   for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
    3.24 +     if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/binutils/2.22/999-ppc-textrels.patch	Wed Dec 14 19:57:47 2011 +0100
     4.3 @@ -0,0 +1,72 @@
     4.4 +http://bugs.gentoo.org/392645
     4.5 +http://sourceware.org/bugzilla/show_bug.cgi?id=13470
     4.6 +
     4.7 +2011-12-03  Alan Modra  <amodra@gmail.com>
     4.8 +
     4.9 +	PR ld/13470
    4.10 +	* elf32-ppc.c (ppc_elf_copy_indirect_symbol): Revert substantive
    4.11 +	change in 2011-07-01 commit.  Comment.
    4.12 +	* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
    4.13 +
    4.14 +diff -durN binutils-2.22.orig/bfd/elf32-ppc.c binutils-2.22/bfd/elf32-ppc.c
    4.15 +--- binutils-2.22.orig/bfd/elf32-ppc.c	2011-11-21 10:29:21.000000000 +0100
    4.16 ++++ binutils-2.22/bfd/elf32-ppc.c	2011-12-14 19:52:43.308784395 +0100
    4.17 +@@ -2987,10 +2987,6 @@
    4.18 +   edir->elf.needs_plt |= eind->elf.needs_plt;
    4.19 +   edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
    4.20 + 
    4.21 +-  /* If we were called to copy over info for a weak sym, that's all.  */
    4.22 +-  if (eind->elf.root.type != bfd_link_hash_indirect)
    4.23 +-    return;
    4.24 +-
    4.25 +   if (eind->dyn_relocs != NULL)
    4.26 +     {
    4.27 +       if (edir->dyn_relocs != NULL)
    4.28 +@@ -3022,6 +3018,16 @@
    4.29 +       eind->dyn_relocs = NULL;
    4.30 +     }
    4.31 + 
    4.32 ++  /* If we were called to copy over info for a weak sym, that's all.
    4.33 ++     You might think dyn_relocs need not be copied over;  After all,
    4.34 ++     both syms will be dynamic or both non-dynamic so we're just
    4.35 ++     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    4.36 ++     code in ppc_elf_adjust_dynamic_symbol needs to check for
    4.37 ++     dyn_relocs in read-only sections, and it does so on what is the
    4.38 ++     DIR sym here.  */
    4.39 ++  if (eind->elf.root.type != bfd_link_hash_indirect)
    4.40 ++    return;
    4.41 ++
    4.42 +   /* Copy over the GOT refcount entries that we may have already seen to
    4.43 +      the symbol which just became indirect.  */
    4.44 +   edir->elf.got.refcount += eind->elf.got.refcount;
    4.45 +diff -durN binutils-2.22.orig/bfd/elf64-ppc.c binutils-2.22/bfd/elf64-ppc.c
    4.46 +--- binutils-2.22.orig/bfd/elf64-ppc.c	2011-11-21 10:29:24.000000000 +0100
    4.47 ++++ binutils-2.22/bfd/elf64-ppc.c	2011-12-14 19:52:43.336784395 +0100
    4.48 +@@ -4435,10 +4435,6 @@
    4.49 +   edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
    4.50 +   edir->elf.needs_plt |= eind->elf.needs_plt;
    4.51 + 
    4.52 +-  /* If we were called to copy over info for a weak sym, that's all.  */
    4.53 +-  if (eind->elf.root.type != bfd_link_hash_indirect)
    4.54 +-    return;
    4.55 +-
    4.56 +   /* Copy over any dynamic relocs we may have on the indirect sym.  */
    4.57 +   if (eind->dyn_relocs != NULL)
    4.58 +     {
    4.59 +@@ -4471,6 +4467,16 @@
    4.60 +       eind->dyn_relocs = NULL;
    4.61 +     }
    4.62 + 
    4.63 ++  /* If we were called to copy over info for a weak sym, that's all.
    4.64 ++     You might think dyn_relocs need not be copied over;  After all,
    4.65 ++     both syms will be dynamic or both non-dynamic so we're just
    4.66 ++     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    4.67 ++     code in ppc64_elf_adjust_dynamic_symbol needs to check for
    4.68 ++     dyn_relocs in read-only sections, and it does so on what is the
    4.69 ++     DIR sym here.  */
    4.70 ++  if (eind->elf.root.type != bfd_link_hash_indirect)
    4.71 ++    return;
    4.72 ++
    4.73 +   /* Copy over got entries that we may have already seen to the
    4.74 +      symbol which just became indirect.  */
    4.75 +   if (eind->elf.got.glist != NULL)