[PATCH] D39079: New clang option -fno-plt to avoid PLT for external calls
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 24 11:02:05 PDT 2017
rnk added a comment.
In https://reviews.llvm.org/D39079#905454, @joerg wrote:
> It also increases the pressure on the branch predictor, so it is not really black and white.
I don't understand this objection. I'm assuming that the PLT stub is an indirect jump through the PLTGOT, not a hotpatched stub that jumps directly to the definition chosen by the loader. This is the ELF model that I'm familiar with, especially since calls to code more than 2GB away generally need to be indirect anyway.
> 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.
I'm not sure I understand, but this patch isn't introducing copy relocations, to be clear.
> 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.
Well, yes. The user needs to know that they have an x86-encoding-aware linker, or using this flag is probably going to slow their code down. From my perspective, this is a performance tuning flag, so that's reasonable.
More information about the cfe-commits