Useless `DT_NEEDED` tags after Garbage Collection

Alan Modra
Fri Oct 19 12:58:00 GMT 2018

On Fri, Oct 19, 2018 at 12:22:26PM +0200, Christoph Conrads wrote:
> If both `--entry` and `--undefined` are missing, I get the following error:
> > ld: gc-sections requires either an entry or an undefined symbol

OK.  It used to be that -r --gc-sections needed a root symbol to start
marking kept sections, but that isn't really necessary with
--gc-keep-exported since all defined default visibility or protected
visibility symbols are roots.

I'll commit a patch to fix that, but you'll need to continue
specifying at least one --entry or --undefined option with older
linkers.  Any --entry will work and most likely continue to do so.
One good option is "--entry=0".

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list