summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2013-01-11 14:09:55 +0000
committerAlan Modra <amodra@bigpond.net.au>2013-01-11 14:09:55 +0000
commit8718041b073167c0a534dfbc9b32c19c03d89373 (patch)
tree0770ff10b4dcc3bcf0657192028286b1eeafdfff
parent61576393d6e1d9d1647912039c863a65c20116cb (diff)
downloadbinutils-redhat-8718041b073167c0a534dfbc9b32c19c03d89373.tar.gz
* 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.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf-strtab.c6
-rw-r--r--bfd/elflink.c4
4 files changed, 15 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ba90f46a88..0fcbe54b45 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
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
* elf-bfd.h (_bfd_elf_strtab_clear_refs): Declare.
(_bfd_elf_strtab_clear_all_refs): Define.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 85f8f31e58..a8745933ab 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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) \
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index 1526755ab7..45743f608a 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -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)
{
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ee6288ad07..7861946c24 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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;