freebsd-dev/contrib/llvm
Mark Johnston 4023442dc9 Add an lld option to emit PC-relative relocations for ifunc calls.
The current kernel ifunc implementation creates a PLT entry for each
ifunc definition.  ifunc calls therefore consist of a call to the
PLT entry followed by an indirect jump.  The jump target is written
during boot when the kernel linker resolves R_[*]_IRELATIVE relocations.
This implementation is defined by requirements for userland code, where
text relocations are avoided.  This requirement is not present for the
kernel, so the implementation has avoidable overhead (namely, an extra
indirect jump per call).

Address this for now by adding a special option to the static linker
to inhibit PLT creation for ifuncs.  Instead, relocations to ifunc call
sites are passed through to the output file, so the kernel linker can
enumerate such call sites and apply PC-relative relocations directly
to the text section.  Thus the overhead of an ifunc call becomes exactly
the same as that of an ordinary function call.  This option is only for
use by the kernel and will not work for regular programs.

The final form of this optimization is up for debate; for now, this
change is simple and static enough to be acceptable as an interim
solution.

Reviewed by:	emaste
Discussed with:	arichardson, dim
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16748
2018-08-23 14:58:19 +00:00
..
include llvm: [ARM] Complete enumeration values for Tag_ABI_VFP_args 2018-07-31 14:14:41 +00:00
lib Pull in r338481 from upstream llvm trunk (by Chandler Carruth): 2018-08-11 10:42:12 +00:00
patches
projects/libunwind o Implement unw_getcontext() 2018-06-19 14:46:59 +00:00
tools Add an lld option to emit PC-relative relocations for ifunc calls. 2018-08-23 14:58:19 +00:00
utils/TableGen Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_60 r321788, 2018-01-06 23:44:14 +00:00
FREEBSD-Xlist
LICENSE.TXT Merge llvm, clang, lld and lldb release_40 branch r292009. Also update 2017-01-14 22:12:13 +00:00