Heads-up: linker (lld) changes for amd64 coming soon

Ed Maste emaste at freebsd.org
Tue Mar 27 02:15:01 UTC 2018


Some changes related to the amd64 linker are nearly ready to be
committed (within a week or three), so I'm sending this notice to
request any final comments or concerns before these changes are made.

1. Kostik (kib@) has a patch to start using kernel ifunc, with the
first use being Supervisor Mode Access Prevention (SMAP) on amd64.
This relies on linker support that is available in the in-tree lld and
in contemporary binutils ld.bfd from ports, but not in the in-tree
ld.bfd 2.17.50.

Right now we use lld as the default bootstrap linker for amd64 in
-CURRENT -- that is, the kernel, and userland libraries and binaries
are linked with lld. To revert to ld.bfd for amd64 the build-time knob
WITHOUT_LLD_BOOTSTRAP=yes can currently be added to src.conf. When the
ifunc changes get committed WITHOUT_LLD_BOOTSTRAP=yes will not work
for amd64 kernels (and will be added to BROKEN_OPTIONS).

2. WITH_LLD_IS_LD controls whether /usr/bin/ld is ld.bfd or ld.lld,
and thus the linker used for linking ports. I plan to switch this to
default on.

Most ports build just fine when lld is the system linker, but a few
encounter trouble: some of the ports rely on options not supported by
lld, rely on specific quirks of ld.bfd's implementation, or have a
buggy linker invocation that is silently ignored by ld.bfd.

The majority of such ports have now been adapted to work with lld or
configured to use ld.bfd as the linker, but there are a small number
of failing ports that do not provide a way to use other than the
default system linker /usr/bin/ld. The outstanding issues can be found
in the ports exp-run for lld as /usr/bin/ld, PR214864.

Please follow up if you have any concerns or comments about these
upcoming changes.


More information about the freebsd-current mailing list