Skip to contentSkip to conversation

tools: remove local links to the x86 headers

PATCH Superseded Roger Pau Monne 4 participants 6 messages Jul 12, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: remove local links to the x86 headers

In the x86 test harness and the fuzzer, and instead create a link in the tools/include directory that can be used by all the tools.

No functional change.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/fuzz/x86_instruction_emulator/Makefile | 10 ++--------
 tools/include/Makefile                       |  3 +++
 tools/tests/x86_emulator/Makefile            | 10 ++--------
 tools/tests/x86_emulator/x86-emulate.h       |  6 +++---
 4 files changed, 10 insertions(+), 19 deletions(-)
tools/fuzz/x86_instruction_emulator/Makefile +2 -8
index fbbb70bbfc..e76743de24 100644
@@ -13,11 +13,6 @@ x86_emulate:
 
 x86_emulate/%: x86_emulate ;
 
-asm:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
-
-asm/%: asm ;
-
 x86-emulate.c x86-emulate.h wrappers.c: %:
 	[ -L $* ] || ln -sf $(XEN_ROOT)/tools/tests/x86_emulator/$*
 
@@ -27,8 +22,7 @@ GCOV_FLAGS := --coverage
 %-cov.o: %.c
 	$(CC) -c $(CFLAGS) $(GCOV_FLAGS) $< -o $@
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h
 
 # x86-emulate.c will be implicit for both
 x86-emulate.o x86-emulate-cov.o: x86_emulate/x86_emulate.c $(x86_emulate.h)
@@ -50,7 +44,7 @@ all: x86-insn-fuzz-all
 
 .PHONY: distclean
 distclean: clean
-	rm -f x86_emulate x86-emulate.c x86-emulate.h asm
+	rm -f x86_emulate x86-emulate.c x86-emulate.h
 
 .PHONY: clean
 clean:
tools/include/Makefile +3 -0
index 666510530e..270a34f318 100644
@@ -21,6 +21,9 @@ xen/.dir:
 	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
 	ln -s ../xen-foreign xen/foreign
 	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+ifeq ($(CONFIG_X86),y)
+	ln -sf $(XEN_ROOT)/xen/include/asm-x86 xen/asm
+endif
 	touch $@
 
 # Not xen/xsm as that clashes with link to
tools/tests/x86_emulator/Makefile +2 -8
index 417d5c0941..10031b74d1 100644
@@ -118,7 +118,7 @@ $(TARGET): x86-emulate.o test_x86_emulator.o wrappers.o
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate asm
+	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate
 
 .PHONY: distclean
 distclean: clean
@@ -131,17 +131,11 @@ x86_emulate:
 
 x86_emulate/%: x86_emulate ;
 
-asm:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
-
-asm/%: asm ;
-
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h
 
 x86-emulate.o test_x86_emulator.o wrappers.o: %.o: %.c $(x86_emulate.h)
 	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
tools/tests/x86_emulator/x86-emulate.h +3 -3
index fd1ba5218b..b249e4673c 100644
@@ -11,9 +11,9 @@
 
 #include <xen/xen.h>
 
-#include <asm/msr-index.h>
-#include <asm/x86-defns.h>
-#include <asm/x86-vendors.h>
+#include <xen/asm/msr-index.h>
+#include <xen/asm/x86-defns.h>
+#include <xen/asm/x86-vendors.h>
 
 #include <xen-tools/libs.h>
 
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#2 lore raw
In reply to Roger Pau Monne
Quoted 6 lines · Roger Pau Monne

In the x86 test harness and the fuzzer, and instead create a link in the tools/include directory that can be used by all the tools.

No functional change.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Roger Pau Monne

tools/include/Makefile xen/.dir: · line 26

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 12:40, <[email protected]> wrote:
tools/include/Makefile +3 -0
@@ -21,6 +21,9 @@ xen/.dir:
 	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
 	ln -s ../xen-foreign xen/foreign
 	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+ifeq ($(CONFIG_X86),y)
+	ln -sf $(XEN_ROOT)/xen/include/asm-x86 xen/asm
+endif

Don't you need a .gitignore adjustment for this?

Quoted 18 lines
tools/tests/x86_emulator/Makefile +0 -1
@@ -118,7 +118,7 @@ $(TARGET): x86-emulate.o test_x86_emulator.o wrappers.o
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate 

asm

tools/tests/x86_emulator/Makefile +1 -2
+	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate
 
 .PHONY: distclean
 distclean: clean
@@ -131,17 +131,11 @@ x86_emulate:
 
 x86_emulate/%: x86_emulate ;
 
-asm:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@

tools/tests/x86_emulator/Makefile x86_emulate: · line 138

Quoted 10 lines
tools/tests/x86_emulator/Makefile +1 -5
-
-asm/%: asm ;
-
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h

While removing this dependency in the fuzzer case looks to be fine, it clearly isn't here: No .*.d get generated, so a change to any of those files would now no longer trigger a re-build.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
Quoted 12 lines · Jan Beulich

tools/include/Makefile xen/.dir: · line 26

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 12:40, <[email protected]> wrote:
tools/include/Makefile +3 -0
@@ -21,6 +21,9 @@ xen/.dir:
 	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
 	ln -s ../xen-foreign xen/foreign
 	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+ifeq ($(CONFIG_X86),y)
+	ln -sf $(XEN_ROOT)/xen/include/asm-x86 xen/asm
+endif

Don't you need a .gitignore adjustment for this?

There's already a tools/include/xen/* that covers it.

Quoted 25 lines
Quoted 25 lines
tools/tests/x86_emulator/Makefile +0 -1
@@ -118,7 +118,7 @@ $(TARGET): x86-emulate.o test_x86_emulator.o wrappers.o
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate 

asm

tools/tests/x86_emulator/Makefile +1 -5
+	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate
 
 .PHONY: distclean
 distclean: clean
@@ -131,17 +131,11 @@ x86_emulate:
 
 x86_emulate/%: x86_emulate ;
 
-asm:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
-
-asm/%: asm ;
-
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
Quoted 7 lines

tools/tests/x86_emulator/Makefile x86_emulate: · line 138

Quoted 3 lines
tools/tests/x86_emulator/Makefile +1 -2
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h

While removing this dependency in the fuzzer case looks to be fine, it clearly isn't here: No .*.d get generated, so a change to any of those files would now no longer trigger a re-build.

Oh, right. I've changed it to:

x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
                     x86-vendors.h x86-defns.h msr-index.h)

x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)

AFAICT this works fine and detects changes in the files.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 17:20, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich

tools/include/Makefile xen/.dir: · line 21

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 12.07.18 at 12:40, <[email protected]> wrote:
tools/include/Makefile +0 -0
@@ -21,6 +21,9 @@ xen/.dir:
 	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) 

xen/libelf/

Quoted 7 lines

tools/include/Makefile xen/.dir: · line 26

Quoted 5 lines
tools/include/Makefile +3 -0
 	ln -s ../xen-foreign xen/foreign
 	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+ifeq ($(CONFIG_X86),y)
+	ln -sf $(XEN_ROOT)/xen/include/asm-x86 xen/asm
+endif

Don't you need a .gitignore adjustment for this?

Quoted 1 line

There's already a tools/include/xen/* that covers it.

Ah, good.

Quoted 33 lines
Quoted 25 lines
Quoted 25 lines
tools/tests/x86_emulator/Makefile +0 -1
@@ -118,7 +118,7 @@ $(TARGET): x86-emulate.o test_x86_emulator.o wrappers.o
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate 

asm

tools/tests/x86_emulator/Makefile +1 -5
+	rm -rf $(TARGET) *.o *~ core $(addsuffix .h,$(TESTCASES)) *.bin x86_emulate
 
 .PHONY: distclean
 distclean: clean
@@ -131,17 +131,11 @@ x86_emulate:
 
 x86_emulate/%: x86_emulate ;
 
-asm:
-	[ -L $@ ] || ln -sf $(XEN_ROOT)/xen/include/asm-x86 $@
-
-asm/%: asm ;
-
 HOSTCFLAGS-x86_64 := -fno-PIE
 $(call cc-option-add,HOSTCFLAGS-x86_64,HOSTCC,-no-pie)
 HOSTCFLAGS += $(CFLAGS_xeninclude) -I. $(HOSTCFLAGS-$(XEN_COMPILE_ARCH))
 
Quoted 7 lines

tools/tests/x86_emulator/Makefile x86_emulate: · line 138

Quoted 3 lines
tools/tests/x86_emulator/Makefile +1 -2
-x86.h := asm/x86-vendors.h asm/x86-defns.h asm/msr-index.h
-x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)
+x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h

While removing this dependency in the fuzzer case looks to be fine, it clearly isn't here: No .*.d get generated, so a change to any of those files would now no longer trigger a re-build.

Quoted 7 lines

Oh, right. I've changed it to:

x86.h := $(addprefix $(XEN_ROOT)/tools/include/xen/asm/,\
                     x86-vendors.h x86-defns.h msr-index.h)

x86_emulate.h := x86-emulate.h x86_emulate/x86_emulate.h $(x86.h)

AFAICT this works fine and detects changes in the files.

Looks okay, thanks.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel