Can't build kernel anymore: amd64 kernel requires linker ifunc support

Ed Maste emaste at freebsd.org
Wed May 16 14:43:30 UTC 2018


On 16 May 2018 at 09:35, Rodney W. Grimes
<freebsd-rwg at pdx.rh.cn85.dnsmgr.net> wrote:
>>
>> LD=ld.lld make
>>
>> is the magic here. The kernel needs a new linker to properly link in the
>> ifunc, and that's not our ancient ld. lld does it, as does the latter-day
>> binutils.
>
> Since this now seems to be a mandatory thing to get a kernel built
> can it please be set in the Makefile that is needing it?

It's already handled by the Makefile that needs it when using the
normal build process - i.e., "make buildworld buildkernel" (or
toolchain or kernel-toolchain followed by buildkernel).

The failure arises when building a kernel the "old" way, using config
and then and make in the kernel directory. This inherently uses the
host's linker (/usr/bin/ld), which is too old to link the kernel. We
can't just add LD=ld.lld to the kernel's Makefile(s), because it would
break external toolchain and other cases where users use a specific
linker. I hope to introduce a KERNEL_LD Make variable that controls
the linker used for the kernel link, but it's more involved than a one
or two line change for the same reason that we can't just set
LD=ld.lld.

ld.lld will start being installed as /usr/bin/ld once these two issues
are resolved:

pr227968 [exp-run] Update lang/ghc to 8.4.2, devel/stack to 1.7.1, and
all the */hs-* ports
pr214864 [exp-run] test build with lld as /usr/bin/ld

The exp-run for the first is complete and I believe we are now just
waiting on the change to be committed. As soon as that happens I will
ask for another exp-run for the second PR, and will commit the change
to install lld by default as soon as it completes (assuming
successfully).


More information about the freebsd-arch mailing list