diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2007-07-10 02:40:31 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2007-07-10 02:40:31 +0000 |
commit | 00cbee0aa8d8bc293d58a37fd5b970fd944dd397 (patch) | |
tree | 2002a08d204048ad8fda31c842aa0bc774c4d5cf /bfd | |
parent | e93cb65d4233b933cf3d7ebfef8206d1c9085551 (diff) | |
download | binutils-00cbee0aa8d8bc293d58a37fd5b970fd944dd397.zip binutils-00cbee0aa8d8bc293d58a37fd5b970fd944dd397.tar.gz binutils-00cbee0aa8d8bc293d58a37fd5b970fd944dd397.tar.bz2 |
2007-07-09 H.J. Lu <hongjiu.lu@intel.com>
* elflink.c (bfd_elf_record_link_assignment): Handle indirect
symbol.
(_bfd_elf_merge_symbol): Properly update normal symbol when
overriding the versioned symbol from a dynamic library.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elflink.c | 45 |
2 files changed, 41 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 95ea20e..7423dae 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2007-07-09 H.J. Lu <hongjiu.lu@intel.com> + + * elflink.c (bfd_elf_record_link_assignment): Handle indirect + symbol. + (_bfd_elf_merge_symbol): Properly update normal symbol when + overriding the versioned symbol from a dynamic library. + 2007-07-09 Roland McGrath <roland@redhat.com> * elf-bfd.h (struct elf_obj_tdata): Add members diff --git a/bfd/elflink.c b/bfd/elflink.c index 4de73a0..a68d736 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -468,8 +468,9 @@ bfd_elf_record_link_assignment (bfd *output_bfd, bfd_boolean provide, bfd_boolean hidden) { - struct elf_link_hash_entry *h; + struct elf_link_hash_entry *h, *hv; struct elf_link_hash_table *htab; + const struct elf_backend_data *bed; if (!is_elf_hash_table (info->hash)) return TRUE; @@ -479,21 +480,43 @@ bfd_elf_record_link_assignment (bfd *output_bfd, if (h == NULL) return provide; - /* Since we're defining the symbol, don't let it seem to have not - been defined. record_dynamic_symbol and size_dynamic_sections - may depend on this. */ - if (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined) + switch (h->root.type) { + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + case bfd_link_hash_common: + break; + case bfd_link_hash_undefweak: + case bfd_link_hash_undefined: + /* Since we're defining the symbol, don't let it seem to have not + been defined. record_dynamic_symbol and size_dynamic_sections + may depend on this. */ h->root.type = bfd_link_hash_new; if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root) bfd_link_repair_undef_list (&htab->root); - } - - if (h->root.type == bfd_link_hash_new) - { + break; + case bfd_link_hash_new: bfd_elf_link_mark_dynamic_symbol (info, h, NULL); h->non_elf = 0; + break; + case bfd_link_hash_indirect: + /* We had a versioned symbol in a dynamic library. We make the + the versioned symbol point to this one. */ + bed = get_elf_backend_data (output_bfd); + hv = h; + while (hv->root.type == bfd_link_hash_indirect + || hv->root.type == bfd_link_hash_warning) + hv = (struct elf_link_hash_entry *) hv->root.u.i.link; + /* We don't need to update h->root.u since linker will set them + later. */ + h->root.type = bfd_link_hash_undefined; + hv->root.type = bfd_link_hash_indirect; + hv->root.u.i.link = (struct bfd_link_hash_entry *) h; + (*bed->elf_backend_copy_indirect_symbol) (info, h, hv); + break; + case bfd_link_hash_warning: + abort (); + break; } /* If this symbol is being provided by the linker script, and it is @@ -1417,10 +1440,10 @@ _bfd_elf_merge_symbol (bfd *abfd, case, we make the versioned symbol point to the normal one. */ const struct elf_backend_data *bed = get_elf_backend_data (abfd); flip->root.type = h->root.type; + flip->root.u.undef.abfd = h->root.u.undef.abfd; h->root.type = bfd_link_hash_indirect; h->root.u.i.link = (struct bfd_link_hash_entry *) flip; (*bed->elf_backend_copy_indirect_symbol) (info, flip, h); - flip->root.u.undef.abfd = h->root.u.undef.abfd; if (h->def_dynamic) { h->def_dynamic = 0; |