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

autopackage: Support LTO build under FreebSD



Our CI has been providing appropriate setup for a long time now so
there's no reason to not use LTO under FreeBSD especially that the LLD
linker does indeed support LTO.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 0fa8f6cb
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -22,18 +22,19 @@ fi

timing_enter build_release

config_params="$(get_config_params | sed 's/--enable-debug//g')"
if [ $(uname -s) = Linux ]; then
# LTO needs a special compiler to work under clang. See detect_cc.sh for details.
if [[ $CC == *clang* ]]; then
		LD=$(type -P ld.gold)
		export LD
	fi
	$rootdir/configure $config_params --enable-lto
else
	# LTO needs a special compiler to work on BSD.
	$rootdir/configure $config_params
	case "$(uname -s)" in
		Linux) # Shipped by default with binutils under most of the Linux distros
			export LD=ld.gold ;;
		FreeBSD) # Default compiler which does support LTO, set it explicitly for visibility
			export LD=ld.lld ;;
	esac
fi

config_params="$(get_config_params | sed 's/--enable-debug//g')"
"$rootdir/configure" $config_params --enable-lto

$MAKE ${MAKEFLAGS}
$MAKE ${MAKEFLAGS} clean