[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86emul: suppress default test harness build with incapable compiler

A top level "make build", as used e.g. by osstest, wants to build all
"all" targets in enabled tools subdirectories, which by default also
includes the emulator test harness. The use of, in particular, AVX512
insns in, again in particular, test_x86_emulator.c causes this build to
fail though when the compiler is not new enough. Take a big hammer and
suppress the default harness build altogether when any of the extensions
used is not supported by the specified (or defaulted to) compiler.

Leave the "run" target alone though: While some of the test code blobs
may fail to build with older compilers, as long as the main executable
can be built some limited testing can still be done.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -5,7 +5,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 TARGET := test_x86_emulator
 .PHONY: all
-all: $(TARGET)
 .PHONY: run
 run: $(TARGET)
@@ -68,6 +68,24 @@ avx512f-opmask-vecs := 2
 avx512dq-opmask-vecs := 1
 avx512bw-opmask-vecs := 4 8
+# Suppress building by default of the harness if the compiler can't deal
+# with any of the extensions used.  Don't alter the "run" target dependencies
+# though, as this target needs to be specified manually, and things may work
+# partially even with older compilers.
+define simd-check-cc
+TARGET-$(shell echo 'int i;' | $(CC) -x c -c -o /dev/null -m$(1) - || echo y) 
+$(foreach flavor,$(SIMD) $(FMA),$(eval $(call simd-check-cc,$(flavor))))
+ifeq ($(TARGET-y),)
+$(warning Test harness not built, use newer compiler than "$(CC)")
+all: $(TARGET-y)
 # For AVX and later, have the compiler avoid XMM0 to widen coverage of
 # the VEX.vvvv checks in the emulator.  For 3DNow!, however, force SSE
 # use for floating point operations, to avoid mixing MMX and FPU register

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.