Skip to content

Commit 979956b

Browse files
committed
KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
Force -march=x86-64-v2 to avoid SSE/AVX instructions if and only if the uarch definition is supported by the compiler, e.g. gcc 7.5 only supports x86-64. Fixes: 9a40006 ("KVM: selftests: x86: Avoid using SSE/AVX instructions") Cc: Vitaly Kuznetsov <[email protected]> Reviewed-and-tested-by: Vitaly Kuznetsov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 5b188cc commit 979956b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/testing/selftests/kvm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,10 @@ ifeq ($(ARCH),s390)
249249
CFLAGS += -march=z10
250250
endif
251251
ifeq ($(ARCH),x86)
252+
ifeq ($(shell echo "void foo(void) { }" | $(CC) -march=x86-64-v2 -x c - -c -o /dev/null 2>/dev/null; echo "$$?"),0)
252253
CFLAGS += -march=x86-64-v2
253254
endif
255+
endif
254256
ifeq ($(ARCH),arm64)
255257
tools_dir := $(top_srcdir)/tools
256258
arm64_tools_dir := $(tools_dir)/arch/arm64/tools/

0 commit comments

Comments
 (0)