[PATCH] ld: Add more tests for --as-needed

Michael Matz matz@suse.de
Fri Sep 11 13:53:01 GMT 2020
Hello,

On Thu, 10 Sep 2020, H.J. Lu via Binutils wrote:

> The problem is with liblto-18c.so and liblto-18b.so.  The same problem 
> can show up without LTO.  liblto-18c.so and liblto-18b.so should be 
> fixed if they should work in all cases, with and without LTO.
> 
> One advantage of LTO is to remove unused IR symbol references, including 
> unnecessary DT_NEEDED.  The current ld no longer does that.

FWIW, I think in this case it's more important to make LTO and non-LTO 
behave the same than it is to make LTO emit fewer DT_NEEDED, even if that 
breaks the other invariant of --as-needed (namely that ldd -u doesn't show 
any libs).  For acceptance of the LTO compilation mode it was (and is) 
very important that any observable changes are kept to a minimum.


Ciao,
Michael.


More information about the Binutils mailing list