Josh Poimboeuf | 3bd51c5 | 2017-11-06 07:21:51 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | |
Julien Thierry | bb090fd | 2020-09-04 16:30:20 +0100 | [diff] [blame] | 4 | if [ -z "$SRCARCH" ]; then |
| 5 | echo 'sync-check.sh: error: missing $SRCARCH environment variable' >&2 |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
Julien Thierry | ee819ae | 2020-09-04 16:30:27 +0100 | [diff] [blame] | 9 | FILES="include/linux/objtool.h" |
| 10 | |
Julien Thierry | bb090fd | 2020-09-04 16:30:20 +0100 | [diff] [blame] | 11 | if [ "$SRCARCH" = "x86" ]; then |
Julien Thierry | ee819ae | 2020-09-04 16:30:27 +0100 | [diff] [blame] | 12 | FILES="$FILES |
Josh Poimboeuf | 3bd51c5 | 2017-11-06 07:21:51 -0600 | [diff] [blame] | 13 | arch/x86/include/asm/inat_types.h |
| 14 | arch/x86/include/asm/orc_types.h |
Masami Hiramatsu | 4d65adf | 2019-09-06 22:14:10 +0900 | [diff] [blame] | 15 | arch/x86/include/asm/emulate_prefix.h |
Josh Poimboeuf | d046b72 | 2019-08-29 17:41:18 -0500 | [diff] [blame] | 16 | arch/x86/lib/x86-opcode-map.txt |
| 17 | arch/x86/tools/gen-insn-attr-x86.awk |
Josh Poimboeuf | 1e7e478 | 2020-08-18 15:57:45 +0200 | [diff] [blame] | 18 | include/linux/static_call_types.h |
Julien Thierry | 3890b8d | 2020-09-04 16:30:19 +0100 | [diff] [blame] | 19 | arch/x86/include/asm/inat.h -I '^#include [\"<]\(asm/\)*inat_types.h[\">]' |
| 20 | arch/x86/include/asm/insn.h -I '^#include [\"<]\(asm/\)*inat.h[\">]' |
| 21 | arch/x86/lib/inat.c -I '^#include [\"<]\(../include/\)*asm/insn.h[\">]' |
| 22 | arch/x86/lib/insn.c -I '^#include [\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]' -I '^#include [\"<]\(../include/\)*asm/emulate_prefix.h[\">]' |
| 23 | " |
Julien Thierry | bb090fd | 2020-09-04 16:30:20 +0100 | [diff] [blame] | 24 | fi |
Josh Poimboeuf | 3bd51c5 | 2017-11-06 07:21:51 -0600 | [diff] [blame] | 25 | |
Arnaldo Carvalho de Melo | 2ffd84a | 2019-08-31 17:29:47 -0300 | [diff] [blame] | 26 | check_2 () { |
| 27 | file1=$1 |
| 28 | file2=$2 |
Josh Poimboeuf | 3bd51c5 | 2017-11-06 07:21:51 -0600 | [diff] [blame] | 29 | |
Arnaldo Carvalho de Melo | 2ffd84a | 2019-08-31 17:29:47 -0300 | [diff] [blame] | 30 | 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 | |
| 43 | check () { |
| 44 | file=$1 |
| 45 | |
| 46 | shift |
| 47 | |
| 48 | check_2 tools/$file $file $* |
Josh Poimboeuf | 3bd51c5 | 2017-11-06 07:21:51 -0600 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then |
| 52 | exit 0 |
| 53 | fi |
| 54 | |
Arnaldo Carvalho de Melo | 2ffd84a | 2019-08-31 17:29:47 -0300 | [diff] [blame] | 55 | cd ../.. |
| 56 | |
Julien Thierry | 3890b8d | 2020-09-04 16:30:19 +0100 | [diff] [blame] | 57 | while read -r file_entry; do |
| 58 | if [ -z "$file_entry" ]; then |
| 59 | continue |
| 60 | fi |
Arnaldo Carvalho de Melo | 2ffd84a | 2019-08-31 17:29:47 -0300 | [diff] [blame] | 61 | |
Julien Thierry | 3890b8d | 2020-09-04 16:30:19 +0100 | [diff] [blame] | 62 | check $file_entry |
| 63 | done <<EOF |
| 64 | $FILES |
| 65 | EOF |