aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-nds32.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-07-06 09:54:21 +0930
committerAlan Modra <amodra@gmail.com>2022-07-09 21:36:10 +0930
commit7bfc4db2893c5de00197e40ab52394979f83a75d (patch)
tree2241be46f5e1a57a9f5a8b62f680a205aa67f7aa /gas/config/tc-nds32.c
parenta51628a9d49bf7abb89b71032aa38d7f596be674 (diff)
downloadfsf-binutils-gdb-7bfc4db2893c5de00197e40ab52394979f83a75d.zip
fsf-binutils-gdb-7bfc4db2893c5de00197e40ab52394979f83a75d.tar.gz
fsf-binutils-gdb-7bfc4db2893c5de00197e40ab52394979f83a75d.tar.bz2
gas: target string hash tables
This allocates entries added to the string hash tables on the notes obstack, so that at least those do not leak. A followup patch will switch over the str_hash allocation to notes_calloc, which is why I haven't implemented deleting all the target string hash tables. * config/obj-coff-seh.c (get_pxdata_name, alloc_pxdata_item): Use notes obstack for string hash table entries. * config/tc-alpha.c (get_alpha_reloc_tag, md_begin): Likewise. * config/tc-h8300.c (md_begin): Likewise. * config/tc-ia64.c (dot_rot, dot_pred_rel, dot_alias): Likewise. * config/tc-nds32.c (nds32_relax_hint): Likewise. * config/tc-riscv.c (riscv_init_csr_hash): Likewise. * config/tc-score.c (s3_insert_reg): Likewise. (s3_build_score_ops_hsh, s3_build_dependency_insn_hsh): Likewise. * config/tc-score7.c (s7_build_score_ops_hsh): Likewise. (s7_build_dependency_insn_hsh): Likewise. * config/tc-tic4x.c (tic4x_asg): Likewise.
Diffstat (limited to 'gas/config/tc-nds32.c')
-rw-r--r--gas/config/tc-nds32.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 3ad227b..48893a5 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -4284,20 +4284,17 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED)
relocs = str_hash_find (nds32_hint_hash, name);
if (relocs == NULL)
{
- relocs = XNEW (struct nds32_relocs_pattern);
- memset (relocs, 0, sizeof (struct nds32_relocs_pattern));
+ relocs = notes_calloc (1, sizeof (*relocs));
str_hash_insert (nds32_hint_hash, name, relocs, 0);
}
else
{
while (relocs->next)
- relocs=relocs->next;
- relocs->next = XNEW (struct nds32_relocs_pattern);
+ relocs = relocs->next;
+ relocs->next = notes_calloc (1, sizeof (*relocs));
relocs = relocs->next;
- memset (relocs, 0, sizeof (struct nds32_relocs_pattern));
}
- relocs->next = NULL;
*input_line_pointer = saved_char;
ignore_rest_of_line ();