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 |
||
---|---|---|
.. | ||
include | ||
lib | ||
patches | ||
projects/libunwind | ||
tools | ||
utils/TableGen | ||
FREEBSD-Xlist | ||
LICENSE.TXT |