lto-18 test

H.J. Lu hjl.tools@gmail.com
Wed Sep 9 14:09:06 GMT 2020


On Wed, Sep 9, 2020 at 7:03 AM Alan Modra <amodra@gmail.com> wrote:
>
> 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.

f1 reference in IR is removed by LTO, which I did by hand.  The
requirement of liblto-18b.so doesn't come from IR, but comes from
liblto-18c.so.

-- 
H.J.


More information about the Binutils mailing list