objtool: sync cleanups
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.shSignature · 1 line
2.13.6
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
@@ -1,3 +1,3 @@ -arch/x86/insn/inat-tables.c +arch/x86/lib/inat-tables.c objtool fixdep
tools/objtool/Makefile +12 -10
@@ -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
@@ -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
@@ -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
@@ -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
tools/objtool/arch/x86/include/asm/insn.h renamed from tools/objtool/arch/x86/insn/insn.h +1 -1
@@ -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
tools/objtool/arch/x86/lib/inat.c renamed from tools/objtool/arch/x86/insn/inat.c +1 -1
@@ -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
@@ -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
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk renamed from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk +0 -0
tools/objtool/orc.h +1 -1
@@ -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
tip-bot for Josh Poimboeuf
merge bot[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
@@ -1,3 +1,3 @@ -arch/x86/insn/inat-tables.c +arch/x86/lib/inat-tables.c objtool fixdep
tools/objtool/Makefile +12 -10
@@ -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
@@ -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
@@ -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
tools/objtool/arch/x86/include/asm/inat_types.h renamed from tools/objtool/arch/x86/insn/inat_types.h +0 -0
tools/objtool/arch/x86/include/asm/insn.h renamed from arch/x86/include/asm/insn.h +0 -0
tools/objtool/arch/x86/include/asm/orc_types.h renamed from tools/objtool/orc_types.h +0 -0
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
tools/objtool/arch/x86/lib/insn.c renamed from arch/x86/lib/insn.c +0 -0
tools/objtool/arch/x86/lib/x86-opcode-map.txt renamed from tools/objtool/arch/x86/insn/x86-opcode-map.txt +0 -0
tools/objtool/arch/x86/tools/gen-insn-attr-x86.awk renamed from tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk +0 -0
tools/objtool/orc.h +1 -1
@@ -18,7 +18,7 @@#ifndef _ORC_H#define _ORC_H -#include "orc_types.h" +#include <asm/orc_types.h> struct objtool_file ;
PATCH v2 2/2 objtool: Move sync check to a script
In reply to Josh PoimboeufReplace 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
@@ -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
@@ -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
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
Makefilewith a clean bash script, and make the warnings more specific.Heavily inspired by
tools/perf/check-headers.sh.Suggested-by Ingo Molnar <[email protected]>Signed-off-by Josh Poimboeuf <[email protected]>--- tools/objtool/Makefile | 16 +--------------- tools/objtool/sync-check.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) create mode 100755 tools/objtool/sync-check.shtools/objtool/Makefile +1
-15@@ -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@@ -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 */
#defineINAT_SEG_REG_IGNORE0
#defineINAT_SEG_REG_DEFAULT1#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
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,109Quoted 10 lines
/* Identifiers for segment registers */
#defineINAT_SEG_REG_IGNORE0
#defineINAT_SEG_REG_DEFAULT1#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 7I 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
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,109Quoted 10 lines
/* Identifiers for segment registers */
#defineINAT_SEG_REG_IGNORE0
#defineINAT_SEG_REG_DEFAULT1#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 7I 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
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,109Quoted 10 lines
/* Identifiers for segment registers */
#defineINAT_SEG_REG_IGNORE0
#defineINAT_SEG_REG_DEFAULT1#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 7I 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
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,109Quoted 10 lines
/* Identifiers for segment registers */
#defineINAT_SEG_REG_IGNORE0
#defineINAT_SEG_REG_DEFAULT1#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 7I 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/shis 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
tip-bot for Josh Poimboeuf
merge bot[tip:core/objtool] objtool: Move kernel headers/code sync check to a script
In reply to Josh Poimboeufobjtool: 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
@@ -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
@@ -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