[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:59:05 PDT 2017
tmsriram added a comment.
In https://reviews.llvm.org/D39079#905454, @joerg wrote:
> In https://reviews.llvm.org/D39079#905396, @rnk wrote:
> > In https://reviews.llvm.org/D39079#905372, @joerg wrote:
> > > Why again is this a good idea?
> > It saves the direct jump to the PLT, reducing icache pressure, which is a major cost in some workloads.
> It also increases the pressure on the branch predictor, so it is not really black and white.
My experiments show that doing this improves performance of some our large workloads by upto 1% and it happens with a reduction in iTLB misses.
>>> This is an even worse hack than -Bsymbolic,
>> Personally, I would like to build LLVM with -Bsymbolic so that we can build LLVM as a DSO and load it from clang without regressing startup time, so I don't see what's so terrible about -Bsymbolic, especially for C++ programs.
> Qt5 tries that. Requires further hacks as the main binary must be compiled as fully position independent code to not run into fun latter. Fun with copy relocations is only part of it.
>> Anyway, LLVM already has an attribute, nonlazybind, and this just provides a flag to apply it to all declarations. It gives the user access to the GOTPCREL relocations that we, and loaders, already support.
> The loader doesn't see GOTPCREL anymore. It also requires a linker that disassembles instructions, because it can't distinguish between a normal pointer load and a call, to be able to optimize it.
The linker can replace indirect calls via GOTPCREL with direct calls, both GOLD and BFD linker support this today.
More information about the cfe-commits