diff options
| author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-11-06 08:21:51 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2017-11-07 04:48:34 -0500 |
| commit | 3bd51c5a371de917e4e7401c9df006b5998579df (patch) | |
| tree | 03b8997b2fce9066a159a56c069596cd5bb14b82 /tools | |
| parent | 6a77cff819ae3e31992bde6432c9b5720748a89b (diff) | |
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.
Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/ab015f15ccd8c0c6008493c3c6ee3d495eaf2927.1509974346.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/objtool/Makefile | 16 | ||||
| -rwxr-xr-x | tools/objtool/sync-check.sh | 29 |
2 files changed, 30 insertions, 15 deletions
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index c6a19d946ec1..6aaed251b4ed 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile | |||
| @@ -43,22 +43,8 @@ include $(srctree)/tools/build/Makefile.include | |||
| 43 | $(OBJTOOL_IN): fixdep FORCE | 43 | $(OBJTOOL_IN): fixdep FORCE |
| 44 | @$(MAKE) $(build)=objtool | 44 | @$(MAKE) $(build)=objtool |
| 45 | 45 | ||
| 46 | # Busybox's diff doesn't have -I, avoid warning in that case | ||
| 47 | # | ||
| 48 | $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) | 46 | $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) |
| 49 | @(diff -I 2>&1 | grep -q 'option requires an argument' && \ | 47 | @./sync-check.sh |
| 50 | test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \ | ||
| 51 | diff arch/x86/lib/insn.c ../../arch/x86/lib/insn.c >/dev/null && \ | ||
| 52 | diff arch/x86/lib/inat.c ../../arch/x86/lib/inat.c >/dev/null && \ | ||
| 53 | diff arch/x86/lib/x86-opcode-map.txt ../../arch/x86/lib/x86-opcode-map.txt >/dev/null && \ | ||
| 54 | diff arch/x86/tools/gen-insn-attr-x86.awk ../../arch/x86/tools/gen-insn-attr-x86.awk >/dev/null && \ | ||
| 55 | diff arch/x86/include/asm/insn.h ../../arch/x86/include/asm/insn.h >/dev/null && \ | ||
| 56 | diff arch/x86/include/asm/inat.h ../../arch/x86/include/asm/inat.h >/dev/null && \ | ||
| 57 | diff arch/x86/include/asm/inat_types.h ../../arch/x86/include/asm/inat_types.h >/dev/null) \ | ||
| 58 | || echo "warning: objtool: x86 instruction decoder differs from kernel" >&2 )) || true | ||
| 59 | @(test -d ../../kernel -a -d ../../tools -a -d ../objtool && (( \ | ||
| 60 | diff ../../arch/x86/include/asm/orc_types.h arch/x86/include/asm/orc_types.h >/dev/null) \ | ||
| 61 | || echo "warning: objtool: orc_types.h differs from kernel" >&2 )) || true | ||
| 62 | $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ | 48 | $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ |
| 63 | 49 | ||
| 64 | 50 | ||
diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh new file mode 100755 index 000000000000..1470e74e9d66 --- /dev/null +++ b/tools/objtool/sync-check.sh | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | |||
| 4 | FILES=' | ||
| 5 | arch/x86/lib/insn.c | ||
| 6 | arch/x86/lib/inat.c | ||
| 7 | arch/x86/lib/x86-opcode-map.txt | ||
| 8 | arch/x86/tools/gen-insn-attr-x86.awk | ||
| 9 | arch/x86/include/asm/insn.h | ||
| 10 | arch/x86/include/asm/inat.h | ||
| 11 | arch/x86/include/asm/inat_types.h | ||
| 12 | arch/x86/include/asm/orc_types.h | ||
| 13 | ' | ||
| 14 | |||
| 15 | check() | ||
| 16 | { | ||
| 17 | local file=$1 | ||
| 18 | |||
| 19 | diff $file ../../$file > /dev/null || | ||
| 20 | echo "Warning: synced file at 'tools/objtool/$file' differs from latest kernel version at '$file'" | ||
| 21 | } | ||
| 22 | |||
| 23 | if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then | ||
| 24 | exit 0 | ||
| 25 | fi | ||
| 26 | |||
| 27 | for i in $FILES; do | ||
| 28 | check $i | ||
| 29 | done | ||
