public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: David Faust <david.faust@oracle.com>
To: binutils@sourceware.org
Cc: jose.marchesi@oracle.com
Subject: [PATCH 1/2] gas: add symbol_table_remove
Date: Tue, 14 Nov 2023 09:58:04 -0800	[thread overview]
Message-ID: <20231114175805.7783-2-david.faust@oracle.com> (raw)
In-Reply-To: <20231114175805.7783-1-david.faust@oracle.com>

This patch adds a symbol_table_remove () function to symbols.c which
mirorrs symbol_table_add (), and exposes it in the header.

gas/

	* symbols.c (symbol_table_remove): New function.
	* symbols.h (symbol_table_remove): Prototype.
---
 gas/symbols.c | 10 ++++++++++
 gas/symbols.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/gas/symbols.c b/gas/symbols.c
index 45e46ed39b7..e94fa61b56e 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -722,6 +722,16 @@ symbol_table_insert (symbolS *symbolP)
 
   htab_insert (sy_hash, symbolP, 1);
 }
+
+/* Remove a symbol from the symbol table.  */
+
+void
+symbol_table_remove (symbolS *symbolP)
+{
+  know (symbolP);
+
+  htab_remove_elt (sy_hash, symbolP);
+}
 \f
 /* If a symbol name does not exist, create it as undefined, and insert
    it into the symbol table.  Return a pointer to it.  */
diff --git a/gas/symbols.h b/gas/symbols.h
index 46425c97d79..90cefaa0402 100644
--- a/gas/symbols.h
+++ b/gas/symbols.h
@@ -71,6 +71,7 @@ void symbol_end (void);
 void dot_symbol_init (void);
 void symbol_print_statistics (FILE *);
 void symbol_table_insert (symbolS * symbolP);
+void symbol_table_remove (symbolS * symbolP);
 valueT resolve_symbol_value (symbolS *);
 void resolve_local_symbol_values (void);
 int snapshot_symbol (symbolS **, valueT *, segT *, fragS **);
-- 
2.42.0


  reply	other threads:[~2023-11-14 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 17:58 [PATCH 0/2] gas,bpf: cleanup bad symbols created while parsing David Faust
2023-11-14 17:58 ` David Faust [this message]
2023-11-14 17:58 ` [PATCH 2/2] bpf: remove symbols created during failed parse David Faust
2023-11-14 22:13 ` [PATCH 0/2] gas,bpf: cleanup bad symbols created while parsing David Faust
2023-11-15  9:49 ` Jan Beulich
2023-11-15 21:57   ` David Faust

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=20231114175805.7783-2-david.faust@oracle.com \
    --to=david.faust@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=jose.marchesi@oracle.com \
    /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: link
Be 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).