From befdb28194e1514faa337238f97132b8011cd2f7 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 26 Oct 2023 17:23:10 +0200 Subject: [PATCH] test-flags: support the x86 microarchitecture levels --- test/check-flags.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/check-flags.sh b/test/check-flags.sh index a95cb91db..21e41fa6f 100755 --- a/test/check-flags.sh +++ b/test/check-flags.sh @@ -14,9 +14,23 @@ if [ ! -d "${SDE_PATH}" ]; then mkdir -p "${SDE_PATH}" fi +if [ -e /lib/ld-linux-x86-64.so.2 ]; then + LD=/lib/ld-linux-x86-64.so.2 +else + LD=/lib64/ld-linux-x86-64.so.2 +fi + NATIVE_SUPPORT=1 for FLAG in $CFLAGS; do - echo $FLAG | grep -qP '^\-m[0-9a-zA-Z\.]+$' || continue + if echo "$FLAG" | grep -q '\-march=x86-64-v[234]$' ; then + if grep -qP " ${FLAG:7} \(supported" <(${LD} --help) ; then + continue + else + NATIVE_SUPPORT=0 + continue + fi + fi + echo "$FLAG" | grep -qP '^\-m[0-9a-zA-Z\.]+$' || continue case "${FLAG:2}" in # sse3 doesn't show up in /proc/cpuinfo (?!?!) "sse3") @@ -39,11 +53,11 @@ case "$COMMAND" in ;; esac -if [ $COMMAND = 'query' ]; then +if [ "$COMMAND" = "query" ]; then test $NATIVE_SUPPORT -eq 1 exit $? elif [ $NATIVE_SUPPORT -eq 1 ]; then - $@ + "$@" exit $? elif [ "$COMMAND" = "sde" ]; then ( @@ -52,7 +66,7 @@ elif [ "$COMMAND" = "sde" ]; then "$(dirname "$0")"/download-sde.sh "${SDE_PATH}" fi ) 9>/tmp/sde-download.lock - "${SDE_PATH}/sde64" -${INTEL_TARGET} -- $@ + "${SDE_PATH}/sde64" "-${INTEL_TARGET}" -- "$@" exit $? else echo "Flags not supported, skipping"