Skip to contentSkip to conversation

objtool: sync cleanups

PATCH In review Josh Poimboeuf 3 participants 10 messages Nov 6, 2017 – Nov 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover objtool: sync cleanups

Here are some cleanups to improve future warnings about copied files getting out of sync.

Josh Poimboeuf (2):
objtool: Move synced files to their original relative locations
objtool: Move sync check to a script

 tools/objtool/.gitignore                           |  2 +-
 tools/objtool/Makefile                             | 22 ++++------------
 tools/objtool/arch/x86/Build                       | 10 ++++----
 tools/objtool/arch/x86/decode.c                    |  6 ++---
 .../objtool/arch/x86/{insn => include/asm}/inat.h  |  2 +-
 .../arch/x86/{insn => include/asm}/inat_types.h    |  0
 .../objtool/arch/x86/{insn => include/asm}/insn.h  |  2 +-
 .../objtool/{ => arch/x86/include/asm}/orc_types.h |  0
 tools/objtool/arch/x86/{insn => lib}/inat.c        |  2 +-
 tools/objtool/arch/x86/{insn => lib}/insn.c        |  4 +--
 .../arch/x86/{insn => lib}/x86-opcode-map.txt      |  0
 .../arch/x86/{insn => tools}/gen-insn-attr-x86.awk |  0
 tools/objtool/orc.h                                |  2 +-
 tools/objtool/sync-check.sh                        | 29 ++++++++++++++++++++++
 14 files changed, 49 insertions(+), 32 deletions(-)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat.h (99%)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat_types.h (100%)
 rename tools/objtool/arch/x86/{insn => include/asm}/insn.h (99%)
 rename tools/objtool/{ => arch/x86/include/asm}/orc_types.h (100%)
 rename tools/objtool/arch/x86/{insn => lib}/inat.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/insn.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/x86-opcode-map.txt (100%)
 rename tools/objtool/arch/x86/{insn => tools}/gen-insn-attr-x86.awk (100%)
 create mode 100755 tools/objtool/sync-check.sh
Signature · 1 line
2.13.6
#1 lore raw

PATCH v2 1/2 objtool: Move synced files to their original relative locations

This will enable more straightforward comparisons, and it also makes the files 100% identical.

---
 tools/objtool/.gitignore                           |  2 +-
 tools/objtool/Makefile                             | 22 ++++++++++++----------
 tools/objtool/arch/x86/Build                       | 10 +++++-----
 tools/objtool/arch/x86/decode.c                    |  6 +++---
 .../objtool/arch/x86/{insn => include/asm}/inat.h  |  2 +-
 .../arch/x86/{insn => include/asm}/inat_types.h    |  0
 .../objtool/arch/x86/{insn => include/asm}/insn.h  |  2 +-
 .../objtool/{ => arch/x86/include/asm}/orc_types.h |  0
 tools/objtool/arch/x86/{insn => lib}/inat.c        |  2 +-
 tools/objtool/arch/x86/{insn => lib}/insn.c        |  4 ++--
 .../arch/x86/{insn => lib}/x86-opcode-map.txt      |  0
 .../arch/x86/{insn => tools}/gen-insn-attr-x86.awk |  0
 tools/objtool/orc.h                                |  2 +-
 13 files changed, 27 insertions(+), 25 deletions(-)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat.h (99%)
 rename tools/objtool/arch/x86/{insn => include/asm}/inat_types.h (100%)
 rename tools/objtool/arch/x86/{insn => include/asm}/insn.h (99%)
 rename tools/objtool/{ => arch/x86/include/asm}/orc_types.h (100%)
 rename tools/objtool/arch/x86/{insn => lib}/inat.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/insn.c (99%)
 rename tools/objtool/arch/x86/{insn => lib}/x86-opcode-map.txt (100%)
 rename tools/objtool/arch/x86/{insn => tools}/gen-insn-attr-x86.awk (100%)
tools/objtool/.gitignore +1 -1
index d3102c865a95..914cff12899b 100644
@@ -1,3 +1,3 @@
-arch/x86/insn/inat-tables.c
+arch/x86/lib/inat-tables.c
 objtool
 fixdep
tools/objtool/Makefile +12 -10
index 424b1965d06f..c6a19d946ec1 100644
@@ -25,7 +25,9 @@ OBJTOOL_IN := $(OBJTOOL)-in.o
 
 all: $(OBJTOOL)
 
-INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi
+INCLUDES := -I$(srctree)/tools/include \
+	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
+	    -I$(srctree)/tools/objtool/arch/$(HOSTARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
 CFLAGS   += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
 LDFLAGS  += -lelf $(LIBSUBCMD)
@@ -46,16 +48,16 @@ $(OBJTOOL_IN): fixdep FORCE
 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
 	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
 	test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff -I'^#include' arch/x86/insn/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
-	diff arch/x86/insn/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
-	diff arch/x86/insn/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
-	diff -I'^#include' arch/x86/insn/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
+	diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
+	diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
+	diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
+	diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
+	diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
+	diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
+	diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
 	|| echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
 	@(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff ../../arch/x86/include/asm/orc_types.h orc_types.h >/dev/null) \
+	diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
 	|| echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
 	$(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
 
@@ -66,7 +68,7 @@ $(LIBSUBCMD): fixdep FORCE
 clean:
 	$(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
 	$(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
-	$(Q)$(RM) $(OUTPUT)arch/x86/insn/inat-tables.c $(OUTPUT)fixdep
+	$(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
 
 FORCE:
 
tools/objtool/arch/x86/Build +5 -5
index debbdb0b5c43..b998412c017d 100644
@@ -1,12 +1,12 @@
 objtool-y += decode.o
 
-inat_tables_script = arch/x86/insn/gen-insn-attr-x86.awk
-inat_tables_maps = arch/x86/insn/x86-opcode-map.txt
+inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = arch/x86/lib/x86-opcode-map.txt
 
-$(OUTPUT)arch/x86/insn/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
+$(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call rule_mkdir)
 	$(Q)$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
 
-$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/insn/inat-tables.c
+$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/lib/inat-tables.c
 
-CFLAGS_decode.o += -I$(OUTPUT)arch/x86/insn
+CFLAGS_decode.o += -I$(OUTPUT)arch/x86/lib
tools/objtool/arch/x86/decode.c +3 -3
index 34a579f806e3..8acfc47af70e 100644
@@ -19,9 +19,9 @@
 #include <stdlib.h>
 
 #define unlikely(cond) (cond)
-#include "insn/insn.h"
-#include "insn/inat.c"
-#include "insn/insn.c"
+#include <asm/insn.h>
+#include "lib/inat.c"
+#include "lib/insn.c"
 
 #include "../../elf.h"
 #include "../../arch.h"
tools/objtool/arch/x86/include/asm/inat.h renamed from tools/objtool/arch/x86/insn/inat.h +1 -1
similarity index 99%
rename from tools/objtool/arch/x86/insn/inat.h
rename to tools/objtool/arch/x86/include/asm/inat.h
index 125ecd2a300d..02aff0867211 100644
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
  */
-#include "inat_types.h"
+#include <asm/inat_types.h>
 
 /*
  * Internal bits. Don't use bitmasks directly, because these bits are
tools/objtool/arch/x86/include/asm/inat_types.h renamed from tools/objtool/arch/x86/insn/inat_types.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/inat_types.h
rename to tools/objtool/arch/x86/include/asm/inat_types.h
tools/objtool/arch/x86/include/asm/insn.h renamed from tools/objtool/arch/x86/insn/insn.h +1 -1
similarity index 99%
rename from tools/objtool/arch/x86/insn/insn.h
rename to tools/objtool/arch/x86/include/asm/insn.h
index e23578c7b1be..b3e32b010ab1 100644
@@ -21,7 +21,7 @@
  */
 
 /* insn_attr_t is defined in inat.h */
-#include "inat.h"
+#include <asm/inat.h>
 
 struct insn_field {
 	union {
tools/objtool/arch/x86/include/asm/orc_types.h renamed from tools/objtool/orc_types.h +0 -0
similarity index 100%
rename from tools/objtool/orc_types.h
rename to tools/objtool/arch/x86/include/asm/orc_types.h
tools/objtool/arch/x86/lib/inat.c renamed from tools/objtool/arch/x86/insn/inat.c +1 -1
similarity index 99%
rename from tools/objtool/arch/x86/insn/inat.c
rename to tools/objtool/arch/x86/lib/inat.c
index e4bf28e6f4c7..c1f01a8e9f65 100644
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
  */
-#include "insn.h"
+#include <asm/insn.h>
 
 /* Attribute tables are generated from opcode map */
 #include "inat-tables.c"
tools/objtool/arch/x86/lib/insn.c renamed from tools/objtool/arch/x86/insn/insn.c +2 -2
similarity index 99%
rename from tools/objtool/arch/x86/insn/insn.c
rename to tools/objtool/arch/x86/lib/insn.c
index ca983e2bea8b..1088eb8f3a5f 100644
@@ -23,8 +23,8 @@
 #else
 #include <string.h>
 #endif
-#include "inat.h"
-#include "insn.h"
+#include <asm/inat.h>
+#include <asm/insn.h>
 
 /* Verify next sizeof(t) bytes can be on the same instruction */
 #define validate_next(t, insn, n)	\
tools/objtool/arch/x86/lib/x86-opcode-map.txt renamed from tools/objtool/arch/x86/insn/x86-opcode-map.txt +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/x86-opcode-map.txt
rename to tools/objtool/arch/x86/lib/x86-opcode-map.txt
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk renamed from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
rename to tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
tools/objtool/orc.h +1 -1
index a4139e386ef3..b0e92a6d0903 100644
@@ -18,7 +18,7 @@
 #ifndef _ORC_H
 #define _ORC_H
 
-#include "orc_types.h"
+#include <asm/orc_types.h>
 
 struct objtool_file;
 
Signature · 1 line
2.13.6
#2 lore raw

[tip:core/objtool] objtool: Move synced files to their original relative locations

objtool: Move synced files to their original relative locations
Commit-ID:  6a77cff819ae3e31992bde6432c9b5720748a89b
Gitweb:     https://git.kernel.org/tip/6a77cff819ae3e31992bde6432c9b5720748a89b
Author:     Josh Poimboeuf <[email protected]>
AuthorDate: Mon, 6 Nov 2017 07:21:50 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 7 Nov 2017 10:48:23 +0100

objtool: Move synced files to their original relative locations

This will enable more straightforward comparisons, and it also makes the files 100% identical.

---
 tools/objtool/.gitignore                           |   2 +-
 tools/objtool/Makefile                             |  22 +-
 tools/objtool/arch/x86/Build                       |  10 +-
 tools/objtool/arch/x86/decode.c                    |   6 +-
 .../objtool/arch}/x86/include/asm/inat.h           |   0
 .../arch/x86/{insn => include/asm}/inat_types.h    |   0
 .../objtool/arch}/x86/include/asm/insn.h           |   0
 .../objtool/{ => arch/x86/include/asm}/orc_types.h |   0
 tools/objtool/arch/x86/insn/inat.c                 |  97 ----
 tools/objtool/arch/x86/insn/inat.h                 | 234 --------
 tools/objtool/arch/x86/insn/insn.c                 | 606 ---------------------
 tools/objtool/arch/x86/insn/insn.h                 | 211 -------
 {arch => tools/objtool/arch}/x86/lib/inat.c        |   0
 {arch => tools/objtool/arch}/x86/lib/insn.c        |   0
 .../arch/x86/{insn => lib}/x86-opcode-map.txt      |   0
 .../arch/x86/{insn => tools}/gen-insn-attr-x86.awk |   0
 tools/objtool/orc.h                                |   2 +-
 17 files changed, 22 insertions(+), 1168 deletions(-)
tools/objtool/.gitignore +1 -1
index d3102c8..914cff1 100644
@@ -1,3 +1,3 @@
-arch/x86/insn/inat-tables.c
+arch/x86/lib/inat-tables.c
 objtool
 fixdep
tools/objtool/Makefile +12 -10
index 424b196..c6a19d9 100644
@@ -25,7 +25,9 @@ OBJTOOL_IN := $(OBJTOOL)-in.o
 
 all: $(OBJTOOL)
 
-INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi
+INCLUDES := -I$(srctree)/tools/include \
+	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
+	    -I$(srctree)/tools/objtool/arch/$(HOSTARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
 CFLAGS   += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
 LDFLAGS  += -lelf $(LIBSUBCMD)
@@ -46,16 +48,16 @@ $(OBJTOOL_IN): fixdep FORCE
 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
 	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
 	test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff -I'^#include' arch/x86/insn/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
-	diff arch/x86/insn/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
-	diff arch/x86/insn/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
-	diff -I'^#include' arch/x86/insn/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
-	diff -I'^#include' arch/x86/insn/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
+	diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
+	diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
+	diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
+	diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
+	diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
+	diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
+	diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
 	|| echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
 	@(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff ../../arch/x86/include/asm/orc_types.h orc_types.h >/dev/null) \
+	diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
 	|| echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
 	$(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
 
@@ -66,7 +68,7 @@ $(LIBSUBCMD): fixdep FORCE
 clean:
 	$(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
 	$(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
-	$(Q)$(RM) $(OUTPUT)arch/x86/insn/inat-tables.c $(OUTPUT)fixdep
+	$(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
 
 FORCE:
 
tools/objtool/arch/x86/Build +5 -5
index debbdb0..b998412 100644
@@ -1,12 +1,12 @@
 objtool-y += decode.o
 
-inat_tables_script = arch/x86/insn/gen-insn-attr-x86.awk
-inat_tables_maps = arch/x86/insn/x86-opcode-map.txt
+inat_tables_script = arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = arch/x86/lib/x86-opcode-map.txt
 
-$(OUTPUT)arch/x86/insn/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
+$(OUTPUT)arch/x86/lib/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call rule_mkdir)
 	$(Q)$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
 
-$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/insn/inat-tables.c
+$(OUTPUT)arch/x86/decode.o: $(OUTPUT)arch/x86/lib/inat-tables.c
 
-CFLAGS_decode.o += -I$(OUTPUT)arch/x86/insn
+CFLAGS_decode.o += -I$(OUTPUT)arch/x86/lib
tools/objtool/arch/x86/decode.c +3 -3
index 34a579f..8acfc47 100644
@@ -19,9 +19,9 @@
 #include <stdlib.h>
 
 #define unlikely(cond) (cond)
-#include "insn/insn.h"
-#include "insn/inat.c"
-#include "insn/insn.c"
+#include <asm/insn.h>
+#include "lib/inat.c"
+#include "lib/insn.c"
 
 #include "../../elf.h"
 #include "../../arch.h"
tools/objtool/arch/x86/include/asm/inat.h renamed from arch/x86/include/asm/inat.h +0 -0
similarity index 100%
copy from arch/x86/include/asm/inat.h
copy to tools/objtool/arch/x86/include/asm/inat.h
tools/objtool/arch/x86/include/asm/inat_types.h renamed from tools/objtool/arch/x86/insn/inat_types.h +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/inat_types.h
rename to tools/objtool/arch/x86/include/asm/inat_types.h
tools/objtool/arch/x86/include/asm/insn.h renamed from arch/x86/include/asm/insn.h +0 -0
similarity index 100%
copy from arch/x86/include/asm/insn.h
copy to tools/objtool/arch/x86/include/asm/insn.h
tools/objtool/arch/x86/include/asm/orc_types.h renamed from tools/objtool/orc_types.h +0 -0
similarity index 100%
rename from tools/objtool/orc_types.h
rename to tools/objtool/arch/x86/include/asm/orc_types.h
tools/objtool/arch/x86/insn/inat.c deleted +0 -97

97 lines not on this page · raw message

tools/objtool/arch/x86/insn/inat.h deleted +0 -234

234 lines not on this page · raw message

tools/objtool/arch/x86/insn/insn.c deleted +0 -606

606 lines not on this page · raw message

tools/objtool/arch/x86/insn/insn.h deleted +0 -211

211 lines not on this page · raw message

tools/objtool/arch/x86/lib/inat.c renamed from arch/x86/lib/inat.c +0 -0
similarity index 100%
copy from arch/x86/lib/inat.c
copy to tools/objtool/arch/x86/lib/inat.c
tools/objtool/arch/x86/lib/insn.c renamed from arch/x86/lib/insn.c +0 -0
similarity index 100%
copy from arch/x86/lib/insn.c
copy to tools/objtool/arch/x86/lib/insn.c
tools/objtool/arch/x86/lib/x86-opcode-map.txt renamed from tools/objtool/arch/x86/insn/x86-opcode-map.txt +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/x86-opcode-map.txt
rename to tools/objtool/arch/x86/lib/x86-opcode-map.txt
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk renamed from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk +0 -0
similarity index 100%
rename from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk
rename to tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk
tools/objtool/orc.h +1 -1
index a4139e3..b0e92a6 100644
@@ -18,7 +18,7 @@
 #ifndef _ORC_H
 #define _ORC_H
 
-#include "orc_types.h"
+#include <asm/orc_types.h>
 
 struct objtool_file;
 
#3 lore raw

PATCH v2 2/2 objtool: Move sync check to a script

In reply to Josh Poimboeuf

Replace the nasty diff checks in the objtool Makefile with a clean bash script, and make the warnings more specific.

Heavily inspired by tools/perf/check-headers.sh.

---
 tools/objtool/Makefile      | 16 +---------------
 tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 15 deletions(-)
 create mode 100755 tools/objtool/sync-check.sh
tools/objtool/Makefile +1 -15
index c6a19d946ec1..6aaed251b4ed 100644
@@ -43,22 +43,8 @@ include $(srctree)/tools/build/Makefile.include
 $(OBJTOOL_IN): fixdep FORCE
 	@$(MAKE) $(build)=objtool
 
-# Busybox's diff doesn't have -I, avoid warning in that case
-#
 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
-	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
-	test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
-	diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
-	diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
-	diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
-	diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
-	diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
-	diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
-	|| echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
-	@(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
-	|| echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
+	@./sync-check.sh
 	$(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
 
 
tools/objtool/sync-check.sh new file +29 -0
new file mode 100755
index 000000000000..f2e5f8b0460c
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+FILES='
+arch/x86/lib/insn.c
+arch/x86/lib/inat.c
+arch/x86/lib/x86-opcode-map.txt
+arch/x86/tools/gen-insn-attr-x86.awk
+arch/x86/include/asm/insn.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/include/asm/orc_types.h
+'
+
+check()
+{
+	local file=$1
+
+	diff $file ../../$file &> /dev/null ||
+		echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
+}
+
+if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
+	exit 0
+fi
+
+for i in $FILES; do
+  check $i
+done
Signature · 1 line
2.13.6
#4 lore raw

Re: [PATCH v2 2/2] objtool: Move sync check to a script

Quoted 66 lines · Josh Poimboeuf

Replace the nasty diff checks in the objtool Makefile with a clean bash script, and make the warnings more specific.

Heavily inspired by tools/perf/check-headers.sh.

---
 tools/objtool/Makefile      | 16 +---------------
 tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 15 deletions(-)
 create mode 100755 tools/objtool/sync-check.sh
tools/objtool/Makefile +1 -15
index c6a19d946ec1..6aaed251b4ed 100644
@@ -43,22 +43,8 @@ include $(srctree)/tools/build/Makefile.include
 $(OBJTOOL_IN): fixdep FORCE
 	@$(MAKE) $(build)=objtool
 
-# Busybox's diff doesn't have -I, avoid warning in that case
-#
 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
-	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
-	test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
-	diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
-	diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
-	diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
-	diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
-	diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
-	diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
-	|| echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
-	@(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
-	|| echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
+	@./sync-check.sh
 	$(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
 
 
tools/objtool/sync-check.sh new file +19 -0
new file mode 100755
index 000000000000..f2e5f8b0460c
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+FILES='
+arch/x86/lib/insn.c
+arch/x86/lib/inat.c
+arch/x86/lib/x86-opcode-map.txt
+arch/x86/tools/gen-insn-attr-x86.awk
+arch/x86/include/asm/insn.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/include/asm/orc_types.h
+'
+
+check()
+{
+	local file=$1
+
+	diff $file ../../$file &> /dev/null ||

tools/objtool/sync-check.sh line 29

Quoted 10 lines
tools/objtool/sync-check.sh new file +10 -0
+		echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
+}
+
+if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
+	exit 0
+fi
+
+for i in $FILES; do
+  check $i
+done

Hm, this doesn't actually warn - it outputs the diff:

triton:~/tip/tools/objtool> ./sync-check.sh
triton:~/tip/tools/objtool> 99a100,109

Quoted 10 lines

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE 0
#define INAT_SEG_REG_DEFAULT 1

#define INAT_SEG_REG_CS               2
#define INAT_SEG_REG_SS               3
#define INAT_SEG_REG_DS               4
#define INAT_SEG_REG_ES               5
#define INAT_SEG_REG_FS               6
#define INAT_SEG_REG_GS               7

I fixed it to do:

        diff $file ../../$file > /dev/null ||

(note the removal of '&')

Then it outputs the right thing:

triton:~/tip/tools/objtool> ./sync-check.sh
Warning: synced file at 'tools/objtool/arch/x86/include/asm/inat.h' differs from latest kernel version at 'arch/x86/include/asm/inat.h'

Thanks,

Ingo

#5 lore raw

Re: [PATCH v2 2/2] objtool: Move sync check to a script

Quoted 17 lines · Ingo Molnar

Hm, this doesn't actually warn - it outputs the diff:

triton:~/tip/tools/objtool> ./sync-check.sh
triton:~/tip/tools/objtool> 99a100,109

Quoted 10 lines

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE 0
#define INAT_SEG_REG_DEFAULT 1

#define INAT_SEG_REG_CS               2
#define INAT_SEG_REG_SS               3
#define INAT_SEG_REG_DS               4
#define INAT_SEG_REG_ES               5
#define INAT_SEG_REG_FS               6
#define INAT_SEG_REG_GS               7

I fixed it to do:

Quoted 8 lines
        diff $file ../../$file > /dev/null ||

(note the removal of '&')

Then it outputs the right thing:

triton:~/tip/tools/objtool> ./sync-check.sh
Warning: synced file at 'tools/objtool/arch/x86/include/asm/inat.h' differs from latest kernel version at 'arch/x86/include/asm/inat.h'

Ah. I guess '&>' is a bash-ism, shorthand for redirecting both stdout and stderr. It worked for me with bash 4.4.12. I guess you used a different default shell?

Signature · 1 line
Josh
#6 lore raw

Re: [PATCH v2 2/2] objtool: Move sync check to a script

Quoted 22 lines · Josh Poimboeuf
Quoted 21 lines · Ingo Molnar

Hm, this doesn't actually warn - it outputs the diff:

triton:~/tip/tools/objtool> ./sync-check.sh
triton:~/tip/tools/objtool> 99a100,109

Quoted 10 lines

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE 0
#define INAT_SEG_REG_DEFAULT 1

#define INAT_SEG_REG_CS               2
#define INAT_SEG_REG_SS               3
#define INAT_SEG_REG_DS               4
#define INAT_SEG_REG_ES               5
#define INAT_SEG_REG_FS               6
#define INAT_SEG_REG_GS               7

I fixed it to do:

        diff $file ../../$file > /dev/null ||

(note the removal of '&')

Quoted 8 lines
Quoted 4 lines

Then it outputs the right thing:

triton:~/tip/tools/objtool> ./sync-check.sh
Warning: synced file at 'tools/objtool/arch/x86/include/asm/inat.h' differs from latest kernel version at 'arch/x86/include/asm/inat.h'

Ah. I guess '&>' is a bash-ism, shorthand for redirecting both stdout and stderr. It worked for me with bash 4.4.12. I guess you used a different default shell?

No, I use bash too, but note that the script uses SH:

#!/bin/sh

Thanks,

Ingo

#7 lore raw

Re: [PATCH v2 2/2] objtool: Move sync check to a script

Quoted 30 lines · Ingo Molnar
Quoted 27 lines · Josh Poimboeuf
Quoted 25 lines · Ingo Molnar

Hm, this doesn't actually warn - it outputs the diff:

triton:~/tip/tools/objtool> ./sync-check.sh
triton:~/tip/tools/objtool> 99a100,109

Quoted 10 lines

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE 0
#define INAT_SEG_REG_DEFAULT 1

#define INAT_SEG_REG_CS               2
#define INAT_SEG_REG_SS               3
#define INAT_SEG_REG_DS               4
#define INAT_SEG_REG_ES               5
#define INAT_SEG_REG_FS               6
#define INAT_SEG_REG_GS               7

I fixed it to do:

        diff $file ../../$file > /dev/null ||

(note the removal of '&')

Then it outputs the right thing:

triton:~/tip/tools/objtool> ./sync-check.sh
Warning: synced file at 'tools/objtool/arch/x86/include/asm/inat.h' differs from latest kernel version at 'arch/x86/include/asm/inat.h'

Quoted 7 lines
Quoted 3 lines

Ah. I guess '&>' is a bash-ism, shorthand for redirecting both stdout and stderr. It worked for me with bash 4.4.12. I guess you used a different default shell?

No, I use bash too, but note that the script uses SH:

#!/bin/sh

I guess your /bin/sh is different than mine :-)

  $ ls -l /bin/sh
  lrwxrwxrwx. 1 root root 4 Aug  8 06:03 /bin/sh -> bash
Signature · 1 line
Josh
#8 lore raw

Re: [PATCH v2 2/2] objtool: Move sync check to a script

Quoted 35 lines · Josh Poimboeuf
Quoted 34 lines · Ingo Molnar
Quoted 30 lines · Josh Poimboeuf
Quoted 17 lines · Ingo Molnar

Hm, this doesn't actually warn - it outputs the diff:

triton:~/tip/tools/objtool> ./sync-check.sh
triton:~/tip/tools/objtool> 99a100,109

Quoted 10 lines

/* Identifiers for segment registers */
#define INAT_SEG_REG_IGNORE 0
#define INAT_SEG_REG_DEFAULT 1

#define INAT_SEG_REG_CS               2
#define INAT_SEG_REG_SS               3
#define INAT_SEG_REG_DS               4
#define INAT_SEG_REG_ES               5
#define INAT_SEG_REG_FS               6
#define INAT_SEG_REG_GS               7

I fixed it to do:

Quoted 8 lines
        diff $file ../../$file > /dev/null ||

(note the removal of '&')

Then it outputs the right thing:

triton:~/tip/tools/objtool> ./sync-check.sh
Warning: synced file at 'tools/objtool/arch/x86/include/asm/inat.h' differs from latest kernel version at 'arch/x86/include/asm/inat.h'

Ah. I guess '&>' is a bash-ism, shorthand for redirecting both stdout and stderr. It worked for me with bash 4.4.12. I guess you used a different default shell?

Quoted 8 lines
Quoted 3 lines

No, I use bash too, but note that the script uses SH:

#!/bin/sh

I guess your /bin/sh is different than mine :-)

  $ ls -l /bin/sh
  lrwxrwxrwx. 1 root root 4 Aug  8 06:03 /bin/sh -> bash

Yeah:

triton:~/tip> ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jul 28 2016 /bin/sh -> dash

Mystery solved! :-)

Thanks,

Ingo

#9 lore raw

[tip:core/objtool] objtool: Move kernel headers/code sync check to a script

In reply to Josh Poimboeuf
objtool: Move kernel headers/code sync check to a script
Commit-ID:  3bd51c5a371de917e4e7401c9df006b5998579df
Gitweb:     https://git.kernel.org/tip/3bd51c5a371de917e4e7401c9df006b5998579df
Author:     Josh Poimboeuf <[email protected]>
AuthorDate: Mon, 6 Nov 2017 07:21:51 -0600
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 7 Nov 2017 10:48:34 +0100

objtool: Move kernel headers/code sync check to a script

Replace the nasty diff checks in the objtool Makefile with a clean bash script, and make the warnings more specific.

Heavily inspired by tools/perf/check-headers.sh.

---
 tools/objtool/Makefile      | 16 +---------------
 tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 15 deletions(-)
tools/objtool/Makefile +1 -15
index c6a19d9..6aaed25 100644
@@ -43,22 +43,8 @@ include $(srctree)/tools/build/Makefile.include
 $(OBJTOOL_IN): fixdep FORCE
 	@$(MAKE) $(build)=objtool
 
-# Busybox's diff doesn't have -I, avoid warning in that case
-#
 $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
-	@(diff -I 2>&1 | grep -q 'option requires an argument' && \
-	test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \
-	diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \
-	diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \
-	diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \
-	diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \
-	diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \
-	diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \
-	|| echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true
-	@(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \
-	diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \
-	|| echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true
+	@./sync-check.sh
 	$(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@
 
 
tools/objtool/sync-check.sh new file +29 -0
new file mode 100755
index 0000000..1470e74
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+FILES='
+arch/x86/lib/insn.c
+arch/x86/lib/inat.c
+arch/x86/lib/x86-opcode-map.txt
+arch/x86/tools/gen-insn-attr-x86.awk
+arch/x86/include/asm/insn.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/include/asm/orc_types.h
+'
+
+check()
+{
+	local file=$1
+
+	diff $file ../../$file > /dev/null ||
+		echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'"
+}
+
+if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
+	exit 0
+fi
+
+for i in $FILES; do
+  check $i
+done