Commit 2df86d17 authored by Michal Berger's avatar Michal Berger Committed by Konrad Sztyber
Browse files

test/common: Try to support ld.lld under linux for the clang LTO build



It's still a better choice than ld.gold, especially with different
instrumentation enabled on top (like ASAN|UBSAN. Regardless if it's
actually sensible to have these enabled for the optimized build).
So in case it's found, just use it over ld.gold.

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


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 02b30d3a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -456,8 +456,15 @@ _build_release() (
	if [[ $CC == *clang* ]]; then
		jobs=$(($(nproc) / 2))
		case "$(uname -s)" in
			Linux) # Shipped by default with binutils under most of the Linux distros
				export LD=ld.gold LDFLAGS="-Wl,--threads,--thread-count=$jobs" MAKEFLAGS="-j$jobs" ;;
			Linux)
				# ld.gold is shipped by default with binutils under most of the Linux distros.
				# But just in case, look for ld.lld as it's still better suited for the LTO
				# build under clang.
				if ! LD=$(type -P ld.lld); then
					LD=ld.gold LDFLAGS="-Wl,--threads,--thread-count=$jobs" MAKEFLAGS="-j$jobs"
				fi
				export LD LDFLAGS MAKEFLAGS
				;;
			FreeBSD) # Default compiler which does support LTO, set it explicitly for visibility
				export LD=ld.lld ;;
		esac