[llvm] r317292 - Avoid PLT for external calls when attribute nonlazybind is used.

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 12:08:42 PDT 2017


On Fri, Nov 3, 2017 at 10:58 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Sriraman Tallam <tmsriram at google.com> writes:
>
> >> The check for plt versus got should at the very least be after the
> >> shouldAssumeDSOLocal call.
> >>
> >
> > I tried doing this after shouldAssumeDSOLocal and this does not work well
> > non-PIC binaries.  The external call will be considered local and
> generated
> > without the @PLT but the linker will convert the call to PLT. This is the
> > reason why I did it before "shouldAssumeDSOLocal". Let me take another
> look
> > and see what I can do here.
>
> Ah, that is why!
>
> Yes, the linker hack of creating a dummy plt entry is really annoying.
>
> I would say that what needs changing is shouldAssumeDSOLocal. It looks
> like
>
> -------------------------------------------------------------
>   // If the IR producer requested that this GV be treated as dso local,
> obey.
>   if (GV && GV->isDSOLocal())
>     return true;
>
>   // According to the llvm language reference, we should be able to just
> return
>   // false in here if we have a GV, as we know it is dso_preemptable.
>   // At this point in time, the various IR producers have not been
> transitioned
>   // to always produce a dso_local when it is possible to do so. As a
> result we
>   // still have some pre-dso_local logic in here to improve the quality of
> the
>   // generated code:
> ....
> -------------------------------------------------------------
>
> So any addition that returns false in more cases is going on the right
> direction. In particular, I think you a hitting the case inside
>
>   if (IsExecutable) {
>   ...
>   }
>
> And it should return false for NonLazyBind (with a comment why).
>

Thanks for taking a look, let me get back with a patch.


>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/1045dc52/attachment.html>


More information about the llvm-commits mailing list