* elf-bfd.h (_bfd_elf_strtab_refcount): Declare.
authorAlan Modra <amodra@gmail.com>
Fri, 11 Jan 2013 14:09:59 +0000 (14:09 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 11 Jan 2013 14:09:59 +0000 (14:09 +0000)
* elf-strtab.c (_bfd_elf_strtab_refcount): New function.
* elflink.c (elf_add_dt_needed_tag): Use _bfd_elf_strtab_refcount.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf-strtab.c
bfd/elflink.c

index ba90f46a8841e0fe79abcfb0d74d0762f5cddbdb..0fcbe54b458237a123cfd8e2424473a2aa93af87 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-12  Alan Modra  <amodra@gmail.com>
+
+       * elf-bfd.h (_bfd_elf_strtab_refcount): Declare.
+       * elf-strtab.c (_bfd_elf_strtab_refcount): New function.
+       * elflink.c (elf_add_dt_needed_tag): Use _bfd_elf_strtab_refcount.
+
 2013-01-12  Alan Modra  <amodra@gmail.com>
 
        PR ld/12549
index 85f8f31e5809313a9adbf0d0c763f6efee392873..a8745933abcf40ce5b1edba09984cf372b504b22 100644 (file)
@@ -1938,6 +1938,8 @@ extern void _bfd_elf_strtab_addref
   (struct elf_strtab_hash *, bfd_size_type);
 extern void _bfd_elf_strtab_delref
   (struct elf_strtab_hash *, bfd_size_type);
+extern unsigned int _bfd_elf_strtab_refcount
+  (struct elf_strtab_hash *, bfd_size_type);
 extern void _bfd_elf_strtab_clear_refs
   (struct elf_strtab_hash *, bfd_size_type);
 #define _bfd_elf_strtab_clear_all_refs(tab) \
index 1526755ab7da5b24c87bd67905a48c4bb5de0493..45743f608a2d8f9d2db1d63eb2ecae8583942f14 100644 (file)
@@ -201,6 +201,12 @@ _bfd_elf_strtab_delref (struct elf_strtab_hash *tab, bfd_size_type idx)
   --tab->array[idx]->refcount;
 }
 
+unsigned int
+_bfd_elf_strtab_refcount (struct elf_strtab_hash *tab, bfd_size_type idx)
+{
+  return tab->array[idx]->refcount;
+}
+
 void
 _bfd_elf_strtab_clear_refs (struct elf_strtab_hash *tab, bfd_size_type idx)
 {
index ee6288ad0762846e8954d49a488e8d37087175e5..7861946c2488f7d96117d12bc63aa47d1970355e 100644 (file)
@@ -3091,19 +3091,17 @@ elf_add_dt_needed_tag (bfd *abfd,
                       bfd_boolean do_it)
 {
   struct elf_link_hash_table *hash_table;
-  bfd_size_type oldsize;
   bfd_size_type strindex;
 
   if (!_bfd_elf_link_create_dynstrtab (abfd, info))
     return -1;
 
   hash_table = elf_hash_table (info);
-  oldsize = _bfd_elf_strtab_size (hash_table->dynstr);
   strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE);
   if (strindex == (bfd_size_type) -1)
     return -1;
 
-  if (oldsize == _bfd_elf_strtab_size (hash_table->dynstr))
+  if (_bfd_elf_strtab_refcount (hash_table->dynstr, strindex) != 1)
     {
       asection *sdyn;
       const struct elf_backend_data *bed;
This page took 0.033044 seconds and 4 git commands to generate.