+2019-05-08 Tom Tromey <tom@tromey.com>
+
+ * elfread.c (elf_objfile_gnu_ifunc_cache_data): Change type.
+ (elf_gnu_ifunc_record_cache): Update. Don't allocate hash table
+ on obstack.
+ (elf_gnu_ifunc_resolve_by_cache, _initialize_elfread): Update.
+
2019-05-08 Tom Tromey <tom@tromey.com>
* mdebugread.c (basic_type_data): Change type.
/* The data pointer is htab_t for gnu_ifunc_record_cache_unchecked. */
-static const struct objfile_data *elf_objfile_gnu_ifunc_cache_data;
+static const struct objfile_key<htab, htab_deleter>
+ elf_objfile_gnu_ifunc_cache_data;
/* Map function names to CORE_ADDR in elf_objfile_gnu_ifunc_cache_data. */
if (len > 4 && strcmp (target_name + len - 4, "@plt") == 0)
return 0;
- htab = (htab_t) objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
+ htab = elf_objfile_gnu_ifunc_cache_data.get (objfile);
if (htab == NULL)
{
- htab = htab_create_alloc_ex (1, elf_gnu_ifunc_cache_hash,
- elf_gnu_ifunc_cache_eq,
- NULL, &objfile->objfile_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
- set_objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data, htab);
+ htab = htab_create_alloc (1, elf_gnu_ifunc_cache_hash,
+ elf_gnu_ifunc_cache_eq,
+ NULL, xcalloc, xfree);
+ elf_objfile_gnu_ifunc_cache_data.set (objfile, htab);
}
entry_local.addr = addr;
struct elf_gnu_ifunc_cache *entry_p;
void **slot;
- htab = (htab_t) objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
+ htab = elf_objfile_gnu_ifunc_cache_data.get (objfile);
if (htab == NULL)
continue;
{
add_symtab_fns (bfd_target_elf_flavour, &elf_sym_fns);
- elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
}