diff options
author | Alan Modra <amodra@gmail.com> | 2012-02-08 10:12:20 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2012-02-08 10:12:20 +0000 |
commit | 4e6b54a6ea3700a5babd9f6ec03ea23ae736d37b (patch) | |
tree | 6d7da2b21422fdd39f62d3756f1b301a14e640a9 /bfd | |
parent | 4b2d20a563f2320bb7aa14e35d20f89b19f07ff6 (diff) | |
download | gdb-4e6b54a6ea3700a5babd9f6ec03ea23ae736d37b.zip gdb-4e6b54a6ea3700a5babd9f6ec03ea23ae736d37b.tar.gz gdb-4e6b54a6ea3700a5babd9f6ec03ea23ae736d37b.tar.bz2 |
* elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too.
(_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear
the correct h->u.weakdef.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elflink.c | 26 |
2 files changed, 21 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6d56dd4..4b896f2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2012-02-08 Alan Modra <amodra@gmail.com> + + * elflink.c (_bfd_elf_gc_mark_rsec): Mark weakdef syms too. + (_bfd_elf_fix_symbol_flags): When a weakdef is def_regular, clear + the correct h->u.weakdef. + 2012-02-07 Alan Modra <amodra@gmail.com> * elf.c (elf_find_function): Don't use internal_elf_sym. diff --git a/bfd/elflink.c b/bfd/elflink.c index 1d1ca0b..7f9ec60 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -2510,23 +2510,21 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, over to the real definition. */ if (h->u.weakdef != NULL) { - struct elf_link_hash_entry *weakdef; - - weakdef = h->u.weakdef; - while (h->root.type == bfd_link_hash_indirect) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - BFD_ASSERT (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak); - BFD_ASSERT (weakdef->def_dynamic); - /* If the real definition is defined by a regular object file, don't do anything special. See the longer description in _bfd_elf_adjust_dynamic_symbol, below. */ - if (weakdef->def_regular) + if (h->u.weakdef->def_regular) h->u.weakdef = NULL; else { + struct elf_link_hash_entry *weakdef = h->u.weakdef; + + while (h->root.type == bfd_link_hash_indirect) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + BFD_ASSERT (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak); + BFD_ASSERT (weakdef->def_dynamic); BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined || weakdef->root.type == bfd_link_hash_defweak); (*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, h); @@ -11575,6 +11573,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; h->mark = 1; + /* If this symbol is weak and there is a non-weak definition, we + keep the non-weak definition because many backends put + dynamic reloc info on the non-weak definition for code + handling copy relocs. */ + if (h->u.weakdef != NULL) + h->u.weakdef->mark = 1; return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL); } |