Don't output symbol version definitions for non-DT_NEEDED libs
authorAlan Modra <amodra@gmail.com>
Thu, 27 Nov 2014 04:46:49 +0000 (15:16 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 30 Nov 2014 01:41:03 +0000 (12:11 +1030)
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.

bfd/ChangeLog
bfd/elflink.c

index 8a52ebe7c4d94affdd62dacec9ae3a2cc0caf053..8bcbc1184e30d843585e69f87d7613eb9eb188a6 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-30  Alan Modra  <amodra@gmail.com>
+
+       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.
+
 2014-11-28  Alan Modra  <amodra@gmail.com>
 
        * elf.c (_bfd_elf_slurp_version_tables): Exit loops when vn_next/
index c8068c0118c1df307cac6e113483e1813b4d6f9e..c964a98021c1c77c862a2fa6450f44f9ce759d11 100644 (file)
@@ -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;
This page took 0.032902 seconds and 4 git commands to generate.