blob: 4bbabaecab14e09b1d5147b48426eb0e2dd32958 [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 +010019"
Borislav Petkovd30c7b82021-02-22 13:34:40 +010020
21SYNC_CHECK_FILES='
22arch/x86/include/asm/inat.h
23arch/x86/include/asm/insn.h
24arch/x86/lib/inat.c
25arch/x86/lib/insn.c
26'
Julien Thierrybb090fd2020-09-04 16:30:20 +010027fi
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060028
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030029check_2 () {
30 file1=$1
31 file2=$2
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060032
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030033 shift
34 shift
35
36 cmd="diff $* $file1 $file2 > /dev/null"
37
38 test -f $file2 && {
39 eval $cmd || {
40 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
41 echo diff -u $file1 $file2
42 }
43 }
44}
45
46check () {
47 file=$1
48
49 shift
50
51 check_2 tools/$file $file $*
Josh Poimboeuf3bd51c52017-11-06 07:21:51 -060052}
53
54if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
55 exit 0
56fi
57
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030058cd ../..
59
Julien Thierry3890b8d2020-09-04 16:30:19 +010060while read -r file_entry; do
61 if [ -z "$file_entry" ]; then
62 continue
63 fi
Arnaldo Carvalho de Melo2ffd84a2019-08-31 17:29:47 -030064
Julien Thierry3890b8d2020-09-04 16:30:19 +010065 check $file_entry
66done <<EOF
67$FILES
68EOF
Borislav Petkovd30c7b82021-02-22 13:34:40 +010069
70if [ "$SRCARCH" = "x86" ]; then
71 for i in $SYNC_CHECK_FILES; do
72 check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
73 done
74fi