HomeFreeBSD

Prepare the kernel linker to handle PC-relative ifunc relocations.

Description

Prepare the kernel linker to handle PC-relative ifunc relocations.

The boot-time ifunc resolver assumes that it only needs to apply
IRELATIVE relocations to PLT entries. With an upcoming optimization,
this assumption no longer holds, so add the support required to handle
PC-relative relocations targeting GNU_IFUNC symbols.

  • Provide a custom symbol lookup routine that can be used in early boot. The default lookup routine uses kobj, which is not functional at that point.
  • Apply all existing relocations during boot rather than filtering IRELATIVE relocations.
  • Ensure that we continue to apply ifunc relocations in a second pass when loading a kernel module.

Reviewed by: kib
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16749