Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Apr 2017 10:59:40 -0400
From:      Ed Maste <emaste@freebsd.org>
To:        "freebsd-toolchain@freebsd.org" <freebsd-toolchain@freebsd.org>
Subject:   April 2017 update on using LLVM's lld linker in the FreeBSD base system
Message-ID:  <CAPyFy2ATORfYmtE_nPVd3Tc5igY5kUrnUNZNL5TLS9%2B=uh4KZQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Here's a fresh update on LLVM's LLD linker in the base system,
referencing the plan originally posted at the beginning of 2016. This
work is primarily taking place on amd64 right now, and unless
otherwise noted these results apply to amd64.

First, the completed items:

> 1. Update lld along with the Clang/LLVM 3.9 update that dim@ is working on.
> 2. Add the bmake build infrastructure, installing as /usr/bin/ld.lld
> on the same architectures that use Clang (amd64, arm, arm64, i386).
> 3. Update lld again (most likely to a snapshot from upstream SVN) once
> it is able to link an unmodified FreeBSD kernel.

We now have LLD 4.0.0 in the tree and it can build all of
FreeBSD/amd64 kernel and world, and most of ports.

> 4. Modify the boot loader and kernel builds to avoid using features
> not implemented by lld.
> 5. Introduce a WITH_LLD_AS_LD knob to have /usr/bin/ld be a ld.lld
> hardlink instead of /usr/bin/ld.bfd.

This became WITH_LLD_IS_LD for consistency with WITH_CLANG_IS_CC. It
also controls the bootstrap linker: adding WITH_LLD_IS_LD=yes to
src.conf means that the system will be built with LLD, and LLD will be
/usr/bin/ld in the resulting world.

This option is currently enabled by default on arm64 (only).


Next, where we are today:

> 6. Request ports exp-runs and issue a call for testing with 3rd party
> software. Fix issues found during this process.

This is in progress now, in PR 214864. There are currently 270 failing
ports and 963 skipped. The top ten failing ports (by # skipped) are
responsible for 808 of the skipped; addressing those should allow us
to build nearly 98% of the ports collection with LLD.

For reference, the top ten ports by # skipped are: audio/openal-soft
devel/libunwind editors/libreoffice lang/fpc print/gl2ps editors/emacs
lang/gcc6-aux lang/mono archivers/arj multimedia/libxine


Finally, future tasks:

> 7. Switch /usr/bin/ld to ld.lld by default in head for the Clang-using
> architectures. Add a WITHOUT_LLD_AS_LD knob to switch back to GNU ld.

While there is still no timeline set for this, it is already done for
arm64 (where we have no in-tree GNU ld available), and it is close to
being feasible for amd64. Further investigation is needed on i386 and
32-bit arm before moving forward here.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2ATORfYmtE_nPVd3Tc5igY5kUrnUNZNL5TLS9%2B=uh4KZQ>