Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9121)

Unified Diff: bfd/elf-strtab.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bfd/elf-nacl.c ('k') | bfd/elf-vxworks.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bfd/elf-strtab.c
diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index 7d2fad4e51762ecd052a3300db5ffd5e5656c112..61cedaedcc34d3a5c7c7639545a388ede9068de0 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -201,15 +201,41 @@ _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_all_refs (struct elf_strtab_hash *tab)
{
bfd_size_type idx;
- for (idx = 1; idx < tab->size; ++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
_bfd_elf_strtab_size (struct elf_strtab_hash *tab)
{
« no previous file with comments | « bfd/elf-nacl.c ('k') | bfd/elf-vxworks.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698