Ports and LLVM's lld linker

Ed Maste emaste at freebsd.org
Tue Dec 19 03:11:14 UTC 2017


On 27 November 2017 at 15:39, Ed Maste <emaste at freebsd.org> wrote:
> We're making good progress on using LLVM's lld linker as FreeBSD's
> /usr/bin/ld, so I'd like to raise awareness of the new linker within
> the ports community.

With a couple of recent changes in src head (r326831 and r326897) lld
is now suitable for use as the base system /usr/bin/ld on amd64 and
i386. We're working through ports failures, starting with those
responsible for the largest number of skipped ports.

The top four, on amd64:

port                            # skipped
devel/libunwind                 7994
databases/postgresql*-client    230
lang/fpc                        76
lang/mono                       22

The remaining failures are responsible for no more than 2 skipped ports each.

devel/libunwind fails due to the shared object protected visibility
symbol preemption issue; Dimitry Andric and I are searching for an
appropriate fix.

The databases/postgresql*-client failures have been worked around by
r456635, adding LLD_UNSAFE=yes so that the port uses ld.bfd.

lang/fpc appears to suffer from stricter validation performed by lld:
/usr/bin/ld: error: x86_64/units/x86_64-freebsd/i_linux.o: invalid
alignment of section headers

lang/mono fails because lld defaults to -z text, disallowing
relocations in read-only segments (like .text). A workaround is to add
-z notext to the link command line, which turns off lld's error for
this case and results in the same behaviour as ld.bfd and ld.gold
provide by default.

Unfortunately usual workarounds (LLD_UNSAFE=yes or
LDFLAGS=Wl,-z,notext) fail for both lang/fpc and lang/mono, and it's
not immediately obvious to me how their respective builds handle the
options. I'll probably need help from acm@ and mono@ for these.

For reference the remaining ports failing with lld on amd64 are:
archivers/lua51-zlib
audio/alure
benchmarks/wrk
databases/postgres-xl
devel/libds
devel/libtecla
devel/pdcurses
devel/ztcl
emulators/gem5
ftp/rexx-curl
irc/eggdrop
irc/eggdrop-devel
irc/evangeline
lang/rexx-imc
lang/rexx-regutil
lang/siod
lang/smlnj
lang/tclX
mail/qmail-dk
math/rexx-regmath
misc/seabios
net-im/uTox
net/py-netif
net/py-netif
print/openprinting
print/pdftk
security/otpw
shells/bash-static
sysutils/dupd
sysutils/e2fsprogs
sysutils/installwatch
sysutils/unieject
www/cgihtml
www/dummyflash
www/mod_jk
www/mozplugger
www/tdom


More information about the freebsd-ports mailing list