lto-18 test

Alan Modra amodra@gmail.com
Wed Sep 9 14:03:04 GMT 2020


On Wed, Sep 09, 2020 at 06:41:22AM -0700, H.J. Lu wrote:
> On Tue, Sep 8, 2020 at 8:08 PM Alan Modra via Binutils
> <binutils@sourceware.org> wrote:
> >
> > Demonstrates a reason to use IR symbols when deciding an --as-needed
> > library should be loaded.
> >
> >         * testsuite/ld-plugin/lto-18a.c,
> >         * testsuite/ld-plugin/lto-18b.c,
> >         * testsuite/ld-plugin/lto-18c.c,
> >         * testsuite/ld-plugin/lto-18d.c,
> >         * testsuite/ld-plugin/lto-18.out: New test.
> >         * testsuite/ld-plugin/lto.exp: Run it.
> >
> 
> This exposed an --as-needed bug:

No, it didn't.

> https://sourceware.org/bugzilla/show_bug.cgi?id=26590

So you change the testcase in such a way that the first object file no
longer needs the first shared library.  ld correctly decides that the
first library isn't needed.  That's how --as-needed is supposed to
work.

> which has nothing to do with LTO.

Indeed it does.  The lto-18 testcase as written compiles and links
fine without LTO.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list