* elflink.h (elf_link_add_archive_symbols): For the default

version, check references with only one `@' first.
This commit is contained in:
Alan Modra 2002-06-23 12:44:31 +00:00
parent 47b7c2db07
commit 48fc70a2b6
2 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2002-06-23 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_add_archive_symbols): For the default
version, check references with only one `@' first.
2002-06-23 John David Anglin <dave@hiauly1.hia.nrc.ca> 2002-06-23 John David Anglin <dave@hiauly1.hia.nrc.ca>
* elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New * elf64-hppa.c (elf64_hppa_mark_milli_and_exported_functions): New

View File

@ -353,26 +353,40 @@ elf_link_add_archive_symbols (abfd, info)
if (h == NULL) if (h == NULL)
{ {
char *p, *copy; char *p, *copy;
size_t len, first;
/* If this is a default version (the name contains @@), /* If this is a default version (the name contains @@),
look up the symbol again without the version. The look up the symbol again with only one `@' as well
effect is that references to the symbol without the as without the version. The effect is that references
version will be matched by the default symbol in the to the symbol with and without the version will be
archive. */ matched by the default symbol in the archive. */
p = strchr (symdef->name, ELF_VER_CHR); p = strchr (symdef->name, ELF_VER_CHR);
if (p == NULL || p[1] != ELF_VER_CHR) if (p == NULL || p[1] != ELF_VER_CHR)
continue; continue;
copy = bfd_alloc (abfd, (bfd_size_type) (p - symdef->name + 1)); /* First check with only one `@'. */
len = strlen (symdef->name);
copy = bfd_alloc (abfd, (bfd_size_type) len);
if (copy == NULL) if (copy == NULL)
goto error_return; goto error_return;
memcpy (copy, symdef->name, (size_t) (p - symdef->name)); first = p - symdef->name + 1;
copy[p - symdef->name] = '\0'; memcpy (copy, symdef->name, first);
memcpy (copy + first, symdef->name + first + 1, len - first);
h = elf_link_hash_lookup (elf_hash_table (info), copy, h = elf_link_hash_lookup (elf_hash_table (info), copy,
false, false, false); false, false, false);
if (h == NULL)
{
/* We also need to check references to the symbol
without the version. */
copy[first - 1] = '\0';
h = elf_link_hash_lookup (elf_hash_table (info),
copy, false, false, false);
}
bfd_release (abfd, copy); bfd_release (abfd, copy);
} }