]> git.droids-corp.org - dpdk.git/commitdiff
build: check AVX512 rather than binutils version
authorBruce Richardson <bruce.richardson@intel.com>
Sat, 4 Jul 2020 11:48:01 +0000 (12:48 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 5 Jul 2020 19:32:40 +0000 (21:32 +0200)
Rather than checking the binutils version number, which can lead to
unnecessary disabling of AVX512 if fixes have been backported to distro
versions, we can instead check the output of "as" from binutils to see if
it is correct.

The check in the script uses the minimal assembly reproduction code posted
to the public bug tracker for gcc/binutils for those issues [1]. If the
binutils bug is present, the instruction parameters - specifically the
displacement parameter - will be different in the disassembled output
compared to the input. Therefore the check involves assembling a single
instruction and disassembling it again, checking that the two match.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
MAINTAINERS
buildtools/binutils-avx512-check.sh [new file with mode: 0755]
buildtools/meson.build
config/x86/meson.build
meson.build

index 5e706cd7e8f299145356ec4f6303ad7ca4164e75..27a7be8e647a7a667d258a1f0d4f42d15a82f6b2 100644 (file)
@@ -123,6 +123,7 @@ M: Bruce Richardson <bruce.richardson@intel.com>
 F: meson.build
 F: meson_options.txt
 F: config/rte_config.h
+F: buildtools/binutils-avx512-check.sh
 F: buildtools/call-sphinx-build.py
 F: buildtools/gen-pmdinfo-cfile.sh
 F: buildtools/list-dir-globs.py
diff --git a/buildtools/binutils-avx512-check.sh b/buildtools/binutils-avx512-check.sh
new file mode 100755 (executable)
index 0000000..a7e0681
--- /dev/null
@@ -0,0 +1,16 @@
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation
+
+AS=${AS:-as}
+OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
+trap 'rm -f "$OBJFILE"' EXIT
+# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
+GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
+
+# assemble vpgather to file and similarly check
+echo "vpgatherqq $GATHER_PARAMS" | $AS --64 -o $OBJFILE -
+objdump -d  --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS || {
+       echo "vpgatherqq displacement error with as"
+       exit 1
+}
index f9d2fdf74bd203e477c1f897f40584f5dda913cd..cf0048f3cdc3a5844d4254920d9e497ff556aabf 100644 (file)
@@ -1,13 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-subdir('pmdinfogen')
-
 pkgconf = find_program('pkg-config', 'pkgconf', required: false)
 pmdinfo = find_program('gen-pmdinfo-cfile.sh')
 list_dir_globs = find_program('list-dir-globs.py')
 check_symbols = find_program('check-symbols.sh')
 ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
+binutils_avx512_check = find_program('binutils-avx512-check.sh')
 
 # set up map-to-win script using python, either built-in or external
 python3 = import('python').find_installation(required: false)
index adc857ba28c6b67f10fe48e0ccc46832a81b613c..6ec020ef6b27bd0d77f866dc4e301b4a447fb0c7 100644 (file)
@@ -3,14 +3,10 @@
 
 # get binutils version for the workaround of Bug 97
 if not is_windows
-       ldver = run_command('ld', '-v').stdout().strip()
-       if ldver.contains('2.30') and cc.has_argument('-mno-avx512f')
+       binutils_ok = run_command(binutils_avx512_check)
+       if binutils_ok.returncode() != 0 and cc.has_argument('-mno-avx512f')
                machine_args += '-mno-avx512f'
-               message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
-       endif
-       if ldver.contains('2.31') and cc.has_argument('-mno-avx512f')
-               machine_args += '-mno-avx512f'
-               message('Binutils 2.31 detected, disabling AVX512 support as workaround for bug #249')
+               warning('Binutils error with AVX512 assembly, disabling AVX512 support')
        endif
 endif
 
index e8bb9c4c1ec652a1e8b7bb050654ef51944373cb..61d9a4f5faf525cff98819584a881f3ccb397f28 100644 (file)
@@ -39,10 +39,13 @@ global_inc = include_directories('.', 'config',
        'lib/librte_eal/@0@/include'.format(host_machine.system()),
        'lib/librte_eal/@0@/include'.format(arch_subdir),
 )
+
+# do configuration and get tool paths
+subdir('buildtools')
 subdir('config')
 
 # build libs and drivers
-subdir('buildtools')
+subdir('buildtools/pmdinfogen')
 subdir('lib')
 subdir('drivers')