summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2007-01-16 14:56:31 +0000
committerH.J. Lu <hjl@lucon.org>2007-01-16 14:56:31 +0000
commitfa08342a32c8eba139bdabffd515df8c8c72a27a (patch)
tree4bf97b121dcbdadee154d44754ba1f4418cd0f61 /bfd/elflink.c
parentb79d0fc4ce9d78620de0b1e10d99726a8fb76262 (diff)
downloadgdb-fa08342a32c8eba139bdabffd515df8c8c72a27a.tar.gz
bfd/
2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 10b9bcd0b13..9630709758b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -438,14 +438,22 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
void
bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
- struct bfd_elf_dynamic_list *d = info->dynamic;
+ struct bfd_elf_dynamic_list *d = info->dynamic_list;
- if (d == NULL || info->relocatable)
+ /* It may be called more than once on the same H. */
+ if(h->dynamic || info->relocatable)
return;
- if ((*d->match) (&d->head, NULL, h->root.root.string))
+ if ((info->dynamic_data
+ && (h->type == STT_OBJECT
+ || (sym != NULL
+ && ELF_ST_TYPE (sym->st_info) == STT_OBJECT)))
+ || (d != NULL
+ && h->root.type == bfd_link_hash_new
+ && (*d->match) (&d->head, NULL, h->root.root.string)))
h->dynamic = 1;
}
@@ -483,7 +491,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
if (h->root.type == bfd_link_hash_new)
{
- bfd_elf_link_mark_dynamic_symbol (info, h);
+ bfd_elf_link_mark_dynamic_symbol (info, h, NULL);
h->non_elf = 0;
}
@@ -861,13 +869,17 @@ _bfd_elf_merge_symbol (bfd *abfd,
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* We have to check it for every instance since the first few may be
+ refereences and not all compilers emit symbol type for undefined
+ symbols. */
+ bfd_elf_link_mark_dynamic_symbol (info, h, sym);
+
/* If we just created the symbol, mark it as being an ELF symbol.
Other than that, there is nothing to do--there is no merge issue
with a newly defined symbol--so we just return. */
if (h->root.type == bfd_link_hash_new)
{
- bfd_elf_link_mark_dynamic_symbol (info, h);
h->non_elf = 0;
return TRUE;
}