[xen staging] x86emul: suppress default test harness build with incapable compiler

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen staging] x86emul: suppress default test harness build with incapable compiler

patchbot
commit 05f4cc2192359994f8eee5371b427279fef34ccb
Author:     Jan Beulich <[hidden email]>
AuthorDate: Thu Nov 22 14:31:06 2018 +0100
Commit:     Jan Beulich <[hidden email]>
CommitDate: Thu Nov 22 14:31:06 2018 +0100

    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 <[hidden email]>
    Acked-by: Wei Liu <[hidden email]>
---
 tools/tests/x86_emulator/Makefile | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 84e3484a8d..e816e00dfd 100644
--- 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)
+all:
 
 .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.
+TARGET-y := $(TARGET)
+
+define simd-check-cc
+TARGET-$(shell echo 'int i;' | $(CC) -x c -c -o /dev/null -m$(1) - || echo y) :=
+endef
+
+$(foreach flavor,$(SIMD) $(FMA),$(eval $(call simd-check-cc,$(flavor))))
+
+ifeq ($(TARGET-y),)
+$(warning Test harness not built, use newer compiler than "$(CC)")
+endif
+
+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
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog