mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
gas: use notes_calloc in string hash
Using notes_calloc means all of the string hash table memory should now be freed before gas exits, even though htab_delete isn't called. This also means that the hash table free_f and del_f must be NULL, because freeing notes obstack memory results in all more recently allocated notes memory being freed too. So hash table resizing won't free any memory, and will be a little faster. Also, htab_delete won't do anything (and be quick about it). Since htab_traverse can also resize hash tables (to make another traversal faster if the table is largely empty), stop that happening when only one traversal is done. * as.h: Reorder hash.h after symbols.h for notes_calloc decl. * hash.h (str_htab_create): Use notes_calloc. Do not free. * symbols.c (resolve_local_symbol_values): Don't resize during hash table traversal. * config/obj-elf.c (elf_frob_file_after_relocs): Likewise. * config/tc-ia64.c (ia64_adjust_symtab, ia64_frob_file): Likewise. * config/tc-nds32.c (nds32_elf_analysis_relax_hint): Likewise.
This commit is contained in:
parent
7bfc4db289
commit
0edfd2985b
4
gas/as.h
4
gas/as.h
@ -541,10 +541,10 @@ int generic_force_reloc (struct fix *);
|
||||
|
||||
#include "write.h"
|
||||
#include "frags.h"
|
||||
#include "hashtab.h"
|
||||
#include "hash.h"
|
||||
#include "read.h"
|
||||
#include "symbols.h"
|
||||
#include "hashtab.h"
|
||||
#include "hash.h"
|
||||
|
||||
#include "tc.h"
|
||||
#include "obj.h"
|
||||
|
@ -3006,7 +3006,7 @@ elf_frob_file_after_relocs (void)
|
||||
}
|
||||
|
||||
/* Cleanup hash. */
|
||||
htab_traverse (groups.indexes, free_section_idx, NULL);
|
||||
htab_traverse_noresize (groups.indexes, free_section_idx, NULL);
|
||||
htab_delete (groups.indexes);
|
||||
|
||||
#ifdef NEED_ECOFF_DEBUG
|
||||
|
@ -11853,7 +11853,7 @@ do_alias (void **slot, void *arg ATTRIBUTE_UNUSED)
|
||||
void
|
||||
ia64_adjust_symtab (void)
|
||||
{
|
||||
htab_traverse (alias_hash, do_alias, NULL);
|
||||
htab_traverse_noresize (alias_hash, do_alias, NULL);
|
||||
}
|
||||
|
||||
/* It renames the original section name to its alias. */
|
||||
@ -11878,7 +11878,7 @@ do_secalias (void **slot, void *arg ATTRIBUTE_UNUSED)
|
||||
void
|
||||
ia64_frob_file (void)
|
||||
{
|
||||
htab_traverse (secalias_hash, do_secalias, NULL);
|
||||
htab_traverse_noresize (secalias_hash, do_secalias, NULL);
|
||||
}
|
||||
|
||||
#ifdef TE_VMS
|
||||
|
@ -7480,7 +7480,8 @@ nds32_insert_relax_entry (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
|
||||
static void
|
||||
nds32_elf_analysis_relax_hint (void)
|
||||
{
|
||||
htab_traverse (nds32_hint_hash, nds32_elf_append_relax_relocs_traverse, NULL);
|
||||
htab_traverse_noresize (nds32_hint_hash,
|
||||
nds32_elf_append_relax_relocs_traverse, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,7 +99,7 @@ static inline htab_t
|
||||
str_htab_create (void)
|
||||
{
|
||||
return htab_create_alloc (16, hash_string_tuple, eq_string_tuple,
|
||||
free, xcalloc, free);
|
||||
NULL, notes_calloc, NULL);
|
||||
}
|
||||
|
||||
#endif /* HASH_H */
|
||||
|
@ -1786,7 +1786,7 @@ resolve_local_symbol (void **slot, void *arg ATTRIBUTE_UNUSED)
|
||||
void
|
||||
resolve_local_symbol_values (void)
|
||||
{
|
||||
htab_traverse (sy_hash, resolve_local_symbol, NULL);
|
||||
htab_traverse_noresize (sy_hash, resolve_local_symbol, NULL);
|
||||
}
|
||||
|
||||
/* Obtain the current value of a symbol without changing any
|
||||
|
Loading…
Reference in New Issue
Block a user