svn commit: r327783 - head/share/mk

John Baldwin jhb at freebsd.org
Sat Jan 13 01:46:33 UTC 2018


On Wednesday, January 10, 2018 08:28:01 PM Ed Maste wrote:
> Author: emaste
> Date: Wed Jan 10 20:28:01 2018
> New Revision: 327783
> URL: https://svnweb.freebsd.org/changeset/base/327783
> 
> Log:
>   Enable ld.lld as bootstrap linker by default on amd64
>   
>   For some time we have been planning to migrate to LLVM's lld linker.
>   Having a man page was the last blocking issue for using ld.lld to link
>   the base system kernel + userland, now addressed by r327770.  Link the
>   kernel and userland libraries and binaries with ld.lld by default, for
>   additional test coverage.
>   
>   This has been a long time in the making.  On 2013-04-13 I submitted an
>   upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's
>   system linker.  Since then 85 individual issues were identified, and
>   submitted as dependencies.  These have been addressed along with two
>   and a half years of other lld development and improvement.
>   
>   I'd like to express deep gratitude to upstream lld developers Rui
>   Ueyama, Rafael Espindola, George Rimar and Davide Italiano.  They put in
>   substantial effort in addressing the issues we found affecting
>   FreeBSD/amd64.
>   
>   To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set
>   
>       WITHOUT_LLD_BOOTSTRAP=yes
>   
>   If you need to set this, please follow up with a PR or post to the
>   freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP
>   failed for your use case.
>   
>   Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still
>   be used for linking ports.  ld.lld can be installed as /usr/bin/ld by
>   setting in /etc/src.conf
>   
>       WITH_LLD_IS_LLD=yes
>   
>   A followup commit will set WITH_LLD_IS_LD by default, possibly after
>   Clang/LLVM/lld 6.0 is merged to FreeBSD.
>   
>   Release notes:	Yes
>   Sponsored by:	The FreeBSD Foundation

FYI, due to a quirk of how we load kernel modules on amd64 in such a way that
doesn't really honor the ELF spec (but is self-consistent in the kernel and
loader) and the fact that LLD doesn't sort sections the way BFD does, this
change has confused kgdb such that it can compute different address for
symbols.  I dont think i386 is affected, only amd64.  I've started on a fix,
but my first attempt to boot it resulted in no modules loading anymore and
it's time to go home for the day. :-P  I'll try to resolve this early next
week.  If you need to use kgdb on amd64 with kernel modules, you will have
to build with an external toolchain (the old ld.bfd can't cope with the
kernel ifunc stuff).

-- 
John Baldwin


More information about the svn-src-head mailing list