aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-07-08 08:48:16 +0930
committerAlan Modra <amodra@gmail.com>2022-07-09 21:22:10 +0930
commit5a210b9fe8a5fe616320f5adf432516334c3702f (patch)
treeb25739b7dcda9a7c14e2a4042cb412f83b995667 /gas
parent951e757db69b4a6ee578f2a66075d68bf26a7ed5 (diff)
downloadgdb-5a210b9fe8a5fe616320f5adf432516334c3702f.zip
gdb-5a210b9fe8a5fe616320f5adf432516334c3702f.tar.gz
gdb-5a210b9fe8a5fe616320f5adf432516334c3702f.tar.bz2
dw2gencfi.c: use notes obstack
Use notes obstack for dwcfi_hash entries, and free table. Freeing the table makes memory checkers complain more about "definitely lost" memory as we've moved some from the "still reachable" category. That will be fixed with a later patch. * dw2gencfi.c (get_debugseg_name): Allocate on notes obstack. (alloc_debugseg_item): Likewise. (dwcfi_hash_find_or_make): Adjust failure path free. (cfi_finish): Delete dwfci_hash.
Diffstat (limited to 'gas')
-rw-r--r--gas/dw2gencfi.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 961a3b9..6be8cb5 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -229,13 +229,10 @@ get_debugseg_name (segT seg, const char *base_name)
const char * dollar;
const char * dot;
- if (!seg)
- return concat (base_name, NULL);
-
- name = bfd_section_name (seg);
-
- if (name == NULL || *name == 0)
- return concat (base_name, NULL);
+ if (!seg
+ || (name = bfd_section_name (seg)) == NULL
+ || *name == 0)
+ return notes_strdup (base_name);
dollar = strchr (name, '$');
dot = strchr (name + 1, '.');
@@ -244,7 +241,7 @@ get_debugseg_name (segT seg, const char *base_name)
{
if (!strcmp (base_name, ".eh_frame_entry")
&& strcmp (name, ".text") != 0)
- return concat (base_name, ".", name, NULL);
+ return notes_concat (base_name, ".", name, NULL);
name = "";
}
@@ -257,7 +254,7 @@ get_debugseg_name (segT seg, const char *base_name)
else
name = dollar;
- return concat (base_name, name, NULL);
+ return notes_concat (base_name, name, NULL);
}
/* Allocate a dwcfi_seg_list structure. */
@@ -267,8 +264,7 @@ alloc_debugseg_item (segT seg, int subseg, char *name)
{
struct dwcfi_seg_list *r;
- r = (struct dwcfi_seg_list *)
- xmalloc (sizeof (struct dwcfi_seg_list) + strlen (name));
+ r = notes_alloc (sizeof (*r) + strlen (name));
r->seg = seg;
r->subseg = subseg;
r->seg_name = name;
@@ -351,7 +347,7 @@ dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
str_hash_insert (dwcfi_hash, item->seg_name, item, 0);
}
else
- free (name);
+ notes_free (name);
return item;
}
@@ -2542,6 +2538,8 @@ cfi_finish (void)
for (fde = all_fde_data; fde ; fde = fde->next)
SET_HANDLED (fde, 0);
}
+ if (dwcfi_hash)
+ htab_delete (dwcfi_hash);
}
#else /* TARGET_USE_CFIPOP */