[PATCH] D39079: New clang option -fno-plt to avoid PLT for external calls

Sriraman Tallam via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 24 10:56:05 PDT 2017


tmsriram added a comment.

In https://reviews.llvm.org/D39079#905423, @rnk wrote:

> In https://reviews.llvm.org/D39079#905395, @joerg wrote:
>
> > Let me phrase it differently. What is this patch (and the matching backend PR) supposed to achieve? There are effectively two ways to get rid of PLT entries:
> >  (1) Bind references locally. This is effectively what -Bsymbolic does and what is breaking the ELF interposition rules.
> >  (2) Do an indirect call via the GOT. Requires knowing what  an external symbol is, making it non-attractive for anything but LTO, since it will create performance issues for all non-local accesses (i.e. anything private).
>
>
> This patch does 2. According to @tmsriram, clever linkers can turn the indirect call back into a nop+call_pcrel32. If this isn't universal, the user must know what their linker supports. I don't see how it causes performance issues for non-local calls, since the PLT will do a jump through the GOT anyway.


Yes, please see this for GOLD linkers: https://sourceware.org/ml/binutils/2016-05/msg00322.html


https://reviews.llvm.org/D39079





More information about the cfe-commits mailing list