[llvm] r254917 - Link declaration lazily.

Dmitry Babokin via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 08:59:45 PST 2015


Rafael,

In ISPC project we use linker to merge to two bitcode files. Note that I've
use word "merge", not link, as it describes better what we need. I.e. we
have several parts of our language standard library and merge them in
single bitcode file. And in our case we have quite many *declarations*,
which we need to merge in. Some symbols are really need to be just
declarations, as their use are guaranteed to be on dead path in other parts
of the standard library and it's removed later.

Is it possible to manage removing declarations by linker flag, but not
doing it unconditionally?

Dmitry.

On Wed, Dec 9, 2015 at 10:19 PM, Rafael EspĂ­ndola <
llvm-commits at lists.llvm.org> wrote:

> On 9 December 2015 at 12:33, Tobias Edler Von Koch
> <tobias at codeaurora.org> wrote:
> > Hi Rafael,
> >
> > On 12/08/2015 08:25 PM, Rafael EspĂ­ndola via llvm-commits wrote:
> >>
> >> Note that the behaviour was not "preserve all globals". We were
> >> already lazy linking declarations that can be dropped, like
> >> linkonce_odr and internal.
> >
> >
> > We're actually hitting an issue related to that. Our linker, during LTO,
> > sometimes puts linkonce/linkonce_odr functions on the preserve list.
> > However, this has currently no effect as they could be deleted a) during
> > lazy IR linking if there are no uses to begin with, or b) during DCE if,
> > say, they were inlined completely.
> >
> > To handle case b) we can introduce a use through @llvm.compiler.used in
> > LTOCodeGenerator::applyRestriction but for a) that doesn't work because
> IR
> > linking happens earlier.
> >
> > Any ideas?
>
> Yes :-)
>
> Check what the gold plugin does. If the gold linker asks for a value
> to be preserved, it is changed to a weak/weak_odr to make sure it
> survives all of the pipeline.
>
> Cheers,
> Rafael
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151221/23d101c7/attachment.html>


More information about the llvm-commits mailing list