+/* Save strtab refcounts prior to adding --as-needed library. */
+
+struct strtab_save
+{
+ size_t size;
+ unsigned int refcount[1];
+};
+
+void *
+_bfd_elf_strtab_save (struct elf_strtab_hash *tab)
+{
+ struct strtab_save *save;
+ size_t idx, size;
+
+ size = sizeof (*save) + (tab->size - 1) * sizeof (save->refcount[0]);
+ save = bfd_malloc (size);
+ if (save == NULL)
+ return save;
+
+ save->size = tab->size;
+ for (idx = 1; idx < tab->size; idx++)
+ save->refcount[idx] = tab->array[idx]->refcount;
+ return save;
+}
+
+/* Restore strtab refcounts on finding --as-needed library not needed. */
+