diff options
author | Alan Modra <amodra@gmail.com> | 2022-07-06 09:54:21 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-07-09 21:36:10 +0930 |
commit | 7bfc4db2893c5de00197e40ab52394979f83a75d (patch) | |
tree | 2241be46f5e1a57a9f5a8b62f680a205aa67f7aa /gas/config/tc-ia64.c | |
parent | a51628a9d49bf7abb89b71032aa38d7f596be674 (diff) | |
download | fsf-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-ia64.c')
-rw-r--r-- | gas/config/tc-ia64.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 771071b..7fa7e57 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -4663,14 +4663,9 @@ dot_rot (int type) } if (!*drpp) - { - *drpp = XOBNEW (¬es, struct dynreg); - memset (*drpp, 0, sizeof (*dr)); - } + *drpp = notes_calloc (1, sizeof (**drpp)); - name = XOBNEWVEC (¬es, char, len + 1); - memcpy (name, start, len); - name[len] = '\0'; + name = notes_memdup (start, len, len + 1); dr = *drpp; dr->name = name; @@ -4682,7 +4677,6 @@ dot_rot (int type) if (str_hash_insert (md.dynreg_hash, name, dr, 0) != NULL) { as_bad (_("Attempt to redefine register set `%s'"), name); - obstack_free (¬es, name); goto err; } @@ -5007,7 +5001,7 @@ dot_pred_rel (int type) type = 'c'; else if (strcmp (form, "imply") == 0) type = 'i'; - obstack_free (¬es, form); + notes_free (form); } else if (*input_line_pointer == '@') { @@ -11781,9 +11775,7 @@ dot_alias (int section) } /* Make a copy of name string. */ - len = strlen (name) + 1; - obstack_grow (¬es, name, len); - name = obstack_finish (¬es); + name = notes_strdup (name); if (section) { @@ -11806,8 +11798,7 @@ dot_alias (int section) if (strcmp (h->name, name)) as_bad (_("`%s' is already the alias of %s `%s'"), alias, kind, h->name); - obstack_free (¬es, name); - obstack_free (¬es, alias); + notes_free (alias); goto out; } @@ -11817,12 +11808,11 @@ dot_alias (int section) { if (strcmp (a, alias)) as_bad (_("%s `%s' already has an alias `%s'"), kind, name, a); - obstack_free (¬es, name); - obstack_free (¬es, alias); + notes_free (alias); goto out; } - h = XNEW (struct alias); + h = notes_alloc (sizeof (*h)); h->file = as_where (&h->line); h->name = name; |