Patch to fix a bug with version scripts and gc-sections in the GOLD linker.

Ian Lance Taylor iant@google.com
Sat Jul 23 10:52:00 GMT 2011
Sriraman Tallam <tmsriram@google.com> writes:

> Function bar is not garbage collected even though it is local.
>
> This simple patch fixes it.
>
> 	* symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Check if symbol
> 	is not forced local before marking it as referenced.
> 	(Symbol_table::add_from_relobj): Mark symbol as referenced only after
> 	checking if they cannot be forced local.

I would like to suggest that you instead change
Symbol::is_externally_visible to return false if this->is_forced_local()
is true.  I think that will fix your problem, and I don't think think
that will break anything--but, then, I haven't tried it.

If that patch works, it is preapproved.

Thanks.

Ian



More information about the Binutils mailing list