All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] x86emul: fix test harness and fuzzer build dependencies
Date: Fri, 14 Dec 2018 01:49:22 -0700	[thread overview]
Message-ID: <5C136E9202000078002060C0@prv1-mh.provo.novell.com> (raw)

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.
Putting the make invocation to produce the header together with the
directory tree creation therefore does not work. Introduce a separate
goal.

Furthermore 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 recursivley invoke make to re-
build the generated header if needed.

Finally cpuid.o did not have any dependencies added for it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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,9 @@ 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 $@
 
+$(XEN_ROOT)/tools/include/xen/lib/x86/cpuid-autogen.h: FORCE
+	$(MAKE) -C $(XEN_ROOT)/tools/include build
+
 # Common targets
 .PHONY: all
 all: x86-insn-fuzz-all
@@ -60,6 +65,9 @@ install: all
 
 .PHONY: uninstall
 
+.PHONY: FORCE
+FORCE:
+
 .PHONY: afl
 afl: afl-harness
 
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -4,8 +4,9 @@ include $(XEN_ROOT)/tools/Rules.mk
 # Relative to $(XEN_ROOT)/xen/xsm/flask
 FLASK_H_DEPEND := policy/initial_sids
 
-.PHONY: all build
-all build: xen-foreign xen/.dir xen-xsm/.dir
+.PHONY: all all-y build
+all build: all-y xen-foreign xen/.dir xen-xsm/.dir
+all-y:
 
 .PHONY: xen-foreign
 xen-foreign:
@@ -27,10 +28,12 @@ ifeq ($(CONFIG_X86),y)
 	for f in $(filter-out %autogen.h,$(patsubst $(XEN_ROOT)/xen/include/xen/lib/x86/%,%,Makefile $(wildcard $(XEN_ROOT)/xen/include/xen/lib/x86/*.h))); do \
 		ln -sf $(XEN_ROOT)/xen/include/xen/lib/x86/$$f xen/lib/x86/$$f; \
 	done
-	$(MAKE) -C xen/lib/x86 all XEN_ROOT=$(XEN_ROOT)
 endif
 	touch $@
 
+all-$(CONFIG_X86): xen/.dir
+	$(MAKE) -C xen/lib/x86 all XEN_ROOT=$(XEN_ROOT)
+
 # Not xen/xsm as that clashes with link to
 # $(XEN_ROOT)/xen/include/public/xsm above.
 xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
--- 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,18 @@ $(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))
+
+$(XEN_ROOT)/tools/include/xen/lib/x86/cpuid-autogen.h: FORCE
+	$(MAKE) -C $(XEN_ROOT)/tools/include build




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2018-12-14  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  8:49 Jan Beulich [this message]
2018-12-17 15:57 ` [PATCH] x86emul: fix test harness and fuzzer build dependencies Andrew Cooper
2018-12-20 14:46 ` Ian Jackson
2018-12-20 14:56   ` Jan Beulich
2018-12-20 15:23     ` Ian Jackson
2018-12-20 16:05       ` Jan Beulich
2018-12-21  7:39         ` Jan Beulich
2018-12-21 14:16           ` Ian Jackson
2019-01-04  9:32             ` Jan Beulich
2019-01-14 15:09               ` Ian Jackson
2019-01-14 15:44                 ` Jan Beulich
2019-01-14 16:59                   ` Ian Jackson
2019-01-15  8:29                     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C136E9202000078002060C0@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.