]> git.pld-linux.org Git - packages/binutils.git/blob - binutils-weakdef.patch
- rel 3; upstream fix for noop on < i686; run test suite
[packages/binutils.git] / binutils-weakdef.patch
1 From f5edd1ac0e79c0356c6a1e2beffcadc0c532be98 Mon Sep 17 00:00:00 2001
2 From: Alan Modra <amodra@bigpond.net.au>
3 Date: Wed, 8 Feb 2012 10:12:19 +0000
4 Subject: [PATCH]        * elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
5         (_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
6         the correct h->u.weakdef.
7
8 ---
9  bfd/ChangeLog |    6 ++++++
10  bfd/elflink.c |   26 +++++++++++++++-----------
11  2 files changed, 21 insertions(+), 11 deletions(-)
12
13 diff --git a/bfd/elflink.c b/bfd/elflink.c
14 index 1d1ca0b..7f9ec60 100644
15 --- a/bfd/elflink.c
16 +++ b/bfd/elflink.c
17 @@ -2510,23 +2510,21 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
18       over to the real definition.  */
19    if (h->u.weakdef != NULL)
20      {
21 -      struct elf_link_hash_entry *weakdef;
22 -
23 -      weakdef = h->u.weakdef;
24 -      while (h->root.type == bfd_link_hash_indirect)
25 -       h = (struct elf_link_hash_entry *) h->root.u.i.link;
26 -
27 -      BFD_ASSERT (h->root.type == bfd_link_hash_defined
28 -                 || h->root.type == bfd_link_hash_defweak);
29 -      BFD_ASSERT (weakdef->def_dynamic);
30 -
31        /* If the real definition is defined by a regular object file,
32          don't do anything special.  See the longer description in
33          _bfd_elf_adjust_dynamic_symbol, below.  */
34 -      if (weakdef->def_regular)
35 +      if (h->u.weakdef->def_regular)
36         h->u.weakdef = NULL;
37        else
38         {
39 +         struct elf_link_hash_entry *weakdef = h->u.weakdef;
40 +
41 +         while (h->root.type == bfd_link_hash_indirect)
42 +           h = (struct elf_link_hash_entry *) h->root.u.i.link;
43 +
44 +         BFD_ASSERT (h->root.type == bfd_link_hash_defined
45 +                     || h->root.type == bfd_link_hash_defweak);
46 +         BFD_ASSERT (weakdef->def_dynamic);
47           BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
48                       || weakdef->root.type == bfd_link_hash_defweak);
49           (*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h);
50 @@ -11575,6 +11573,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
51              || h->root.type == bfd_link_hash_warning)
52         h = (struct elf_link_hash_entry *) h->root.u.i.link;
53        h->mark = 1;
54 +      /* If this symbol is weak and there is a non-weak definition, we
55 +        keep the non-weak definition because many backends put
56 +        dynamic reloc info on the non-weak definition for code
57 +        handling copy relocs.  */
58 +      if (h->u.weakdef != NULL)
59 +       h->u.weakdef->mark = 1;
60        return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
61      }
62  
63 -- 
64 1.7.3.4
65
This page took 0.029257 seconds and 3 git commands to generate.