patches/binutils/2.22/999-ppc-textrels.patch
changeset 2810 43a3cb39a786
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.22/999-ppc-textrels.patch	Wed Dec 14 19:57:47 2011 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +http://bugs.gentoo.org/392645
     1.5 +http://sourceware.org/bugzilla/show_bug.cgi?id=13470
     1.6 +
     1.7 +2011-12-03  Alan Modra  <amodra@gmail.com>
     1.8 +
     1.9 +	PR ld/13470
    1.10 +	* elf32-ppc.c (ppc_elf_copy_indirect_symbol): Revert substantive
    1.11 +	change in 2011-07-01 commit.  Comment.
    1.12 +	* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
    1.13 +
    1.14 +diff -durN binutils-2.22.orig/bfd/elf32-ppc.c binutils-2.22/bfd/elf32-ppc.c
    1.15 +--- binutils-2.22.orig/bfd/elf32-ppc.c	2011-11-21 10:29:21.000000000 +0100
    1.16 ++++ binutils-2.22/bfd/elf32-ppc.c	2011-12-14 19:52:43.308784395 +0100
    1.17 +@@ -2987,10 +2987,6 @@
    1.18 +   edir->elf.needs_plt |= eind->elf.needs_plt;
    1.19 +   edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
    1.20 + 
    1.21 +-  /* If we were called to copy over info for a weak sym, that's all.  */
    1.22 +-  if (eind->elf.root.type != bfd_link_hash_indirect)
    1.23 +-    return;
    1.24 +-
    1.25 +   if (eind->dyn_relocs != NULL)
    1.26 +     {
    1.27 +       if (edir->dyn_relocs != NULL)
    1.28 +@@ -3022,6 +3018,16 @@
    1.29 +       eind->dyn_relocs = NULL;
    1.30 +     }
    1.31 + 
    1.32 ++  /* If we were called to copy over info for a weak sym, that's all.
    1.33 ++     You might think dyn_relocs need not be copied over;  After all,
    1.34 ++     both syms will be dynamic or both non-dynamic so we're just
    1.35 ++     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    1.36 ++     code in ppc_elf_adjust_dynamic_symbol needs to check for
    1.37 ++     dyn_relocs in read-only sections, and it does so on what is the
    1.38 ++     DIR sym here.  */
    1.39 ++  if (eind->elf.root.type != bfd_link_hash_indirect)
    1.40 ++    return;
    1.41 ++
    1.42 +   /* Copy over the GOT refcount entries that we may have already seen to
    1.43 +      the symbol which just became indirect.  */
    1.44 +   edir->elf.got.refcount += eind->elf.got.refcount;
    1.45 +diff -durN binutils-2.22.orig/bfd/elf64-ppc.c binutils-2.22/bfd/elf64-ppc.c
    1.46 +--- binutils-2.22.orig/bfd/elf64-ppc.c	2011-11-21 10:29:24.000000000 +0100
    1.47 ++++ binutils-2.22/bfd/elf64-ppc.c	2011-12-14 19:52:43.336784395 +0100
    1.48 +@@ -4435,10 +4435,6 @@
    1.49 +   edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
    1.50 +   edir->elf.needs_plt |= eind->elf.needs_plt;
    1.51 + 
    1.52 +-  /* If we were called to copy over info for a weak sym, that's all.  */
    1.53 +-  if (eind->elf.root.type != bfd_link_hash_indirect)
    1.54 +-    return;
    1.55 +-
    1.56 +   /* Copy over any dynamic relocs we may have on the indirect sym.  */
    1.57 +   if (eind->dyn_relocs != NULL)
    1.58 +     {
    1.59 +@@ -4471,6 +4467,16 @@
    1.60 +       eind->dyn_relocs = NULL;
    1.61 +     }
    1.62 + 
    1.63 ++  /* If we were called to copy over info for a weak sym, that's all.
    1.64 ++     You might think dyn_relocs need not be copied over;  After all,
    1.65 ++     both syms will be dynamic or both non-dynamic so we're just
    1.66 ++     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    1.67 ++     code in ppc64_elf_adjust_dynamic_symbol needs to check for
    1.68 ++     dyn_relocs in read-only sections, and it does so on what is the
    1.69 ++     DIR sym here.  */
    1.70 ++  if (eind->elf.root.type != bfd_link_hash_indirect)
    1.71 ++    return;
    1.72 ++
    1.73 +   /* Copy over got entries that we may have already seen to the
    1.74 +      symbol which just became indirect.  */
    1.75 +   if (eind->elf.got.glist != NULL)