Page MenuHomeFreeBSD

D29015.diff
No OneTemporary

D29015.diff

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -306,9 +306,13 @@
.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.
+# However, we can avoid this warning if -B is set appropriately (e.g. for
+# CROSS_TOOLCHAIN=...-gcc).
+.if !(${LD:[1]:T} == "ld" && ${CC:tw:M-B${LD:[1]:H}/})
.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported
.endif
.endif
+.endif
# Tell bmake not to mistake standard targets for things to be searched for
# or expect to ever be up-to-date.
diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -280,19 +280,23 @@
# Please keep this if in sync with bsd.sys.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"
-# Note: unlike bsd.sys.mk we can't use LDFLAGS here since that is used for the
-# flags required when linking the kernel. We don't need those flags when
-# building the vdsos. However, we do need -fuse-ld, so use ${CCLDFLAGS} instead.
-# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
-CCLDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
+# Note: Clang does not like relative paths for ld so we map ld.lld -> lld.
+.if ${COMPILER_VERSION} >= 120000
+LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W}
+.else
+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.
+# However, we can avoid this warning if -B is set appropriately (e.g. for
+# CROSS_TOOLCHAIN=...-gcc).
+.if !(${LD:[1]:T} == "ld" && ${CC:tw:M-B${LD:[1]:H}/})
.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported
.endif
.endif
+.endif
# Set target-specific linker emulation name.
LD_EMULATION_aarch64=aarch64elf

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 24, 3:52 AM (9 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37172784
Default Alt Text
D29015.diff (2 KB)

Event Timeline