[PATCH 1/2] gas: add symbol_table_remove

David Faust david.faust@oracle.com
Tue Nov 14 17:58:04 GMT 2023


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);
+}
 
 /* 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



More information about the Binutils mailing list