freebsd-skq/usr.bin/clang
markj 401e64920a 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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
llvm-lto2 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
llvm-mc DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
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 DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
opt Regenerate llvm tools manpages, and add one for llvm-pbdutil. 2017-12-24 13:02:43 +00:00
clang.prog.mk Fix packaging for clang, lldb and lld 3.9.0 2016-11-28 20:13:56 +00:00
llvm.prog.mk Fix packaging for clang, lldb and lld 3.9.0 2016-11-28 20:13:56 +00:00
Makefile Promote llvm-cov to a standalone option 2018-02-10 00:22:35 +00:00
Makefile.inc Improve the coverage of debug symbols for MK_DEBUG_FILES. 2017-08-23 23:30:25 +00:00