freebsd-nq/usr.bin/clang
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
..
bugpoint Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
clang Regenerate clang man page after upstream change to document the possible 2018-04-11 18:39:47 +00:00
clang-format
clang-tblgen First step in updating llvm/clang build glue: make only the clang 2017-12-21 21:24:52 +00:00
llc Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
lld Add an lld option to emit PC-relative relocations for ifunc calls. 2018-08-23 14:58:19 +00:00
lldb
lli Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-ar Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-as Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-bcanalyzer Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-cov Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-cxxdump Minimize library dependencies for some llvm tools. 2017-12-24 12:42:30 +00:00
llvm-cxxfilt Minimize library dependencies for some llvm tools. 2017-12-24 12:42:30 +00:00
llvm-diff Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-dis Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-dwarfdump Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-extract Build llvm-extract with -lz, and add a few objects to liblldb, both of 2018-01-13 13:53:05 +00:00
llvm-link Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-lto
llvm-lto2
llvm-mc
llvm-modextract Minimize library dependencies for some llvm tools. 2017-12-24 12:42:30 +00:00
llvm-nm Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-objcopy Add new llvm-objcopy utility, enabled when MK_CLANG_EXTRAS=yes. 2017-12-24 12:36:31 +00:00
llvm-objdump
llvm-pdbutil Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-profdata Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-rtdyld
llvm-symbolizer Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
llvm-tblgen Update clang, lld and llvm version numbers for r321414, and update build 2017-12-24 12:32:55 +00:00
llvm-xray
opt Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
clang.prog.mk
llvm.prog.mk
Makefile Promote llvm-cov to a standalone option 2018-02-10 00:22:35 +00:00
Makefile.inc