From 7bfc4db2893c5de00197e40ab52394979f83a75d Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 6 Jul 2022 09:54:21 +0930 Subject: 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. --- gas/config/obj-coff-seh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gas/config/obj-coff-seh.c') diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index c30eda9..0b43c8b 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -64,7 +64,7 @@ get_pxdata_name (segT seg, const char *base_name) else name = dollar; - sname = concat (base_name, name, NULL); + sname = notes_concat (base_name, name, NULL); return sname; } @@ -75,8 +75,7 @@ alloc_pxdata_item (segT seg, int subseg, char *name) { struct seh_seg_list *r; - r = (struct seh_seg_list *) - xmalloc (sizeof (struct seh_seg_list) + strlen (name)); + r = notes_alloc (sizeof (struct seh_seg_list) + strlen (name)); r->seg = seg; r->subseg = subseg; r->seg_name = name; @@ -145,7 +144,7 @@ seh_hash_find_or_make (segT cseg, const char *base_name) seh_hash_insert (item->seg_name, item); } else - free (name); + notes_free (name); return item; } -- cgit v1.1