aboutsummaryrefslogtreecommitdiff
path: root/share/mk/bsd.sys.mk
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2020-09-29 22:30:15 +0000
committerBrooks Davis <brooks@FreeBSD.org>2020-09-29 22:30:15 +0000
commit17b8b8fb5fc4acc832dabfe7ef11e3e1d399ad0f (patch)
tree89191998087a37f954416b5fc813399f19d2267e /share/mk/bsd.sys.mk
parent0e9933968431276e7b6e09acf35e531056e0aaf3 (diff)
downloadsrc-17b8b8fb5fc4acc832dabfe7ef11e3e1d399ad0f.tar.gz
src-17b8b8fb5fc4acc832dabfe7ef11e3e1d399ad0f.zip
Prefer --ld-path=/path/to/ld on clang >= 12
Clang 12 warns about passing a path to -fuse-ld and -Werror makes that an error preventing building world without this change. Reviewed by: arichardson, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26591
Notes
Notes: svn path=/head/; revision=366270
Diffstat (limited to 'share/mk/bsd.sys.mk')
-rw-r--r--share/mk/bsd.sys.mk5
1 files changed, 4 insertions, 1 deletions
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index c5bb6e4068de..2e3fa08b28d5 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -296,10 +296,13 @@ CFLAGS+= ERROR-tried-to-rebuild-during-make-install
# Please keep this if in sync with kern.mk
.if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
# Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
-# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=.
.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_VERSION} >= 120000
+LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W}
+.else
# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
+.endif
.else
# GCC does not support an absolute path for -fuse-ld so we just print this
# warning instead and let the user add the required symlinks.