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

Joerg Sonnenberger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 24 10:46:31 PDT 2017

joerg added a comment.

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.

>> 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.


More information about the cfe-commits mailing list