]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR15530, mark symbol in executables if it matches dynamic_list
authorAlan Modra <amodra@gmail.com>
Wed, 12 Feb 2014 10:38:01 +0000 (21:08 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 12 Jun 2014 15:29:02 +0000 (00:59 +0930)
For powerpc64 as HJ did earlier for other ELF targets, and a tidy.

PR gold/15530
* elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
--export-dynamic and --dynamic-list marking of symbols.
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder
cheap tests first.

bfd/ChangeLog
bfd/elf64-ppc.c
bfd/elflink.c

index cacf1584cfc69bb6c9f2f79ee58b54638677eb22..6cee4e77745102436422c0e78ee89b736cde45e2 100644 (file)
@@ -1,6 +1,13 @@
 2014-06-12  Alan Modra  <amodra@gmail.com>
 
        Backport mainline patches
+       2014-02-12  Alan Modra  <amodra@gmail.com>
+       PR gold/15530
+       * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
+       --export-dynamic and --dynamic-list marking of symbols.
+       * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Reorder
+       cheap tests first.
+
        2014-02-10  H.J. Lu  <hongjiu.lu@intel.com>
        PR gold/16530
        * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in
index 9e40fcf7de67a74102f7d2dd8edf88aee6fee223..3ff1dad16b3a81eb5749c44c8bccaa45d96d27db 100644 (file)
@@ -6142,6 +6142,7 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h;
   struct ppc_link_hash_entry *fdh;
+  struct bfd_elf_dynamic_list *d = info->dynamic_list;
 
   /* Dynamic linking info is on the func descriptor sym.  */
   fdh = defined_func_desc (eh);
@@ -6151,10 +6152,14 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
   if ((eh->elf.root.type == bfd_link_hash_defined
        || eh->elf.root.type == bfd_link_hash_defweak)
       && (eh->elf.ref_dynamic
-         || (!info->executable
-             && eh->elf.def_regular
+         || (eh->elf.def_regular
              && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL
              && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN
+             && (!info->executable
+                 || info->export_dynamic
+                 || (eh->elf.dynamic
+                     && d != NULL
+                     && (*d->match) (&d->head, NULL, eh->elf.root.root.string)))
              && (strchr (eh->elf.root.root.string, ELF_VER_CHR) != NULL
                  || !bfd_hide_sym_by_version (info->version_info,
                                               eh->elf.root.root.string)))))
index b8d357d678398be7decf5591f2516c1f2e96dab7..923f853ca9baa79ff7f437f34c99917f971b5d21 100644 (file)
@@ -12134,13 +12134,14 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && (h->ref_dynamic
-         || ((!info->executable
-              || info->export_dynamic
-              || (d != NULL
-                  && (*d->match) (&d->head, NULL, h->root.root.string)))
-             && h->def_regular
+         || (h->def_regular
              && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
              && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
+             && (!info->executable
+                 || info->export_dynamic
+                 || (h->dynamic
+                     && d != NULL
+                     && (*d->match) (&d->head, NULL, h->root.root.string)))
              && (strchr (h->root.root.string, ELF_VER_CHR) != NULL
                  || !bfd_hide_sym_by_version (info->version_info,
                                               h->root.root.string)))))