aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-08-23 02:55:00 +0800
committeremaste <emaste@FreeBSD.org>2017-08-23 02:55:00 +0800
commit2346b1425939af946c53f9f1a28f665a1eca3b2d (patch)
tree1b3bfaba76de5b1052b0fe80c1dfbc7303faadb7 /Mk
parentf71af230993fc6ea1b158fde5145a129cafb333c (diff)
downloadfreebsd-ports-gnome-2346b1425939af946c53f9f1a28f665a1eca3b2d.tar.gz
freebsd-ports-gnome-2346b1425939af946c53f9f1a28f665a1eca3b2d.tar.zst
freebsd-ports-gnome-2346b1425939af946c53f9f1a28f665a1eca3b2d.zip
Add LLD_UNSAFE to force use of ld.bfd when ld is lld
By default the compiler will find /usr/bin/ld for the linker. If a port sets LLD_UNSAFE and /usr/bin/ld is ld.lld, then add -fuse-ld=bfd to force the use of the binutils BFD linker (from the base system, if available, or by setting USE_BINUTILS). This change is based on an earlier, similar patch from bapt, with the addition of the -fuse-ld flag. PR: 214864 Reviewed by: bapt Approved by: portmgr (bapt) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12064
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.port.mk14
1 files changed, 14 insertions, 0 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 75f19e58d60e..52f80436b0c9 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1737,6 +1737,20 @@ PKG_DEPENDS+= ${LOCALBASE}/sbin/pkg:${PKG_ORIGIN}
.include "${PORTSDIR}/Mk/bsd.gcc.mk"
.endif
+_TEST_LD=/usr/bin/ld
+.if defined(LLD_UNSAFE) && ${_TEST_LD:tA} == "/usr/bin/ld.lld"
+LDFLAGS+= -fuse-ld=bfd
+. if !defined(USE_BINUTILS)
+. if exists(/usr/bin/ld.bfd)
+LD= /usr/bin/ld.bfd
+CONFIGURE_ENV+= LD=${LD}
+MAKE_ENV+= LD=${LD}
+. else
+USE_BINUTILS= yes
+. endif
+. endif
+.endif
+
.if defined(USE_BINUTILS) && !defined(DISABLE_BINUTILS)
BUILD_DEPENDS+= ${LOCALBASE}/bin/as:devel/binutils
BINUTILS?= ADDR2LINE AR AS CPPFILT GPROF LD NM OBJCOPY OBJDUMP RANLIB \