Add WITH_LLD_AS_LD build knob

If set it installs LLD as /usr/bin/ld.  LLD (as of version 3.9) is not
capable of linking the world and kernel, but can self-host and link many
substantial applications. GNU ld continues to be used for the world and
kernel build, regardless of how this knob is set.

It is on by default for arm64, and off for all other CPU architectures.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2016-11-25 13:15:28 +00:00
parent 2641e75742
commit 0aa5466e7d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309142
6 changed files with 17 additions and 1 deletions

View File

@ -516,7 +516,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
# cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
MK_GDB=no MK_TESTS=no
MK_GDB=no MK_TESTS=no MK_LLD_AS_LD=no
# kernel-tools stage
KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \

View File

@ -49,7 +49,9 @@ CLEANFILES+= ldemul-list.h stringify.sed
FILES= ${LDSCRIPTS:S|^|ldscripts/|}
FILESDIR= ${SCRIPTDIR}
.if ${MK_LLD_AS_LD} == "no"
LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
.endif
HOST= ${TARGET_TUPLE}
LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\"

View File

@ -250,6 +250,11 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
.else
__DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
.endif
.if ${__T} == "aarch64"
__DEFAULT_YES_OPTIONS+=LLD_AS_LD
.else
__DEFAULT_NO_OPTIONS+=LLD_AS_LD
.endif
.if ${__T} == "aarch64" || ${__T} == "amd64"
__DEFAULT_YES_OPTIONS+=LLD LLDB
.else

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to use GNU binutils ld as the system linker, instead of LLVM's LLD.

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to use LLVM's LLD as the system linker, instead of GNU binutils ld.

View File

@ -1,10 +1,15 @@
# $FreeBSD$
.include <src.opts.mk>
LLVM_SRCS= ${SRCTOP}/contrib/llvm
LLD_SRCS= ${LLVM_SRCS}/tools/lld
PROG_CXX= ld.lld
MAN=
.if ${MK_LLD_AS_LD} != "no"
SYMLINKS= ${PROG_CXX} ${BINDIR}/ld
.endif
CFLAGS+= -I${LLD_SRCS}/include
CFLAGS+= -I${.OBJDIR}