Commit d0f57d15 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

configure: Hint compiler at what linker to use via -fuse-ld



When user provides custom $LD, which points at something different than
the bfd linker, it's not considered while testing the dependencies via
BUILD_CMD[@]. Granted, the proper linker is then set via our mk infra,
but the same way as BUILD_CMD[@] uses $CC, ${C,LD}FLAGS it should also
consider other relevant opts.

There's a small conundrum that forces as to do the same thing for the
isa-l* - in case user tries to provide extra params to the linker via
LDFLAGS and which may be specific to a given $LD_TYPE, the isa-l*
configure will fail while trying to compile its dependencies. This is
because it still slurps the LDFLAGS but the compiler keeps using the
default linker. As we overwrite isa-l*'s CFLAGS via its cmdline we
can't pass that information through the environment as well. So as a
best effort, without dancing too much, just pass -fuse-ld to it based
on what detect_cc.sh already provided. From perspective of the actual
isa-l* build this is still foobar, since this param won't be actually
used (and clang won't mind telling us about it) so to silence any
warnings about it slap no-unused-command-line-argument as well.

Change-Id: If392c64099b0b50c879d504151763723924edf77
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21769


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
parent d3d3c0a8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -691,6 +691,7 @@ else
	BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS)
fi
BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib)
BUILD_CMD+=("-fuse-ld=$LD_TYPE")

if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then
	if ! echo -e '#include <json-c/json.h>' \
@@ -1227,7 +1228,7 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
	ISAL_OPTS+=("--prefix=${CONFIG[PREFIX]}")
	echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..."
	./autogen.sh &> $ISAL_LOG
	./configure CFLAGS="-fPIC -g -O2" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1
	./configure CFLAGS="-fPIC -g -O2 -fuse-ld=$LD_TYPE -Wno-unused-command-line-argument" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1
	echo "done."
	cd $rootdir
else
@@ -1260,7 +1261,7 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
	ISAL_CRYPTO_OPTS+=("--prefix=${CONFIG[PREFIX]}")
	echo -n "Configuring ISA-L-crypto (logfile: $ISAL_CRYPTO_LOG)..."
	./autogen.sh &> $ISAL_CRYPTO_LOG
	./configure CFLAGS="-fPIC -g -O2" "${ISAL_CRYPTO_OPTS[@]}" >> $ISAL_CRYPTO_LOG 2>&1
	./configure CFLAGS="-fPIC -g -O2 -fuse-ld=$LD_TYPE -Wno-unused-command-line-argument" "${ISAL_CRYPTO_OPTS[@]}" >> $ISAL_CRYPTO_LOG 2>&1
	echo "done."
	cd $rootdir
	CONFIG[ISAL_CRYPTO]=y