aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-11-27 15:16:49 +1030
committerAlan Modra <amodra@gmail.com>2014-11-30 12:11:03 +1030
commit7b20f09964ba4275768350a24fca109527a19425 (patch)
tree15e3d66f80c57aaaebb1676dc7518f6f29c54873 /bfd/elflink.c
parentb6a8f012d1813271c74cbc49545a27a2e8781fc0 (diff)
downloadgdb-7b20f09964ba4275768350a24fca109527a19425.zip
gdb-7b20f09964ba4275768350a24fca109527a19425.tar.gz
gdb-7b20f09964ba4275768350a24fca109527a19425.tar.bz2
Don't output symbol version definitions for non-DT_NEEDED libs
PR 16452, 16457 * elflink.c (_bfd_elf_link_find_version_dependencies): Exclude symbols from libraries that won't be listed in DT_NEEDED. (elf_link_output_extsym): Don't output verdefs for such symbols.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c8068c0..c964a98 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1832,7 +1832,9 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
if (!h->def_dynamic
|| h->def_regular
|| h->dynindx == -1
- || h->verinfo.verdef == NULL)
+ || h->verinfo.verdef == NULL
+ || (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
+ & (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED)))
return TRUE;
/* See if we already know about this version. */
@@ -9050,7 +9052,9 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
if (!h->def_regular)
{
- if (h->verinfo.verdef == NULL)
+ if (h->verinfo.verdef == NULL
+ || (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)
+ & (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED)))
iversym.vs_vers = 0;
else
iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1;