[llvm] r317292 - Avoid PLT for external calls when attribute nonlazybind is used.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 10:58:31 PDT 2017
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).
Cheers,
Rafael
More information about the llvm-commits
mailing list