diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2002-07-15 02:23:26 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2002-07-15 02:23:26 +0000 |
commit | 96a94295f264879774c5c1e175439bd1b09010be (patch) | |
tree | ef666e2bcf75061992863f285b1fb9e5a72956f4 /bfd/elflink.h | |
parent | 1bfdf7771621505b339dd90642850586c6ead3d6 (diff) | |
download | gdb-96a94295f264879774c5c1e175439bd1b09010be.zip gdb-96a94295f264879774c5c1e175439bd1b09010be.tar.gz gdb-96a94295f264879774c5c1e175439bd1b09010be.tar.bz2 |
bfd/
2002-07-14 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_assign_sym_version): Hide the default
definition if there is a hidden versioned definition.
ld/
2002-07-14 H.J. Lu <hjl@gnu.org>
* ld.texinfo: Document a .symver takes precedence over a
version script.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r-- | bfd/elflink.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h index 57819e9..7fa2ccb 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -4345,6 +4345,7 @@ elf_link_assign_sym_version (h, data) (_("%s: undefined versioned symbol name %s"), bfd_get_filename (sinfo->output_bfd), h->root.root.string); bfd_set_error (bfd_error_bad_value); +error_return: sinfo->failed = true; return false; } @@ -4416,6 +4417,43 @@ elf_link_assign_sym_version (h, data) (*bed->elf_backend_hide_symbol) (info, h, true); } } + + /* We need to check if a hidden versioned definition should + hide the default one. */ + if (h->dynindx != -1 && h->verinfo.vertree != NULL) + { + const char *verstr, *name; + size_t namelen, verlen, newlen; + char *newname; + struct elf_link_hash_entry *newh; + + name = h->root.root.string; + namelen = strlen (name); + verstr = h->verinfo.vertree->name; + verlen = strlen (verstr); + newlen = namelen + verlen + 2; + + newname = (char *) bfd_malloc ((bfd_size_type) newlen); + if (newname == NULL) + goto error_return; + memcpy (newname, name, namelen); + + /* Check the hidden versioned definition. */ + p = newname + namelen; + *p++ = ELF_VER_CHR; + memcpy (p, verstr, verlen + 1); + newh = elf_link_hash_lookup (elf_hash_table (info), newname, + false, false, false); + + if (newh + && (newh->root.type == bfd_link_hash_defined + || newh->root.type == bfd_link_hash_defweak)) + /* We find a hidden versioned definition. Hide the default + one. */ + (*bed->elf_backend_hide_symbol) (info, h, true); + + free (newname); + } } return true; |