diff options
author | Alan Modra <amodra@gmail.com> | 2013-02-18 10:40:19 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-02-18 10:40:19 +0000 |
commit | d45f8bdadc6f438c13db38f5f92dd1517f240f5a (patch) | |
tree | 296f2bbf70b5a80a716875f11511714ee7867577 /bfd | |
parent | 53c3509d86cf36d7277a3974cd55b7e3edb09fa2 (diff) | |
download | gdb-d45f8bdadc6f438c13db38f5f92dd1517f240f5a.zip gdb-d45f8bdadc6f438c13db38f5f92dd1517f240f5a.tar.gz gdb-d45f8bdadc6f438c13db38f5f92dd1517f240f5a.tar.bz2 |
PR ld/12549
* elf-bfd.h (_bfd_elf_strtab_clear_refs): Delete.
(_bfd_elf_strtab_clear_all_refs): Declare.
(_bfd_elf_strtab_resize): Declare.
* elf-strtab.c (_bfd_elf_strtab_clear_refs): Delete.
(_bfd_elf_strtab_clear_all_refs): New function.
(_bfd_elf_strtab_resize): Likewise.
* elflink.c (elf_link_add_object_symbols): Use _bfd_elf_strtab_resize.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 6 | ||||
-rw-r--r-- | bfd/elf-strtab.c | 28 | ||||
-rw-r--r-- | bfd/elflink.c | 2 |
4 files changed, 40 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5411140..76558b3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,16 @@ 2013-02-18 Alan Modra <amodra@gmail.com> + PR ld/12549 + * elf-bfd.h (_bfd_elf_strtab_clear_refs): Delete. + (_bfd_elf_strtab_clear_all_refs): Declare. + (_bfd_elf_strtab_resize): Declare. + * elf-strtab.c (_bfd_elf_strtab_clear_refs): Delete. + (_bfd_elf_strtab_clear_all_refs): New function. + (_bfd_elf_strtab_resize): Likewise. + * elflink.c (elf_link_add_object_symbols): Use _bfd_elf_strtab_resize. + +2013-02-18 Alan Modra <amodra@gmail.com> + * elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs, local_call_stubs, elf_data_symbol, elf_text_symbol, elf_data_section, and elf_text_section to.. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index d36c287..c8d2957 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1927,10 +1927,10 @@ 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 +extern void _bfd_elf_strtab_clear_all_refs + (struct elf_strtab_hash *tab); +extern void _bfd_elf_strtab_restore_size (struct elf_strtab_hash *, bfd_size_type); -#define _bfd_elf_strtab_clear_all_refs(tab) \ - do { _bfd_elf_strtab_clear_refs (tab, 1); } while (0) extern bfd_size_type _bfd_elf_strtab_size (struct elf_strtab_hash *); extern bfd_size_type _bfd_elf_strtab_offset diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 45743f6..61cedae 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -208,10 +208,32 @@ _bfd_elf_strtab_refcount (struct elf_strtab_hash *tab, bfd_size_type idx) } void -_bfd_elf_strtab_clear_refs (struct elf_strtab_hash *tab, bfd_size_type idx) +_bfd_elf_strtab_clear_all_refs (struct elf_strtab_hash *tab) { - while (idx < tab->size) - tab->array[idx++]->refcount = 0; + bfd_size_type idx; + + for (idx = 1; idx < tab->size; idx++) + tab->array[idx]->refcount = 0; +} + +/* Downsizes strtab. Entries from IDX up to the current size are + removed from the array. */ +void +_bfd_elf_strtab_restore_size (struct elf_strtab_hash *tab, bfd_size_type idx) +{ + bfd_size_type curr_size = tab->size; + + BFD_ASSERT (tab->sec_size == 0); + BFD_ASSERT (idx <= curr_size); + tab->size = idx; + for (; idx < curr_size; ++idx) + { + /* We don't remove entries from the hash table, just set their + REFCOUNT to zero. Setting LEN zero will result in the size + growing if the entry is added again. See _bfd_elf_strtab_add. */ + tab->array[idx]->refcount = 0; + tab->array[idx]->len = 0; + } } bfd_size_type diff --git a/bfd/elflink.c b/bfd/elflink.c index 617c505..b652bec 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -4554,7 +4554,7 @@ error_free_dyn: memcpy (sym_hash, old_hash, hashsize); htab->root.undefs = old_undefs; htab->root.undefs_tail = old_undefs_tail; - _bfd_elf_strtab_clear_refs (htab->dynstr, old_dynstr_size); + _bfd_elf_strtab_restore_size (htab->dynstr, old_dynstr_size); for (i = 0; i < htab->root.table.size; i++) { struct bfd_hash_entry *p; |