Clear dynstr_index when forcing symbols local
authorAlan Modra <amodra@gmail.com>
Thu, 27 Apr 2017 01:36:33 +0000 (11:06 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 27 Apr 2017 02:24:29 +0000 (11:54 +0930)
This is really just cosmetic, but it does protect a little from
accidentally reading a stale value.

* elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
when force_local.

bfd/ChangeLog
bfd/elflink.c

index 6cda710ff2a20f725e8a03e8ea6103fabafabb68..c870cc712a616beb6010a1980e4409fb59fbe51c 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-27  Alan Modra  <amodra@gmail.com>
+
+       * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
+       when force_local.
+
 2017-04-27  Alan Modra  <amodra@gmail.com>
 
        * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
index 73af7634434ac66882fcb1fc472760ca1faea48b..59300b7cde71d38a4de9a0b6116c9656d893d26d 100644 (file)
@@ -7295,9 +7295,10 @@ _bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info,
       h->forced_local = 1;
       if (h->dynindx != -1)
        {
-         h->dynindx = -1;
          _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
                                  h->dynstr_index);
+         h->dynindx = -1;
+         h->dynstr_index = 0;
        }
     }
 }