[PATCH 0/2] gas,bpf: cleanup bad symbols created while parsing

David Faust david.faust@oracle.com
Tue Nov 14 22:13:23 GMT 2023



On 11/14/23 09:58, David Faust wrote:
...
> 
> Patch 1 adds a symbol_table_remove () function to symbols.c and
> exposes it in the header, since symbol_remove () is not sufficient to
> prevent such symbols being written in the symbol table of the resulting
> ELF object.

Hm, I misspoke here and inverted the reasoning.  To correct myself:

symbol_remove () is sufficient to prevent the symbol from being emitted.

But it does not remove the symbol from the hash table used by the
symbol_find () family of routines.  That means later calls to e.g.
symbol_find_or_make () will return a reference to the old (removed)
symbol.  The symbol will not be re-added to the symbol list, so it will
not be emitted, even in cases where it is real and needed.

Adding and using symbol_table_remove () allows a removed symbol to be
potentially re-added later.


More information about the Binutils mailing list