summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2016-11-25 13:15:28 +0000
committerEd Maste <emaste@FreeBSD.org>2016-11-25 13:15:28 +0000
commit0aa5466e7d5279f04c22add1ee218a879753b94e (patch)
tree496872722553ea0235ffd8193cf9d9e1570d9def
parent2641e757426b0b92d46421eeceb63f24ac002566 (diff)
downloadsrc-test2-0aa5466e7d5279f04c22add1ee218a879753b94e.tar.gz
src-test2-0aa5466e7d5279f04c22add1ee218a879753b94e.zip
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
Notes
Notes: svn path=/head/; revision=309142
-rw-r--r--Makefile.inc12
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile2
-rw-r--r--share/mk/src.opts.mk5
-rw-r--r--tools/build/options/WITHOUT_LLD_AS_LD2
-rw-r--r--tools/build/options/WITH_LLD_AS_LD2
-rw-r--r--usr.bin/clang/lld/Makefile5
6 files changed, 17 insertions, 1 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index b718afeef05d..8231e508a06b 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -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" \
diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile
index 5bc3846a1434..6fcc69a479fc 100644
--- a/gnu/usr.bin/binutils/ld/Makefile
+++ b/gnu/usr.bin/binutils/ld/Makefile
@@ -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\"
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 51b79f3d609a..655818580bd5 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -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
diff --git a/tools/build/options/WITHOUT_LLD_AS_LD b/tools/build/options/WITHOUT_LLD_AS_LD
new file mode 100644
index 000000000000..0d48f205d85d
--- /dev/null
+++ b/tools/build/options/WITHOUT_LLD_AS_LD
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use GNU binutils ld as the system linker, instead of LLVM's LLD.
diff --git a/tools/build/options/WITH_LLD_AS_LD b/tools/build/options/WITH_LLD_AS_LD
new file mode 100644
index 000000000000..a291b099bf06
--- /dev/null
+++ b/tools/build/options/WITH_LLD_AS_LD
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to use LLVM's LLD as the system linker, instead of GNU binutils ld.
diff --git a/usr.bin/clang/lld/Makefile b/usr.bin/clang/lld/Makefile
index ad418e35e558..65a73f2f4c0f 100644
--- a/usr.bin/clang/lld/Makefile
+++ b/usr.bin/clang/lld/Makefile
@@ -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}