+/* We keep a hash table to map .debug_abbrev section offsets to the
+ array of abbrevs, so that compilation units using the same set of
+ abbrevs do not waste memory. */
+
+struct abbrev_offset_entry
+{
+ size_t offset;
+ struct abbrev_info **abbrevs;
+};
+
+static hashval_t
+hash_abbrev (const void *p)
+{
+ const struct abbrev_offset_entry *ent = p;
+ return htab_hash_pointer ((void *) ent->offset);
+}
+
+static int
+eq_abbrev (const void *pa, const void *pb)
+{
+ const struct abbrev_offset_entry *a = pa;
+ const struct abbrev_offset_entry *b = pb;
+ return a->offset == b->offset;
+}
+
+static void
+del_abbrev (void *p)
+{
+ struct abbrev_offset_entry *ent = p;
+ struct abbrev_info **abbrevs = ent->abbrevs;
+ size_t i;
+
+ for (i = 0; i < ABBREV_HASH_SIZE; i++)
+ {
+ struct abbrev_info *abbrev = abbrevs[i];
+
+ while (abbrev)
+ {
+ free (abbrev->attrs);
+ abbrev = abbrev->next;
+ }
+ }
+ free (ent);
+}
+