blob: 606a4b5e929f29311d379b818dc6b1b60929dc1b [file] [log] [blame]
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -06001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
Julien Thierrybb090fd2020-09-04 16:30:20 +01004if [ -z "$SRCARCH" ]; then
5 echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2
6 exit 1
7fi
8
Julien Thierryee819ae2020-09-04 16:30:27 +01009FILES="include/linux/objtool.h"
10
Julien Thierrybb090fd2020-09-04 16:30:20 +010011if [ "$SRCARCH" = "x86" ]; then
Julien Thierryee819ae2020-09-04 16:30:27 +010012FILES="$FILES
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060013arch/x86/include/asm/inat_types.h
14arch/x86/include/asm/orc_types.h
Masami Hiramatsu4d65adf2019-09-06 22:14:10 +090015arch/x86/include/asm/emulate_prefix.h
Josh Poimboeufd046b722019-08-29 17:41:18 -050016arch/x86/lib/x86-opcode-map.txt
17arch/x86/tools/gen-insn-attr-x86.awk
Josh Poimboeuf1e7e4782020-08-18 15:57:45 +020018include/linux/static_call_types.h
Julien Thierry3890b8d2020-09-04 16:30:19 +010019arch/x86/include/asm/inat.h -I '^#include [\"<]\(asm/\)*inat_types.h[\">]'
20arch/x86/include/asm/insn.h -I '^#include [\"<]\(asm/\)*inat.h[\">]'
21arch/x86/lib/inat.c -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]'
22arch/x86/lib/insn.c -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]'
23"
Julien Thierrybb090fd2020-09-04 16:30:20 +010024fi
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060025
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030026check_2 () {
27 file1=$1
28 file2=$2
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060029
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030030 shift
31 shift
32
33 cmd="diff $* $file1 $file2 > /dev/null"
34
35 test -f $file2 && {
36 eval $cmd || {
37 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
38 echo diff -u $file1 $file2
39 }
40 }
41}
42
43check () {
44 file=$1
45
46 shift
47
48 check_2 tools/$file $file $*
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060049}
50
51if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
52 exit 0
53fi
54
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030055cd ../..
56
Julien Thierry3890b8d2020-09-04 16:30:19 +010057while read -r file_entry; do
58 if [ -z "$file_entry" ]; then
59 continue
60 fi
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030061
Julien Thierry3890b8d2020-09-04 16:30:19 +010062 check $file_entry
63done <<EOF
64$FILES
65EOF