Silence annoying and incorrect non-default linker warning with GCC
The CROSS_TOOLCHAIN GCC .mk files include -B${CROSS_BINUTILS_PREFIX}, so
GCC will select the right linker and we don't need to warn.
While here also apply 17b8b8fb5f
to kern.mk.
Test Plan: no more warning printed with CROSS_TOOLCHAIN=mips-gcc6
Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D29015
This commit is contained in:
parent
b2c8cbf992
commit
172a624f0c
@ -306,9 +306,13 @@ LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
|
|||||||
.else
|
.else
|
||||||
# GCC does not support an absolute path for -fuse-ld so we just print this
|
# 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.
|
# 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
|
.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
# Tell bmake not to mistake standard targets for things to be searched for
|
# Tell bmake not to mistake standard targets for things to be searched for
|
||||||
# or expect to ever be up-to-date.
|
# or expect to ever be up-to-date.
|
||||||
|
@ -280,19 +280,23 @@ CFLAGS+= -std=${CSTD}
|
|||||||
# Please keep this if in sync with bsd.sys.mk
|
# Please keep this if in sync with bsd.sys.mk
|
||||||
.if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
|
.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".
|
# 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_TYPE} == "clang"
|
||||||
# Note: unlike bsd.sys.mk we can't use LDFLAGS here since that is used for the
|
# Note: Clang does not like relative paths for ld so we map ld.lld -> lld.
|
||||||
# flags required when linking the kernel. We don't need those flags when
|
.if ${COMPILER_VERSION} >= 120000
|
||||||
# building the vdsos. However, we do need -fuse-ld, so use ${CCLDFLAGS} instead.
|
LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W}
|
||||||
# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
|
.else
|
||||||
CCLDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
|
LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
|
||||||
|
.endif
|
||||||
.else
|
.else
|
||||||
# GCC does not support an absolute path for -fuse-ld so we just print this
|
# 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.
|
# 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
|
.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
# Set target-specific linker emulation name.
|
# Set target-specific linker emulation name.
|
||||||
LD_EMULATION_aarch64=aarch64elf
|
LD_EMULATION_aarch64=aarch64elf
|
||||||
|
Loading…
Reference in New Issue
Block a user