public inbox for binutils-cvs@sourceware.org help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org> To: bfd-cvs@sourceware.org Subject: [binutils-gdb] dw2gencfi.c: use notes obstack Date: Sat, 9 Jul 2022 12:35:45 +0000 (GMT) [thread overview] Message-ID: <20220709123545.9330D384BC01@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5a210b9fe8a5fe616320f5adf432516334c3702f commit 5a210b9fe8a5fe616320f5adf432516334c3702f Author: Alan Modra <amodra@gmail.com> Date: Fri Jul 8 08:48:16 2022 +0930 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. Diff: --- gas/dw2gencfi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 961a3b92188..6be8cb50495 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 */
reply other threads:[~2022-07-09 12:35 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220709123545.9330D384BC01@sourceware.org \ --to=amodra@sourceware.org \ --cc=bfd-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).