diff options
author | Jakub Jelinek <jakub@redhat.com> | 2003-10-22 06:58:17 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2003-10-22 06:58:17 +0000 |
commit | 108ba30509ad6169d0f2e06b755fa39a2c28a946 (patch) | |
tree | f08f61aaf06d9e7ba1789b24f137c266bb6fc80e /bfd | |
parent | a9b7fca23b894846cfca99db5bb1c9d06ea75a89 (diff) | |
download | gdb-108ba30509ad6169d0f2e06b755fa39a2c28a946.zip gdb-108ba30509ad6169d0f2e06b755fa39a2c28a946.tar.gz gdb-108ba30509ad6169d0f2e06b755fa39a2c28a946.tar.bz2 |
bfd/
* elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals
field changes.
(_bfd_elf_link_assign_sym_version): Likewise.
* elflink.h (size_dynamic_sections): Likewise.
include/
* bfdlink.h (struct bfd_elf_version_expr): Remove match field.
Add wildcard and mask fields.
(BFD_ELF_VERSION_C_TYPE): Define.
(BFD_ELF_VERSION_CXX_TYPE): Likewise.
(BFD_ELF_VERSION_JAVA_TYPE): Likewise.
(struct bfd_elf_version_expr_head): New.
(struct bfd_elf_version_tree): Add match field.
Change type of globals and locals fields
to struct bfd_elf_version_expr_head.
ld/
* ldlang.c: Include hashtab.h.
(lang_vers_match_lang_c, lang_vers_match_lang_cplusplus,
lang_vers_match_lang_java): Remove.
(lang_vers_match): New function.
(lang_new_vers_pattern): Initialize wildcard and mask
fields, don't initialize match.
(lang_new_vers_node): Use xcalloc. Adjust for globals and
locals field type changes. Set match field.
(version_expr_head_hash, version_expr_head_eq): New functions.
(lang_finalize_version_expr_head): New function.
(lang_register_vers_node): Call lang_finalize_version_expr_head.
Search in hash table if not wildcard when looking for duplicates.
* emultempl/ppc64elf.em (new_vers_pattern): Don't bother with
duplicate checking. Initialize all fields of dot_entry from entry
with the exception of pattern and next.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elflink.c | 111 | ||||
-rw-r--r-- | bfd/elflink.h | 8 |
3 files changed, 55 insertions, 71 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2a002c1..2d47b54 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2003-10-22 Jakub Jelinek <jakub@redhat.com> + + * elflink.c (_bfd_elf_export_symbol): Adjust for globals and locals + field changes. + (_bfd_elf_link_assign_sym_version): Likewise. + * elflink.h (size_dynamic_sections): Likewise. + 2003-10-21 Alexandre Oliva <aoliva@redhat.com>, Michael Snyder <msnyder@redhat.com> diff --git a/bfd/elflink.c b/bfd/elflink.c index 0e06903..19f6d4d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1505,22 +1505,18 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) for (t = eif->verdefs; t != NULL; t = t->next) { - if (t->globals != NULL) + if (t->globals.list != NULL) { - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - goto doit; - } + d = (*t->match) (&t->globals, NULL, h->root.root.string); + if (d != NULL) + goto doit; } - if (t->locals != NULL) + if (t->locals.list != NULL) { - for (d = t->locals ; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - return TRUE; - } + d = (*t->match) (&t->locals, NULL, h->root.root.string); + if (d != NULL) + return TRUE; } } @@ -1699,31 +1695,19 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) t->used = TRUE; d = NULL; - if (t->globals != NULL) - { - for (d = t->globals; d != NULL; d = d->next) - if ((*d->match) (d, alc)) - break; - } + if (t->globals.list != NULL) + d = (*t->match) (&t->globals, NULL, alc); /* See if there is anything to force this symbol to local scope. */ - if (d == NULL && t->locals != NULL) + if (d == NULL && t->locals.list != NULL) { - for (d = t->locals; d != NULL; d = d->next) - { - if ((*d->match) (d, alc)) - { - if (h->dynindx != -1 - && info->shared - && ! info->export_dynamic) - { - (*bed->elf_backend_hide_symbol) (info, h, TRUE); - } - - break; - } - } + d = (*t->match) (&t->locals, NULL, alc); + if (d != NULL + && h->dynindx != -1 + && info->shared + && ! info->export_dynamic) + (*bed->elf_backend_hide_symbol) (info, h, TRUE); } free (alc); @@ -1744,18 +1728,14 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) return TRUE; amt = sizeof *t; - t = bfd_alloc (sinfo->output_bfd, amt); + t = bfd_zalloc (sinfo->output_bfd, amt); if (t == NULL) { sinfo->failed = TRUE; return FALSE; } - t->next = NULL; t->name = p; - t->globals = NULL; - t->locals = NULL; - t->deps = NULL; t->name_indx = (unsigned int) -1; t->used = TRUE; @@ -1801,30 +1781,26 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) local_ver = NULL; for (t = sinfo->verdefs; t != NULL; t = t->next) { - if (t->globals != NULL) + if (t->globals.list != NULL) { bfd_boolean matched; matched = FALSE; - for (d = t->globals; d != NULL; d = d->next) - { - if ((*d->match) (d, h->root.root.string)) - { - if (d->symver) - matched = TRUE; - else - { - /* There is a version without definition. Make - the symbol the default definition for this - version. */ - h->verinfo.vertree = t; - local_ver = NULL; - d->script = 1; - break; - } - } - } - + d = NULL; + while ((d = (*t->match) (&t->globals, d, + h->root.root.string)) != NULL) + if (d->symver) + matched = TRUE; + else + { + /* There is a version without definition. Make + the symbol the default definition for this + version. */ + h->verinfo.vertree = t; + local_ver = NULL; + d->script = 1; + break; + } if (d != NULL) break; else if (matched) @@ -1833,19 +1809,18 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) (*bed->elf_backend_hide_symbol) (info, h, TRUE); } - if (t->locals != NULL) + if (t->locals.list != NULL) { - for (d = t->locals; d != NULL; d = d->next) + d = NULL; + while ((d = (*t->match) (&t->locals, d, + h->root.root.string)) != NULL) { + local_ver = t; /* If the match is "*", keep looking for a more - explicit, perhaps even global, match. */ - if (d->pattern[0] == '*' && d->pattern[1] == '\0') - local_ver = t; - else if ((*d->match) (d, h->root.root.string)) - { - local_ver = t; - break; - } + explicit, perhaps even global, match. + XXX: Shouldn't this be !d->wildcard instead? */ + if (d->pattern[0] != '*' || d->pattern[1] != '\0') + break; } if (d != NULL) diff --git a/bfd/elflink.h b/bfd/elflink.h index 383cb88..e53911d 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -2058,7 +2058,9 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, /* Make all global versions with definiton. */ for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) + for (d = t->globals.list; d != NULL; d = d->next) + /* FIXME: Shouldn't this be !d->symver && d->wildcard == 0 + instead? */ if (!d->symver && strchr (d->pattern, '*') == NULL) { const char *verstr, *name; @@ -2124,7 +2126,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, /* Check if all global versions have a definiton. */ all_defined = TRUE; for (t = verdefs; t != NULL; t = t->next) - for (d = t->globals; d != NULL; d = d->next) + for (d = t->globals.list; d != NULL; d = d->next) if (!d->symver && !d->script) { (*_bfd_error_handler) @@ -2372,7 +2374,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, def.vd_version = VER_DEF_CURRENT; def.vd_flags = 0; - if (t->globals == NULL && t->locals == NULL && ! t->used) + if (t->globals.list == NULL && t->locals.list == NULL && ! t->used) def.vd_flags |= VER_FLG_WEAK; def.vd_ndx = t->vernum + 1; def.vd_cnt = cdeps + 1; |