Update on using LLVM's lld linker in the FreeBSD base system

Ed Maste emaste at freebsd.org
Wed Sep 7 13:10:26 UTC 2016


On 1 August 2016 at 17:40, Ed Maste <emaste at freebsd.org> wrote:
> Over the past year or so I have been investigating the state of LLVM's
> lld linker for use in the FreeBSD base system, to see if it could be
> used as FreeBSD's system linker.
>
> ...
> There are a few features used by the FreeBSD base system that lld
> developers (intentionally) do not expect to implement, unless they're
> reasonably widely used in a variety of different software. If they're
> not implemented we can modify FreeBSD to avoid using them. I'm aware
> of:
>
> -N/--omagic, used by some boot loader components. We can achieve the
> same effect with a linker script.

Warner addressed this for x86 boot components in r305353. We still
have an issue: lld does not support -Ttext, but does have an
-image-base option to set the start address. It would be nice to
reconcile this and LLVM PR 30269 is open to track this for lld.

> -dc, used by the rescue build. As long as object files are built
> specifically for rescue we can probably use -fno-common instead.

I briefly tried to get the rescue build working with lld, but was not
successful and have just left it disabled in my tests. We can
investigate this later.

> -b binary to convert binary files into ELF objects, used by some
> device drivers in kernel and module builds. We can use
> objcopy(elfcopy) instead.

There is now an lld change in progress to add support for -b binary:
https://reviews.llvm.org/D24060


More information about the freebsd-toolchain mailing list