patches/binutils/2.22/999-ppc-textrels.patch
author Cody Schafer <dev@codyps.com>
Fri May 09 19:13:49 2014 -0700 (2014-05-09)
changeset 3312 4876ff97e039
permissions -rw-r--r--
cc/gcc: allow CC_EXTRA_CONFIG_ARRAY on baremetal

The final bare-metal compiler is built using the core backend.
Currently the core uses the CC_CORE_EXTRA_CONFIG_ARRAY variable.

While this works as supposed to, this can leave the user puzzled
in the menuconfig, since all he can see is the core options, not
the final options.

Only show the core options if any of the core passes are needed,
and use the final options in the core-backend if we're issuing
the bare-metal compiler.

Signed-off-by: Cody P Schafer <dev@codyps.com>
[yann.morin.1998@free.fr: hide core options if no core pass needed;
use final option in core backend if issuing the bare-metal compiler]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <22181e546ba746202489.1399688067@localhost>
Patchwork-Id: 347586
     1 http://bugs.gentoo.org/392645
     2 http://sourceware.org/bugzilla/show_bug.cgi?id=13470
     3 
     4 2011-12-03  Alan Modra  <amodra@gmail.com>
     5 
     6 	PR ld/13470
     7 	* elf32-ppc.c (ppc_elf_copy_indirect_symbol): Revert substantive
     8 	change in 2011-07-01 commit.  Comment.
     9 	* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.
    10 
    11 diff -durN binutils-2.22.orig/bfd/elf32-ppc.c binutils-2.22/bfd/elf32-ppc.c
    12 --- binutils-2.22.orig/bfd/elf32-ppc.c	2011-11-21 10:29:21.000000000 +0100
    13 +++ binutils-2.22/bfd/elf32-ppc.c	2011-12-14 19:52:43.308784395 +0100
    14 @@ -2987,10 +2987,6 @@
    15    edir->elf.needs_plt |= eind->elf.needs_plt;
    16    edir->elf.pointer_equality_needed |= eind->elf.pointer_equality_needed;
    17  
    18 -  /* If we were called to copy over info for a weak sym, that's all.  */
    19 -  if (eind->elf.root.type != bfd_link_hash_indirect)
    20 -    return;
    21 -
    22    if (eind->dyn_relocs != NULL)
    23      {
    24        if (edir->dyn_relocs != NULL)
    25 @@ -3022,6 +3018,16 @@
    26        eind->dyn_relocs = NULL;
    27      }
    28  
    29 +  /* If we were called to copy over info for a weak sym, that's all.
    30 +     You might think dyn_relocs need not be copied over;  After all,
    31 +     both syms will be dynamic or both non-dynamic so we're just
    32 +     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    33 +     code in ppc_elf_adjust_dynamic_symbol needs to check for
    34 +     dyn_relocs in read-only sections, and it does so on what is the
    35 +     DIR sym here.  */
    36 +  if (eind->elf.root.type != bfd_link_hash_indirect)
    37 +    return;
    38 +
    39    /* Copy over the GOT refcount entries that we may have already seen to
    40       the symbol which just became indirect.  */
    41    edir->elf.got.refcount += eind->elf.got.refcount;
    42 diff -durN binutils-2.22.orig/bfd/elf64-ppc.c binutils-2.22/bfd/elf64-ppc.c
    43 --- binutils-2.22.orig/bfd/elf64-ppc.c	2011-11-21 10:29:24.000000000 +0100
    44 +++ binutils-2.22/bfd/elf64-ppc.c	2011-12-14 19:52:43.336784395 +0100
    45 @@ -4435,10 +4435,6 @@
    46    edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak;
    47    edir->elf.needs_plt |= eind->elf.needs_plt;
    48  
    49 -  /* If we were called to copy over info for a weak sym, that's all.  */
    50 -  if (eind->elf.root.type != bfd_link_hash_indirect)
    51 -    return;
    52 -
    53    /* Copy over any dynamic relocs we may have on the indirect sym.  */
    54    if (eind->dyn_relocs != NULL)
    55      {
    56 @@ -4471,6 +4467,16 @@
    57        eind->dyn_relocs = NULL;
    58      }
    59  
    60 +  /* If we were called to copy over info for a weak sym, that's all.
    61 +     You might think dyn_relocs need not be copied over;  After all,
    62 +     both syms will be dynamic or both non-dynamic so we're just
    63 +     moving reloc accounting around.  However, ELIMINATE_COPY_RELOCS 
    64 +     code in ppc64_elf_adjust_dynamic_symbol needs to check for
    65 +     dyn_relocs in read-only sections, and it does so on what is the
    66 +     DIR sym here.  */
    67 +  if (eind->elf.root.type != bfd_link_hash_indirect)
    68 +    return;
    69 +
    70    /* Copy over got entries that we may have already seen to the
    71       symbol which just became indirect.  */
    72    if (eind->elf.got.glist != NULL)