<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 3, 2017 at 10:58 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Sriraman Tallam <<a href="mailto:tmsriram@google.com">tmsriram@google.com</a>> writes:<br>
<br>
>> The check for plt versus got should at the very least be after the<br>
>> shouldAssumeDSOLocal call.<br>
>><br>
><br>
> I tried doing this after shouldAssumeDSOLocal and this does not work well<br>
> non-PIC binaries.  The external call will be considered local and generated<br>
> without the @PLT but the linker will convert the call to PLT. This is the<br>
> reason why I did it before "shouldAssumeDSOLocal". Let me take another look<br>
> and see what I can do here.<br>
<br>
</span>Ah, that is why!<br>
<br>
Yes, the linker hack of creating a dummy plt entry is really annoying.<br>
<br>
I would say that what needs changing is shouldAssumeDSOLocal. It looks<br>
like<br>
<br>
------------------------------<wbr>------------------------------<wbr>-<br>
  // If the IR producer requested that this GV be treated as dso local, obey.<br>
  if (GV && GV->isDSOLocal())<br>
    return true;<br>
<br>
  // According to the llvm language reference, we should be able to just return<br>
  // false in here if we have a GV, as we know it is dso_preemptable.<br>
  // At this point in time, the various IR producers have not been transitioned<br>
  // to always produce a dso_local when it is possible to do so. As a result we<br>
  // still have some pre-dso_local logic in here to improve the quality of the<br>
  // generated code:<br>
....<br>
------------------------------<wbr>------------------------------<wbr>-<br>
<br>
So any addition that returns false in more cases is going on the right<br>
direction. In particular, I think you a hitting the case inside<br>
<br>
  if (IsExecutable) {<br>
  ...<br>
  }<br>
<br>
And it should return false for NonLazyBind (with a comment why).<br></blockquote><div><br></div><div>Thanks for taking a look, let me get back with a patch.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>