From 131c9aad05f409cb598427cdb3ac75569462afe2 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Wed, 25 Sep 2019 10:30:10 +0000 Subject: [PATCH] configure: Use -march=native for x86 architecture only. Exclude -march=native parameter from build command for other architectures since it causes a compilation error in ARM. Change-Id: Ida22ea4b3afba9759102d2e2203fc9e6e312c3ba Signed-off-by: Alexey Marchuk Signed-off-by: Sasha Kotchubievsky Signed-off-by: Evgenii Kochetov Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469390 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- configure | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 750cae90d..79968950a 100755 --- a/configure +++ b/configure @@ -371,11 +371,16 @@ $rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --l CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | cut -d "=" -f 2) CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2) -BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native) +arch=$($CC -dumpmachine) + +if [[ $arch == x86_64* ]]; then + BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native) +else + BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS) +fi # Detect architecture and force no ISA-L if non-x86 archtecture if [[ "${CONFIG[ISAL]}" = "y" ]]; then - arch=$($CC -dumpmachine) if [[ $arch != x86_64* ]]; then echo "Notice: ISA-L disabled due to CPU incompatiblity." CONFIG[ISAL]=n