aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-10-22 06:58:17 +0000
committerJakub Jelinek <jakub@redhat.com>2003-10-22 06:58:17 +0000
commit108ba30509ad6169d0f2e06b755fa39a2c28a946 (patch)
treef08f61aaf06d9e7ba1789b24f137c266bb6fc80e /bfd/elflink.c
parenta9b7fca23b894846cfca99db5bb1c9d06ea75a89 (diff)
downloadgdb-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/elflink.c')
-rw-r--r--bfd/elflink.c111
1 files changed, 43 insertions, 68 deletions
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)