This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Update LTO plugin interface


"H.J. Lu" <hjl.tools@gmail.com> writes:

>> As far as I can tell at this point, the complete set of libraries we
>> need to check is: -lc -lm -lgcc -lgcc_s.
>
> It isn't a complete list. At least, we need -lgcov and may be others.

Only to the extent that we feel that it is important to permit the user
to specify -lgcov on the link line in an unusual way, and also to make
it work with LTO.  For complex cases I would recommend instead providing
an escape hatch.


>> We could remove -lm from that list if we arranged for the plugin to
>> report a potential reference to sin even if the object file does not
>> list it for whatever reason. ÂI saw your earlier test case but I don't
>> actually know why the reference to sin in the source code disappeared
>> from the object file and was reinserted by LTO.
>>
>>
>>> How do we handle -Wl, -Wl,-Bstatic/-Wl,-Bdynamic,-Wl,--start-group, ....
>>> and other linker switches?
>>
>> A fair point. ÂIdeally we would want to recreate the state of those
>> options for all libraries explicitly mentioned by the user.
>
> It can get quite complex. You start turning GCC driver into a linker :-).
> What do we do when a new switch is added to linker?

There is a big difference between automatically handling a few linker
options and turning the driver into a linker.  What we are talking about
here is quite similar to what the g++ driver already does.

And we really just have to make the simple cases work cleanly.  For
anything complicated we can quite reasonably say "this is what you have
to do to use LTO."

Anyhow, I have a proposal on the table which I think can do the job.  If
you want to instead advocate for a complete relink approach, then we
should significantly change and simplify the plugin interface.  The
plugin support in gold will need to be rewritten; not sure about GNU ld.
I think that will force the linker to do a fair bit of extra work to no
useful purpose.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]