[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2.1 2/2] x86emul: fix test harness and fuzzer build dependencies
Commit fd35f32b4b ("tools/x86emul: Use struct cpuid_policy in the userspace test harnesses") didn't account for the dependencies of cpuid-autogen.h to potentially change between incremental builds. In particular the harness has a "run" goal which is supposed to be usable independently of the rest of the tools sub-tree building, and both the harness and the fuzzer code are also supposed to be buildable independently. Therefore they need to recursively invoke make to re- build the generated header if needed, but only when these rules did not get invoked recursively themselves. Finally cpuid.o did not have any dependencies added for it. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- v2.1: Split controversial parts from (hopefully) non-controversial ones. v2: Guard $(MAKE) invocations by $(MAKELEVEL) checks. --- a/tools/fuzz/x86_instruction_emulator/Makefile +++ b/tools/fuzz/x86_instruction_emulator/Makefile @@ -26,13 +26,15 @@ GCOV_FLAGS := --coverage $(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@ x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\ - x86-vendors.h x86-defns.h msr-index.h) + x86-vendors.h x86-defns.h msr-index.h) \ + $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \ + cpuid.h cpuid-autogen.h) x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h) # x86-emulate.c will be implicit for both x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h) -fuzz-emul.o fuzz-emulate-cov.o wrappers.o: $(x86_emulate.h) +fuzz-emul.o fuzz-emulate-cov.o cpuid.o wrappers.o: $(x86_emulate.h) x86-insn-fuzzer.a: fuzz-emul.o x86-emulate.o cpuid.o $(AR) rc $@ $^ @@ -43,6 +45,11 @@ afl-harness: afl-harness.o fuzz-emul.o x afl-harness-cov: afl-harness-cov.o fuzz-emul-cov.o x86-emulate-cov.o cpuid.o wrappers.o $(CC) $(CFLAGS) $(GCOV_FLAGS) $^ -o $@ +ifeq ($(MAKELEVEL),0) +$(XEN_ROOT)/tools/include/xen/lib/x86/cpuid-autogen.h: FORCE + $(MAKE) -C $(XEN_ROOT)/tools/include build +endif + # Common targets .PHONY: all all: x86-insn-fuzz-all @@ -60,6 +67,9 @@ install: all .PHONY: uninstall +.PHONY: FORCE +FORCE: + .PHONY: afl afl: afl-harness --- a/tools/tests/x86_emulator/Makefile +++ b/tools/tests/x86_emulator/Makefile @@ -11,6 +11,9 @@ all: run: $(TARGET) ./$(TARGET) +.PHONY: FORCE +FORCE: + # Add libx86 to the build vpath %.c $(XEN_ROOT)/xen/lib/x86 @@ -208,13 +211,20 @@ $(call cc-option-add,HOSTCFLAGS-x86_64,H HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH)) x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\ - x86-vendors.h x86-defns.h msr-index.h) + x86-vendors.h x86-defns.h msr-index.h) \ + $(addprefix $(XEN_ROOT)/tools/include/xen/lib/x86/, \ + cpuid.h cpuid-autogen.h) x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h) -x86-emulate.o test_x86_emulator.o evex-disp8.o wrappers.o: %.o: %.c $(x86_emulate.h) +x86-emulate.o cpuid.o test_x86_emulator.o evex-disp8.o wrappers.o: %.o: %.c $(x86_emulate.h) $(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $< x86-emulate.o: x86_emulate/x86_emulate.c x86-emulate.o: HOSTCFLAGS += -D__XEN_TOOLS__ test_x86_emulator.o: $(addsuffix .h,$(TESTCASES)) $(addsuffix -opmask.h,$(OPMASK)) + +ifeq ($(MAKELEVEL),0) +$(XEN_ROOT)/tools/include/xen/lib/x86/cpuid-autogen.h: FORCE + $(MAKE) -C $(XEN_ROOT)/tools/include build +endif _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |